// Script de navigation graphique www.alifsoundsystem.net
// Auteur: Axel QURIS - webmaster@alifsoundsystem.net

var initcompteur=164;
var compteur;
var compteurTest;
var speed=0;
var boucleTest=0;
var navig;
var speedouverture=5;
var i_interf=1;
var i_conten=1;
var avcm_interf=0;
var avcm_conten=0;

Nom="Firefox/";
Lu=navigator.userAgent.indexOf(Nom,0);
navig=unescape(navigator.userAgent.substring(Lu+Nom.length,navigator.userAgent.length));
if(navig=="1.0.4"){
initcompteur=82;
speedouverture=10;
}

compteur=initcompteur;
compteurTest=initcompteur;

function Affiche(NomLayer){
document.getElementById(NomLayer).style.visibility="visible";
}

function AffichePreload(){
var SITEVU=Lire("sitevu");
if(SITEVU!=1) document.write("<div id='Preload' style='position:absolute; width:100%; height:100%; z-index:50; left: 0; top: 0; background-image: url(images/fond.jpg); layer-background-image: url(images/fond.jpg); visibility: visible;'><table width='100%' height='100%'  border='0'><tr><td height='98%'><div align='center'><strong><img src='images/big_ecrit_blanc.gif' width='450' height='120'><br>www.alifsoundsystem.net</strong><br>Chargement de l'interface utilisateur, veuillez patienter svp...<br>Loading user interface, please wait...</div></td></tr><tr><td height='2%' valign='bottom' class='Style3'><div align='center' class='Minisombre'>Si ce pr&eacute;chargement vous para&icirc;t anormalement long (cela peut prendre plus de 30 secondes selon la vitesse de votre connexion), cliquez <a href='#' onClick='Emergency()'>ici</a>.<br>If this preload seems to be abnormally long (it may take more than 30 seconds depending on your connection speed), click <a href='#' onClick='Emergency()'>here</a>.</div></td></tr></table></div>");
else document.write("<div id='Preload' style='visibility:hidden;'></div>");	
}

function AllumeBarnoir(ICI){
PAGEVUE=Lire("pagevue_"+ICI);
DEJAVU=Lire("dejavu");
if(PAGEVUE!=1&&DEJAVU!=1) Affiche("AvisPanneau");
}

/*function AllongeBarnoir(ICI){
PAGEVUE=Lire("pagevue_"+ICI);
DEJAVU=Lire("dejavu");
if(PAGEVUE!=1&&DEJAVU!=1) document.Barnoir.width=parseInt(document.Barnoir.width)+5;
}

function AllongeBarnoir2(ICI,objets){
objets=100/objets;
objets+=0.5;
PAGEVUE=Lire("pagevue_"+ICI);
DEJAVU=Lire("dejavu");
if(PAGEVUE!=1&&DEJAVU!=1&&document.Barnoir2.width<=105) document.Barnoir2.width=parseInt(document.Barnoir2.width)+objets;
}
*/

function Anime(lecalque){
document.getElementById(lecalque).style.left=parseInt(document.getElementById(lecalque).style.left)+speedouverture;
document.getElementById(lecalque).style.width=parseInt(document.getElementById(lecalque).style.width)-speedouverture;
compteur--;
if(compteur<=0||boucleTest>=9){
clearInterval(intervalle);
document.cookie="dejavu=1";
Efface(lecalque);
Efface("Cacheporte");
}
}

function AnimOff(){
document.cookie="TEST_OK=0";
Efface("Animon");
Affiche("Animoff");
}

function AnimOn(){
document.cookie="TEST_OK=1";
Efface("Animoff");
Affiche("Animon");
}

function Charge(ICI){
document.getElementById("Preload").style.visibility="hidden";
SITEVU=Lire("sitevu");
if(SITEVU!=1){
document.cookie="sitevu=1";
location.href=location.href;
}
else{
ici="pagevue_"+ICI+"=1";
document.cookie=ici;
DEJAVU=Lire("dejavu");
TEST=Lire("TEST_OK");
if(DEJAVU==1||TEST==0){
Emergency();
if(TEST==0) Affiche("Animoff");
else Affiche("Animon");
}
else{
if(TEST==1){
Affiche("Animon");
Efface("Panneau_test");
Affiche("Cacheporte");
intervalle=setInterval("Anime('Panneau')",10); 
}
else{
var loadTest="intervalleTest=setInterval('Test()',100)";
setTimeout(loadTest,100);
Affiche("Barre_test");
Affiche("Cacheporte");
intervalle=setInterval("Anime('Panneau_test')",10);
}
}
}
}

