//Identification Navigateurs
var mac = (navigator.userAgent.indexOf("Mac") != -1);
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var ie4 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 4')>0;
var ie5 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 5')>0;
var ie6 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 6')>0;
var ie = (browserName == "Microsoft Internet Explorer");
var ns = (browserName == "Netscape" && browserVer <5 && !document.getElementById);
var ns6 = (navigator.vendor == "Netscape6");
var ns7= navigator.userAgent.indexOf("Netscape/7")>=0;

//alert(navigator.userAgent)
//alert('mac : '+mac+'\nie4 : '+ie4+'\nie5 : '+ie5+'\nie6 : '+ie6+'\nie : '+ie+'\nns : '+ns+'\nns6 : '+ns6+'\nns7 : '+ns7);

function preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

home = new Array('casinos','bonuses','limits','tournaments','starting','poker');

function affect(witch){

	for(i = 0; i < home.length; i++){
		if(witch == home[i]){
			show(witch);
			rollOn("indik"+i);
		}
		else{
			hide(home[i]);
			rollOff("indik"+i);
		}
	}
}

function rollOff(ou){
	obj = eval("document." + ou);
	if(obj){
		obj.src = "spacer.gif";
	}
}

function rollOn(ou){
	obj = eval("document." + ou);
	if(obj){
		obj.src = "arrow.gif";
	}
}

//Affiche un layer||div
function show(cible){
	if(ns && document.layers[cible]){
		document.layers[cible].visibility = 'show';
	}
	else if(ie || ns6 || ns7){
		document.getElementById(cible).style.visibility = 'visible';
	}
}

//Masque un layer||div
function hide(cible){
	if(ns && document.layers[cible]){
		document.layers[cible].visibility = 'hide';
	}
	else if(ie || ns6 || ns7){
		document.getElementById(cible).style.visibility = 'hidden';
	}
}


//Position layers||div
function posDyn(page,cible,horiz,vert){
	//alert('page : '+page+'\ncible : '+cible+'\nhoriz : '+horiz+'\nvert : '+vert);
	//Constante largeur du site

	var cartouche = 770;

	//Recupere Espace affichage
	if(ns){
		client_width = window.innerWidth;
	}
	if(ie || ns6 || ns7){
		client_width = document.body.offsetWidth;
	}

	if(client_width >= cartouche){
		//Correction positionnement
		if(mac){ // MACOS
			if(ns){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
			if(ie){
				if(page == "home"){var vertplus = 0;var horizplus = 8;}
			}
			if(ns6 || ns7){
				if(page == "home"){var vertplus = 0;var horizplus = 8;}
			}
		}
		else{ // WINDOWS
			if(ns){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
			if(ie){ //talon
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
			if(ns6 || ns7){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
		}	

		if(new BrowserManager().isMSIE && new BrowserManager().version == 5.5)
			horizplus = 19

		if(ns){
			document.layers[cible].left = ((client_width/2)-(cartouche/2)) + horiz + horizplus;
			document.layers[cible].top = vert + vertplus;
		}
		else if(ie){
			document.getElementById(cible).style.left = ((client_width/2)-(cartouche/2)) + horiz + horizplus;
			document.getElementById(cible).style.top = vert  + vertplus;
		}
		else if(ns6 || ns7){
			
			
			var left = parseInt(((client_width/2))-(cartouche/2)) + parseInt(horiz)  + parseInt(horizplus);
			var top  = parseInt(vert)  + parseInt(vertplus);

			document.getElementById(cible).style.left = left+"px";
			document.getElementById(cible).style.top  = top+"px";
			

			//alert("Calculs \nleft = "+left +" \ntop "+top+ "\nlayer "+document.getElementById(cible)+"\n\nNow runtime \n left = "+document.getElementById(cible).style.left +" \ntop "+document.getElementById(cible).style.top+ "\nlayer "+document.getElementById(cible))
		}
	}
	
	else if(client_width < cartouche){
		//Correction positionnement
		if(mac){ // MACOS
			if(ns){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
			if(ie){
				if(page == "home"){var vertplus = 0;var horizplus = 8;}
			}
			if(ns6 || ns7){
				if(page == "home"){var vertplus = 0;var horizplus = 8;}
			}
		}
		else{ // WINDOWS
			if(ns){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}
			if(ie){
				if(page == "home"){var vertplus = 0;var horizplus =  30;}
			}
			if(ns6 || ns7){
				if(page == "home"){var vertplus = 0;var horizplus = 0;}
			}

		}	

		if(ns){
			document.layers[cible].left = horiz + horizplus;
			document.layers[cible].top = vert + vertplus;
		}
		else if(ie){
			document.getElementById(cible).style.left = horiz + horizplus;
			document.getElementById(cible).style.top = vert + vertplus;
			
		}
		else if(ns6 || ns7){
			document.getElementById(cible).style.left = parseInt(horiz) + parseInt(horizplus)+"px";
			document.getElementById(cible).style.top = parseInt(vert) + parseInt(vertplus) + "px";
		}
	}
	if(new BrowserManager().isMSIE && new BrowserManager().version == 5.5) {
		document.getElementById(cible).style.width = 210
		document.getElementById(cible).style.left = parseInt(document.getElementById(cible).style.left) - 25
		document.getElementById(cible).style.top = parseInt(document.getElementById(cible).style.top) + 2
	}

}
