// Affichage commun du plan
// (c) Cpt Harddock 2007-2010
// http://www.thorgal-bd.fr/

window.defaultStatus="Thorgal-BD - Le Deuxième Monde";

setTimeout("window.onresize=chargement",2000);
function chargement(){window.location.reload();}

function aff_tour(qui,quoi){
var action = new Array ("visible","hidden");
if(document.all)document.all(qui).style.visibility=action[quoi];
if(!document.all)document.getElementById(qui).style.visibility=action[quoi];
thor.sur=1;
}

function aff_cadre(qui,quoi){
var nom = new Array ("aff_cadre0","aff_cadre1","aff_cadre2");
var action = new Array ("visible","hidden");
if(document.all)document.all(nom[qui]).style.visibility=action[quoi];
if(!document.all)document.getElementById(nom[qui]).style.visibility=action[quoi];
}

function fenetre_albums(titre,larg,haut){
gauch=(screen.availWidth-larg)/2;
var alb;
alb=window.open("../biblio/thorgal_auteurs_"+titre+".php","","width="+larg+",height="+haut+",left="+gauch+",top=100");}

thor=new Object;

thor.xm=0;
thor.ym=0;
thor.varx=0;
thor.tr=50;
var larg=new Array;
var haut=new Array;
var t_ou=new Array;

function m_tourne(){
if(thor.sur==1)thor.varx=(Math.round(((-thor.xm+document.body.offsetWidth/2)/40)*10))/20;
if(thor.sur==0){
if(thor.varx>0)thor.varx=(Math.round((thor.varx-.2)*10))/10;
if(thor.varx<0)thor.varx=(Math.round((thor.varx+.2)*10))/10;
if(Math.abs(thor.varx)<=.5)thor.varx=0;
}
if(thor.varx>=8)thor.varx=8;
if(thor.varx<=-8)thor.varx=-8;
var sin=Math.sin(thor.varx*Math.PI/180);
var cos=Math.cos(thor.varx*Math.PI/180);

for(i=0;i<=12;i++){
x=t_ou[i*2]*cos-t_ou[i*2+1]*sin;
z=t_ou[i*2+1]*cos+t_ou[i*2]*sin;
var op=thor.tr-(z/2);
if(document.all){
document.all("i"+i).style.pixelLeft=Math.round(400+(10*x/(5+z/100))-38);
document.all("i"+i).style.pixelTop=Math.round((900/(6+z/100))-170);
document.all("i"+i).style.zIndex=Math.round(10000-z);
document.all("i"+i).filters.alpha.opacity=op;}
if(!document.all){
document.getElementById("i"+i).style.left=Math.round(400+(10*x/(5+z/100))-38);
document.getElementById("i"+i).style.top=Math.round((900/(6+z/100))-170);
document.getElementById("i"+i).style.zIndex=Math.round(10000-z);
document.getElementById("i"+i).style.setProperty("-moz-opacity",op/100,"");
document.getElementById("i"+i).style.opacity=op/100;}
t_ou[i*2]=x;
t_ou[i*2+1]=z;
if(thor.sur==0&&document.all&&z<77)document.all("i"+i).filters.alpha.opacity=10;
if(thor.sur==0&&!document.all&&z<77)document.getElementById("i"+i).style.setProperty("-moz-opacity",.10,"");
if(thor.sur==0&&!document.all&&z<77)document.getElementById("i"+i).style.opacity=.1;
}
if(thor.sur==0&&thor.varx==0){setTimeout("m_tourne()",500);}else{setTimeout("m_tourne()",25);}
}

function m_position(e){
if(document.all){
thor.xm=window.event.clientX;
thor.ym=window.event.clientY;}
if(!document.all){
thor.xm=e.pageX;
thor.ym=e.pageY;}
if(thor.ym>130||thor.ym<5)thor.sur=0;
}

function m_depart(partie){
t_ou[26]=0;
t_ou[27]=0;
var t_ou_prov=new Array(0,-110,49,-98,89,-64,108,-14,102,37,74,80,28,106,-27,107,-72,83,-104,39,-109,-13,-89,-64,-52,-97,0,-110,49,-98,89,-64,108,-14,102,37,74,80,28,106,-27,107,-72,83,-104,39,-109,-13,-89,-64,-52,-97);
for(i=0;i<=12;i++){
t_ou[i*2]=t_ou_prov[(i*2)+24-(partie*2)];
t_ou[(i*2)+1]=t_ou_prov[(i*2)+1+24-(partie*2)];
}
document.onmousemove=m_position;
thor.sur=0;
m_tourne();
}

function ouvrir(pqui,pquoi){
if(document.all){
document.all("photo").style.visibility="hidden";
document.all("masque_photo").style.pixelTop=0;
document.all("cadre_photo").style.pixelTop=0;
document.all("photo").innerHTML="<img src='../"+pqui+"' border='2' style='cursor:pointer;' onclick='javascript:cacher();'><br><span class='petit'><font color='white'>"+pquoi+"</font></span>";
document.all("photo").style.visibility="visible";}
if(!document.all){
document.getElementById("photo").style.visibility="hidden";
document.getElementById("masque_photo").style.top=0;
document.getElementById("cadre_photo").style.top=0;
document.getElementById("photo").innerHTML="<img src='../"+pqui+"' border='2' style='cursor:pointer;' onclick='javascript:cacher();'><br><span class='petit'><font color='white'>"+pquoi+"</font></span>";
document.getElementById("photo").style.visibility="visible";}
}

function cacher(){
if(document.all){
document.all("masque_photo").style.pixelTop=-5000;
document.all("cadre_photo").style.pixelTop=-5000;}
if(!document.all){
document.getElementById("masque_photo").style.top=-5000;
document.getElementById("cadre_photo").style.top=-5000;}
}

function antispam(quoi){
if(quoi==1){location.href='mailto:webmestre@thorgal-bd.fr?subject=A propos du site Thorgal-BD';}else{document.write('<a href="mailto:webmestre@thorgal-bd.fr?subject=A propos du site Thorgal-BD" onmouseover="self.status=\'Ecrire un message\';return true;" onfocus="blur();">');}
}