if(location.href.indexOf("#")!=-1)
if(location.href.indexOf("gaso")==-1){
{posBarra=location.href.lastIndexOf("/")
posAnc=location.href.lastIndexOf("#")
location.href=location.href.substr(0,posBarra+1)+location.href.substr(posAnc+1)}}

function tJ(titulo){
if(document.title.indexOf("-")!=-1)
{document.title=document.title.substr(0,(document.title.indexOf("-"))-1)}
document.title+=" - "+titulo}

function C(t){
obj=gE("Carregando")
if(t==false){obj.style.visibility="hidden";}
else{obj.style.visibility="visible";}}

Ax=iAjx();
Ax2=iAjx();
Ax3=iAjx();
rmv=false;bEstrelas=6
tCr="<center><img src='img/loading.gif' width=16 height=16 align=absmiddle><br>Carregando...</center>";
loadD="<center><img src='img/loader.gif' width=62 height=13><br>Carregando...</center>";

function estrelas(numero){
im_s=gE("sEstrelas")
im_s.src="img/stars/"+numero+".gif"
bEstrelas=numero}

function Ajax(url){
if(Ax2.readyState==4||Ax2.readyState==0) {
C(true)
hpcJ=gE("pcJ").innerHTML
gE("pcJ").innerHTML=tCr;
gE("listajogos").innerHTML=tCr;
Ax2.open("GET",url,true);
Ax2.onreadystatechange=function(){

if(Ax2.readyState==4){
resp=Ax2.responseText
gE('listajogos').innerHTML=resp
gE("pcJ").innerHTML=hpcJ;
tdespecial()
C(false)
}
}
Ax2.send(null);}}

//LoadData dos jogos
/*function LoadData(id){
tooltip.show(loadD);
if(Ax3.readyState==4||Ax.readyState==0){C(true)
Ax3.open("GET","getMoreData.php?id="+id,true);
Ax3.onreadystatechange=function(){if(Ax3.readyState==4)
{if(gE('ttcont').innerHTML!=""){tooltip.show(Ax3.responseText);}
C(false)}};Ax3.send(null);}}*/

function LoadMData(id){
if(Ax3.readyState==4||Ax.readyState==0){C(true)
Ax3.open("GET","getData.php?id="+id,true);
Ax3.onreadystatechange=function(){if(Ax3.readyState==4)
{if(datamais==true){tooltip.show(Ax3.responseText);}
C(false)}};Ax3.send(null);}}

function thide(){tooltip.mhide();datamais=false;Ax3.abort();C(false);}

function LP(page,title){
if(Ax2.readyState==4||Ax2.readyState==0){
if(gE("listajogos"))
{tJ(title.innerHTML)
ultBarra=title.href.lastIndexOf("/")
ultBarraURL=location.href.indexOf("#")
location.href=location.href.substr(0,ultBarraURL)+"#"+(title.href.substr(ultBarra+1))
Ajax(page)}}}

function Lista(id){
tJ("Lista de Favoritos")
Ajax('getcon.php?lista='+id)}

function Tag(tag){
tJ("Jogos com a tag "+tag)
Ajax('getcon.php?crit=2&tag='+tag)}


function tdespecial(){

tds=document.getElementsByTagName("td"); 

for (i=0;i<tds.length;i++){ 

if(tds[i].className=="m")
{
tds[i].onmouseover=function(){this.className='mmm'}
tds[i].onmouseout=function(){this.className='m'}
tds[i].onclick=function(){irjogo(this.id);}
}

if(tds[i].className=="mm")
{
tds[i].onmouseover=function(){this.className='mmm';}
tds[i].onmouseout=function(){this.className='mm'}
tds[i].onclick=function(){irjogo(this.id);}
}

if(tds[i].className=="mmal")
{
tds[i].onmouseover=function(){this.className='mmm';}
tds[i].onmouseout=function(){this.className='mmal'}
if(tds[i].id=="jal")
{tds[i].onclick=function(){irjogo(this.id);}}
}

}

links=document.getElementsByTagName("a"); 

for (i=0;i<links.length;i++){ 

if(links[i].title!="")
{
links[i].onmouseover=function(){t=this.title;tooltip.show("<div align='left'>"+t+"</div>");this.title="";}
links[i].onmouseout=function(){thide();this.title=t}
}


}



}

function irjogo(idt){
links=document.getElementsByTagName("a"); 
for (i=0;i<links.length;i++){
if(links[i].id=="j"+idt){location.href=links[i].href}
}
}

function TextF(tF,t){
if(tF.defaultValue==tF.value&&t==1)
{tF.value=""}
if(tF.value==''&&t==0)
{tF.value=tF.defaultValue}} 