function Count_conten(ICI,elements){
//PAGEVUE=Lire("pagevue_"+ICI);
//DEJAVU=Lire("dejavu");
//if(PAGEVUE!=1&&DEJAVU!=1){
augm_conten=100/elements;
if(i_conten==elements){
document.images["cnt_conten"].src="images/8pxn_1.gif";
document.images["dzn_conten"].src="images/8pxn_0.gif";
document.images["unt_conten"].src="images/8pxn_0.gif";
}
else{
avcm_conten=Math.floor(i_conten*augm_conten);
dizn_conten=Math.floor(avcm_conten/10);
unte_conten=avcm_conten-(10*dizn_conten);
d_conten="images/8pxn_"+dizn_conten+".gif";
u_conten="images/8pxn_"+unte_conten+".gif";
document.images["dzn_conten"].src=d_conten;
document.images["unt_conten"].src=u_conten;
}
//}
i_conten++;
}

function Count_interf(ICI){
//PAGEVUE=Lire("pagevue_"+ICI);
//DEJAVU=Lire("dejavu");
//if(PAGEVUE!=1&&DEJAVU!=1){
augm_interf=100/21;
if(i_interf==21){
document.images["cnt_interf"].src="images/8pxn_1.gif";
document.images["dzn_interf"].src="images/8pxn_0.gif";
document.images["unt_interf"].src="images/8pxn_0.gif";
}
else{
avcm_interf=Math.floor(i_interf*augm_interf);
dizn_interf=Math.floor(avcm_interf/10);
unte_interf=avcm_interf-(10*dizn_interf);
d_interf="images/8pxn_"+dizn_interf+".gif";
u_interf="images/8pxn_"+unte_interf+".gif";
document.images["dzn_interf"].src=d_interf;
document.images["unt_interf"].src=u_interf;
}
//}
i_interf++;
}

function Efface(NomLayer){
document.getElementById(NomLayer).style.visibility="hidden";
}

function Efface_panneau(){
TEST=Lire("TEST_OK");
SITEVU=Lire("sitevu");
DEJAVU=Lire("dejavu");
if(DEJAVU==1){
if(SITEVU==1)Emergency();
}
}

function Emergency(){
Efface("LayerExit_click");
Efface("LayerExit_1");
Efface("LayerExit_0");
Efface("OK_barre_test");
Efface("ALERT_barre_test");
Efface("Barre_test");
Efface("Panneau_test");
Efface("Panneau");
Efface("AvisPanneau");
Efface("Cacheporte");
Efface("Preload");
}

function Ferme(PAGE){
document.getElementById("Panneau").style.left=parseInt(document.getElementById("Panneau").style.left)-speedouverture;
document.getElementById("Panneau").style.width=parseInt(document.getElementById("Panneau").style.width)+speedouverture;
compteur--;
if(compteur<=0){
clearInterval(intervalle);
location.href=PAGE;
}
}

function Fermeture(PAGE){
TEST=Lire("TEST_OK");
document.cookie="dejavu=0";
document.cookie="contact_affiche=non";
if(TEST!=0){
compteur=initcompteur;
Efface("AvisPanneau");
Efface("OK_barre_test");
Efface("ALERT_barre_test");
Efface("Barre_test");
Affiche("Cacheporte");
Affiche("Panneau");
document.getElementById("Panneau").style.left=820+12+decalx;
document.getElementById("Panneau").style.width=5;
intervalle=setInterval("Ferme('"+PAGE+"')",10);
}	
else{	
//Affiche("Panneau");
location.href=PAGE;
}
}

function Lire(Nom){
Nom+="=";
Lu=document.cookie.indexOf(Nom,0);
if(Lu<=-1) return("non");
else{
End=document.cookie.indexOf(";",Lu);
if(End<=-1) return(unescape(document.cookie.substring(Lu+Nom.length,document.cookie.length)));
else return(unescape(document.cookie.substring(Lu+Nom.length,End)));
}
}

function Test(){
if(boucleTest<9){
boucleTest++;
speed=speed+(compteurTest-compteur);
compteurTest=compteur;
document.Barjon.width=parseInt(document.Barjon.width)+15;
}
else{
boucleTest=0;
clearInterval(intervalleTest);
clearInterval(intervalle);
speed=speed/10;
if(navig=="1.0.4") speed*=2;
if(speed<4){
Affiche("ALERT_barre_test");
document.cookie="dejavu=1";
document.cookie="TEST_OK=0";
Affiche("Animoff");
setTimeout("Emergency()",3000);
}
else{
Affiche("OK_barre_test");
Affiche("Cacheporte");
document.cookie="dejavu=1";
document.cookie="TEST_OK=1";
TESTOK=Lire("TEST_OK");
if(TESTOK==1) Affiche("Animon");
else Affiche("Nocookies");
compteur=initcompteur;
var loadPage="intervalle=setInterval(\"Anime('Panneau')\",10)";
setTimeout(loadPage,2000);
}
}
}