function v_html(){
	if(self.location.pathname.indexOf("html")>=0) return true;
	else return false;
}

function getHTTPObject() {
  var xmlhttp;
    if(window.XMLHttpRequest) {
    	try {
			xmlhttp = new XMLHttpRequest();
        } catch(e) {
			xmlhttp = false;
        }
    }
	if(!xmlhttp && window.ActiveXObject) {
       	try {
        	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		xmlhttp = false;
        	}
		}
    }
	//if(!xmlhttp) alert("erreur chargement xmlhttp");
  return xmlhttp;
  }

function charger(calque,url){
	if(v_html()) return true;
	//document.location.href=url.replace("../contenus/","");
	var xhr_object = null;
	xhr_object=getHTTPObject();
	xhr_object.open("POST", url, true); 
	xhr_object.onreadystatechange = function() { 
		if(xhr_object.readyState == 4) { 
			ecritCalque(calque,xhr_object.responseText);
			reinitscroll();
			if(url.indexOf('liste-dvd')>=0){init_dvd();}
		}
	}
	xhr_object.send(null);
	return false;
}//Si pb avec cette fonction, consulter : http://www.toutjavascript.com/savoir/xmlhttprequest.php3

function miseAJour(url){
	charger('divcontenu',url);
	if(url.indexOf('news')>=0){
		charger('flashinfos',"../contenus/flashinfo.php");
		charger('newsletter',"../contenus/newsletter.php");
	}
	else if(url.indexOf('collection')>=0){
		charger('flashinfos',"../contenus/liste-dvd.php");
	}
}

function ecritCalque(idCalque,content){
//alert("ecriture dans le calque "+idCalque+content);
	if(document.all){
		document.all[idCalque].innerHTML=content;
	}
	else if(document.getElementById){
		document.getElementById(idCalque).innerHTML=content;
	}
	else if(document.layers){
		document.layers[idCalque].document.open();
		document.layers[idCalque].document.write(content);
		document.layers[idCalque].document.close();
	}
}

function flash_dessus(){
	calqueStyle=findDOM('divflash',1);
	calqueStyle.zIndex="4";
}

function flash_dessous(){
	calqueStyle=findDOM('divflash',1);
	calqueStyle.zIndex="2";
}

function inscript(email){
	if(v_html() || (!v_html() && plateforme()=="Macintosh")) {
		window.open('../php/inscriptNews.php?adresse='+email,'Inscription à la newsletter - confirmation','location=no, width=400, height=300');
		return false;
	}
	else {
		xhr_object=getHTTPObject();
		xhr_object.open("POST", "../php/inscriptNews.php?adresse="+email, true); 
		xhr_object.onreadystatechange = function() { 
			if(xhr_object.readyState == 4) { 
				window.document.anim.SetVariable('newsletter.msg_newsletter',xhr_object.responseText);
			}
		}
		xhr_object.send(null);
	}
	return false;
}