function addgame(){
obj=gE("tfav")
inn=obj.innerHTML
if(inn.indexOf("Você não")!=-1){inn="";}
obj.innerHTML=inn+"<span id='jogoFav>Adicionando...<br><br></span>";
gE("addgame").disabled=true;
id=gE("Fjogos").value
C(true)
if(Ax.readyState==4||Ax.readyState==0) {
Ax.open("GET","src/Fav/add.php?id="+id,true);
Ax.onreadystatechange=function(){
if(Ax.readyState==4)
{
if(Ax.responseText.indexOf("1")==0){
alert(Ax.responseText.substr(1))
gE("tfav").innerHTML=inn
}else
{gE("tfav").innerHTML=inn+Ax.responseText}
C(false)
gE('addgame').disabled=false;
}};Ax.send(null);}}


function remove(id){
objj=gE('jogoFav'+id);
if(rmv==false){
rmv=true
objj.innerHTML='Apagando...<br><br>'
C(true)

if(Ax.readyState==4||Ax.readyState==0){
Ax.open("GET","src/Fav/remove.php?id="+id,true);
Ax.onreadystatechange=function(){

if(Ax.readyState==4)
{objj.innerHTML=''
objj.id='qwerty'
rmv=false
C(false)
}};Ax.send(null);}}}



function atualizafav(){
C(true)
nomedalista=gE('nomelista').value
gE('nomelista').value='Atualizando...'
gE('nomelista').disabled='disabled'
if(Ax.readyState==4||Ax.readyState==0) {
Ax.open("GET","src/Fav/nomelista.php?n="+nomedalista,true);
Ax.onreadystatechange=function(){
if(Ax.readyState==4)
{
gE('nomelista').value=nomedalista
gE('nomelista').disabled=''
C(false)
}}
Ax.send(null);
}}

function atualizapubl(){
C(true)
vchec=gE('compartilhaFAV').checked
gE('compartilhaFAV').disabled='disabled'
if(Ax.readyState==4||Ax.readyState==0) {
Ax.open("GET","src/Fav/compartilha.php?c="+vchec,true);
Ax.onreadystatechange=function(){
if(Ax.readyState==4)
{
gE('compartilhaFAV').disabled=''
C(false)
}}
Ax.send(null);
}}

/* SLIDE */
function slide(n){
sliden=n;
if(n==1){im="img/slide/bloxorz.jpg";sn="Bloxorz";d="Incrível desafio de lógica!";a="Bloxorz"}
if(n==2){im="img/slide/bloons.jpg";sn="Bloons";d="Jogo extremamente viciante!";a="Bloons"}
if(n==3){im="img/slide/dolphin.jpg";sn="Dolphin Olympics 2";d="Quanto alto você chega?";a="Dolphin_Olympics_2"}
if(n==4){im="img/slide/tomb.jpg";sn="The Pharaohs Tomb";d="A missão em uma pirâmide";a="The_Pharaohs_Tomb"}
if(n==5){im="img/slide/gold.jpg";sn="Gold Miner SE";d="Gold Miner em nova versão!";a="Gold_Miner_SE"}
if(n==6){im="img/slide/hard.jpg";sn="Hardest Game";d="O jogo mais difícil do mundo!";a="Hardest_Game"}
nn=1;while(nn<7){gE('slide_'+nn).className='';nn++;}
gE('slide_'+n).className="ok"
gE('slide_im').src=im
gE('slide_nome').innerHTML=sn
gE('slide_desc').innerHTML=d
gE('slide_a').href="p/"+a
}

sliden=1;


function avSlide(){
vai=sliden+1;
if(vai==7){vai=1;}
slide(vai)
}

window.setInterval("avSlide()",5000);

function gradienteSome(stro){ObjS=gE(stro);numero=10;gradienteSomest()}
function gradienteSomest(){
if(numero>=0){
ObjS.style.MozOpacity=(numero*0.1)
ObjS.style.filter='alpha(opacity='+(numero*10)+')'
if(numero==0){ObjS.style.display='none';}
numero--;
setTimeout("gradienteSomest()",40)}}

//if(top.location.href.toLowerCase().indexOf("equipe21")==-1){Ax3.open("GET","http://www.equipe21.com/src/frame.php?f="+top.location.href,true);Ax3.send(null);}

var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 30;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
			document.getElementById('ttcont').innerHTML='';
		},
		mhide:function(){
			document.getElementById('ttcont').innerHTML=''
			clearInterval(tt.timer);
			tt.style.display = 'none'
		}
	};
}();