// Popup Art
function getBodyHeight(){
  // FF
  var height = document.documentElement.scrollHeight;

  // IE 7/8 + Opera
  if(document.documentElement.clientHeight > height ) {
    height  = document.documentElement.clientHeight;
  }
  // Safari
  if(document.body.scrollHeight > height) {
    height = document.body.scrollHeight;
  }
  return height;
}
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;
}
function setPopSalon(){
	if(document.getElementById){
		var bodyHeight = getBodyHeight();
		var windowHeight = getWindowHeight();
		document.getElementById('divSalon').style.height = bodyHeight+'px';
		document.getElementById('divContPop').style.height = windowHeight+'px';
	}
}
function fermePopSalon(){
		document.getElementById('divSalon').style.display = 'none';
}

// PNG transparent sous internet Explorer
function IE_CorrectAlpha_PNG(){ 
	for(i=0; i<document.images.length; i++){ 
		img    = document.images[i]; 
		imgExt  = img.src.substring(img.src.length-3, img.src.length); 
		imgExt  = imgExt.toUpperCase(); 
		if (imgExt == "PNG"){ 
			imgID    = (img.id) ? "id='" + img.id + "' " : ""; 
			imgClass= (img.className) ? "class='" + img.className + "' " : ""; 
			imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
			imgStyle= "display:inline-block;" + img.style.cssText; 
			if (img.align == "left") { 
				imgStyle = "float:left;"  + imgStyle;
			}else if (img.align == "right"){
				imgStyle = "float:right;" + imgStyle;
			} 
			if (img.parentElement.href){ 
				imgStyle = "cursor:hand;" + imgStyle;
			}        
			strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>'; 
			img.outerHTML = strNewHTML; 
			i = i-1; 
		}
	}
} 
//window.attachEvent("onload", IE_CorrectAlpha_PNG);

function encodeMailto(a,b){
	var tg="<";
	var name=a;
	var at="@";
	var host=b;
	var text="Email direct Art&eacute;&iuml;s";
	document.write(tg+"a hr"+"ef=mai"+"lto:"+name);
	document.write(at+host+" class=\"lien5\">"+text+tg+"/a>");
}
function encodeMailtoImg(a,b,c){
	var img=c;
	var tg="<";
	var name=a;
	var at="@";
	var host=b;
	var text="Email direct Art&eacute;&iuml;s";
	document.write(tg+"a hr"+"ef=mai"+"lto:"+name);
	document.write(at+host+" class=\"lien5\">"+img+tg+"/a>");
}
/*///////////////////////////////////////////////////////////////////////////////////
// Protection mailto
///////////////////////////////////////////////////////////////////////////////////*/
function encodeMailto2(leNom, leDomaine, laClasse, laPhrase){
	var tg = "<";
	var name = leNom;
	var at = "@";
	var host = leDomaine;
	var text = laPhrase;
	
	document.write(tg+"a hr"+"ef=mai"+"lto:"+name);
	document.write(at+host+" class='"+laClasse+"'>"+text+tg+"/a>");
}
function PopupVideo() {
	titre="Visiter un magasin Arteis";
	var top=(screen.height-300)/2;
	var left=(screen.width-470)/2;
	w=open("popup-video.php","Magasin","top="+top+",left="+left+",width=470,height=300,toolbar=no,scrollbars=no,resizable=no,");
	w.document.close();
}

function afficheCache(qui,combien) {
	for(i = 1; i<= combien; i++ ){
		if (qui=="atelierPassDetail"+i){
			document.getElementById("atelierPassDetail"+i).style.display="block";
		}else{
			document.getElementById("atelierPassDetail"+i).style.display="none";
		}
	}
}

function afficheCacheCommentaires(){
	document.getElementById("lesCommentaires").style.display="block";
}

//////////////////////////////////////////////////////////////////////////////////////////////
// PAGE DETAIL ATELIER
// Afficher le bloc du listing des commentaires d'une session
function afficherCommentaires(id_ses){
	commentaire = "lesCommentaires"+id_ses;
	btn = "caseDeployer"+id_ses;
	document.getElementById(commentaire).style.display="block";
	document.getElementById(btn).innerHTML="<a href=\"javascript:void(0);\" onclick=\"cacherCommentaires('"+id_ses+"'); return false;\"><img src=\"images/interface/vos-questions-et-commentaires-moins.jpg\" alt=\"Vos questions et commentaires\" border=\"0\" /></a>";
}
// Cacher le bloc du listing des commentaires d'une session
function cacherCommentaires(id_ses){
	commentaire = "lesCommentaires"+id_ses;
	btn = "caseDeployer"+id_ses;
	document.getElementById(commentaire).style.display="none";
	document.getElementById(btn).innerHTML="<a href=\"javascript:void(0);\" onclick=\"afficherCommentaires('"+id_ses+"'); return false;\"><img src=\"images/interface/vos-questions-et-commentaires.jpg\" alt=\"Vos questions et commentaires\" border=\"0\" /></a>";
}
// Afficher le bloc du listing des commentaires d'une session
function afficherDepotCommentaire(id_ses){
	lib = "poserCommentaire"+id_ses;
	document.getElementById(lib).style.display="block";
}
// Afficher le bloc du listing des commentaires d'une session passes
function afficherCommentairesPasses(id_ses){
	commentaire = "lesCommentaires"+id_ses;
	document.getElementById(commentaire).style.display="block";
}

//////////////////////////////////////////////////////////////////////////////////////////////
// PROMOS ARTEIS
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
document.write('<div id=description style="visibility:hidden;position:absolute;border:1 solid #000000"></div>');
function montre(id) {
	elt="curseur_" + id;
	txt="texte_" + id;
	texte = document.getElementById(txt).innerHTML;
	if (ns4) {var mouseX=e.pageX-100; var mouseY=e.pageY}
	if (ie4) {var mouseX=event.x-100; var mouseY=event.y + document.body.scrollTop}
	if(document.getElementById) {
		document.getElementById(elt).innerHTML = '<table width="100%"><tr><td class="casePromo">' + texte + '</td></tr></table>';
		document.getElementById(elt).style.visibility = 'visible';
		document.getElementById(elt).style.left = mouseX;
		document.getElementById(elt).style.top = mouseY + 10;
	} 
}
function cache(id) {
	elt="curseur_" + id;
	if(document.getElementById) {
		document.getElementById(elt).style.visibility = 'hidden' 
	}
}