function changeBase(){
	oAnimation = document.getElementById('website');
	alert(oAnimation.bgcolor);
}
function WinOpen2(fichierhtml,features) {
	msgWindow=window.open(fichierhtml,'',features)
}
function goTop() {
	self.scrollTo(0,0);
}
function goY(y) {
	self.scrollTo(0,y);
}
function changeColor(c){
	document.bgColor = c;
	return void(0);
}
function WriteCook(nom,val){
	date=new Date;
	date.setMonth(date.getMonth()+1);
	document.cookie=nom+"="+escape(val)+";expires="+date.toGMTString();
}
function GetCook (nom) {
	if (document.cookie) {
		deb = document.cookie.indexOf(nom + "=");
		if (deb >= 0) {
			deb += nom.length + 1;
			fin = document.cookie.indexOf(";",deb);
			if (fin < 0) fin = document.cookie.length;
			return unescape(document.cookie.substring(deb,fin));
		}
	}
	return null;
}
function writeVars(){
	var towrite="";
	//detect cookies
	if (GetCook("lgg") != null & GetCook("pss") != null & GetCook("lgg") != "" & GetCook("pss") != ""){
		towrite+="&lgg="+GetCook("lgg")+"&pss="+GetCook("pss");
	}
	if (GetCook("lastSondageID") != null) {
		towrite+="&lastSondageID="+GetCook("lastSondageID");
	}
	return(towrite);
}
function detectVarInURL(variable) {
	var uri = top.location.toString();
	var deb = uri.indexOf(variable + "=");
	if (deb >=0) {
		deb += variable.length + 1;
		var fin = uri.indexOf("&",deb)
		if (fin < 0) fin = uri.length
		return unescape(uri.substring(deb,fin));
	}
	return null;
}
function setFlashHeight(newH){
	document.getElementById('website').style.height = newH+"px";		
}
function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body && document.body.clientHeight) {
		windowHeight = document.body.clientHeight;
	}
    //return windowHeight;
	var scrOfX = 0, scrOfY = 0;
	if ( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if ( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if ( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	//return [ scrOfX, scrOfY ];
	//if (scrOfY==0) {
		//return (0);
	//} else {
		return (windowHeight/2) + scrOfY;
	//}
}
function scrollToY(y) {
	 //return windowHeight;
	var scrOfX = 0, scrOfY = 0;
	if ( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if ( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if ( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	if (scrOfY>y)	self.scrollTo(0,y);
}
function logo() {
	if (top.location.toString().substring(0,24)=="http://tintin.france2.fr") {
		document.write('<a href="http://www.france2.fr" target="_blank"><img src="pub/images/pub_04_f2.gif" width="235" height="90" border="0" alt=""></a>');
	} else if (top.location.toString().substring(0,24)=="http://tintin.france5.fr") {
		document.write('<a href="http://www.france5.fr" target="_blank"><img src="pub/images/pub_04_f5.gif" width="235" height="90" border="0" alt=""></a>');
	} else {
		document.write('<a href="http://www.france3.fr" target="_blank"><img src="pub/images/pub_04.gif" width="235" height="90" border="0" alt=""></a>');
	}
}
function refreshiframe() {
	if (document.getElementById("pub")!=null) document.all.pub.src="pub/pub.html";
}
function stats(language) {
	if (language!=undefined) {
		document.write('<img src="start.php?lang='+language+'" width="1" height="1">')
	} else if (detectVarInURL("lang")!=null) {
		document.write('<img src="start.php?lang='+detectVarInURL("lang")+'" width="1" height="1">');
	} else {
		document.write('<img src="start.php" width="1" height="1">');	   
	}
}
function lh() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body && document.body.clientHeight) {
		windowHeight = document.body.clientHeight;
	}
    
    var windowWidth=0;
    if (typeof(window.innerWidth)=='number') {
        windowWidth = window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		windowWidth = document.documentElement.clientWidth;
	} else if (document.body && document.body.clientWidth) {
		windowWidth = document.body.clientWidth;
	}
	
	return windowWidth+","+windowHeight;
}