// JavaScript Document
var Public = {
	getPageSize: function()
	{
			/* Lightbox v2.0 */
			var xScroll, yScroll;
			
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = document.body.scrollWidth;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				windowWidth = self.innerWidth;
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
		
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = windowWidth;
			} else {
				pageWidth = xScroll;
			}
					
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
	},
	Bookmark: function()
	{
		var url_site="http://www.guijogos.com/"
		var titulo_site="Gui Jogos.com :: Diversão, Na Faixa?"
		if (document.all)
			window.external.AddFavorite(url_site,titulo_site);
		else {
			window.alert("Pressione CTRL + D para adicionar nosso site nos favoritos!");	
		}
		return false;
	},
	LinksEffect: function()
	{ 
		$("#categorias_content a").hover(
			function () {
				$(this).animate({ 
					borderWidth: "5px"
				}, 300 );
			}, 
			function () {
				$(this).animate({ 
					borderWidth: "1px"
				}, 300 );
			}
		);
		/*$(".bordaJogo").hover(
			function () {
				$(this).animate({ 
					opacity: 0.8
				}, 300 );
			}, 
			function () {
				$(this).animate({ 
					opacity: 1.0
				}, 300 );
			}
		);*/
	},
	getFlashMovieObject: function(movieName) {
		if ( window.document[movieName] ) {
			return window.document[movieName];
		} //if
		if ( navigator.appName.indexOf("Microsoft Internet") == -1 ) {
			if ( document.embeds && document.embeds[movieName] ) {
				return document.embeds[movieName];
			} //if
		} //if
		else {
			return $('#'+movieName);
		} //Fim do else
	},
	resizeDiv: function(width, height) {
		var movie = Public.getFlashMovieObject("MySwf");
		movie.width = width;
		movie.height = height;
	},
	AumentaJogo: function(altura){
		$('.MyGame').css({ "width":"800px","position":"fixed","z-index":"9999","top":"0px","left":"0px" });
		Tamanhos = Public.getPageSize();
		Public.resizeDiv(800,(Tamanhos[3]-150));
	},
	DiminuiJogo: function(altura){
		$('.MyGame').css({"top":"0","position":"relative","z-index":"5", "width":"600px"});
		Public.resizeDiv(600,500);
	},
	Full: function(altura){
		Tamanhos = Public.getPageSize();
		$('.MyGame').css({  "width": (Tamanhos[2])+"px","left":"0","top":"0","position":"fixed","z-index":"9999" });
		Public.resizeDiv((Tamanhos[2]),(Tamanhos[3]-150));
	},
	EscreveSWF: function(swf,largura,altura){
		var so = new SWFObject(swf, "MySwf", largura, altura, "9", "#FFFFFF");
		so.useExpressInstall('./js/expressinstall.swf');
	   	so.write("alvoSWF");
	}
};