// JavaScript Document

// RollOver/RollOut de Imagens                    

function roll(obj, id) {
	if (typeof(obj) == "string") obj = document.getElementById(obj);
	obj.style.cursor = "pointer";
	var im = obj.src.substr(obj.src.length-5,1);
	if (id==null) (im==0) ? id = 1 : id = 0
	last = obj.src.lastIndexOf("/")+1;
	path = obj.src.substr(0,last)
	nimg = path + obj.src.substr(last,obj.src.length-5-last) + id + obj.src.substr(obj.src.length-4,4);
	obj.src = nimg;
}

// Preload Automático de Imagens 

function ImagePreload(imgArray) {
	for (i=0; i<document.images.length; i++) {
		if (document.images[i].onmouseover != null) {
			obj = document.images[i];
			var im = obj.src.substr(obj.src.length-5,1);
			(im==0) ? imo = 1 : imo = 0
			last = obj.src.lastIndexOf("/")+1;
			path = obj.src.substr(0,last)
			nimg = path + obj.src.substr(last,obj.src.length-5-last) + imo + obj.src.substr(obj.src.length-4,4);
			eval("var nimg_" + i + " = new Image();");
			eval("nimg_" + i + ".src = nimg;");
		}
	}
}

// Verificar o navegador utilizado 

function _browser(str) {
	(navigator.userAgent.toLowerCase().indexOf(str)+1) ? ret = true : ret = false;
	return ret;
}

// Aparecer Login na Barra:
function MostraLogin() {
$('busca').toggle();
$('login').toggle();
if ($('login').style.display =="") {
$('login').hide();
effect_1 = Effect.SlideDown('login',{duration:1.0});
}
return false;
}

// Modificar o Tamanho do Jogo:

function _SWFZoom(d) {
	obj = $("FlashGame");
	//if (_browser("msie")==false) {
	//	alert("Para modificar o tamanho do jogo, é preciso utilizar o Microsoft Internet Explorer =(");
	//	return;
//	}
	if (d==0) {
		nw = obj.width*0.9;
		nh = obj.height*0.9;
	} else {
		nw = obj.width*1.1;
		nh = obj.height*1.1;
	}
	obj.width = nw;
	obj.height = nh;
	
}

function MostraTop(p) {

if (p==1){
if ($('topequipes2').style.display =="") {
$('topequipes2').hide();
effect_1 = Effect.Appear('topequipes',{duration:1.0});
}
}
if (p==2){
if ($('topequipes').style.display =="") {
$('topequipes').hide();
effect_1 = Effect.Appear('topequipes2',{duration:1.0});
}
}
return false;
}

function zoomIn() {
changeGameSize(parseInt($("game_src").width) + Math.ceil($("game_src").width / 10), parseInt($("game_src").height) + Math.ceil($("game_src").height / 10))
//$$(".zoom_reset").first().style.display = "";
}

function zoomOut() {
changeGameSize(parseInt($("game_src").width) - Math.ceil($("game_src").width / 10), parseInt($("game_src").height) - Math.ceil($("game_src").height / 10))
//$$(".zoom_reset").first().style.display = "";
}

function changeGameSize(width, height) {
$("game_src").width = width;
$("game_src").height = height;
$("game_src").style.width = width + "px";
$("game_src").style.height = height + "px";
}
first: function() {
return this[0];
}

