/*************************************
		fonctions de base
	 								*/
function afmod_getEltById(id,doc) {
	if (doc==null) doc=document;
	if(doc.getElementById)
		return doc.getElementById(id);
	else if (doc.all)
			return doc.all[id];
		else if (doc.layers)
				return doc.layers[id];
			else return null;
}
function afmod_showHide(obj,show) {
	obj.style.display=show ? "block" : "none";
}


/*************************************
		fonctions menus
	 								*/
var afmod_showMenuTimeout, afmod_showMenuObj;
function afmod_showMenu(id,delay) {
	if (afmod_showMenuTimeout) window.clearTimeout(afmod_showMenuTimeout);
	if (id!='') {
		if (afmod_showMenuObj==null || afmod_showMenuObj.id != id) {
			afmod_hideAllOverlay();
			afmod_showMenuObj = afmod_getEltById(id);
			try { afmod_showMenuObj.filters[0].Apply(); } catch(e) {}
			afmod_showMenuObj.style.visibility='visible';
			try { afmod_showMenuObj.filters[0].Play(); } catch(e) {}
		}
		afmod_showMenuTimeout = window.setTimeout("afmod_hideMenu(false)",5000);
	} else if (delay) {
		afmod_showMenuTimeout = window.setTimeout("afmod_hideMenu(false)",500);
	} else if (afmod_showMenuObj) {
		try { afmod_showMenuObj.filters[0].Apply(); } catch(e) {}
		afmod_showMenuObj.style.visibility='hidden';
		try { afmod_showMenuObj.filters[0].Play(); } catch(e) {}
		afmod_showMenuObj = null;
	}
}
function afmod_hideMenu(delay) {
	if (typeof(delay)=="undefined") delay=false;
	if (afmod_showMenuObj) afmod_showMenu('',delay);
}

/*************************************
		fonctions PostIt
	 								*/
var afmod_showPostItTimeout, afmod_showPostItObj;
function afmod_showPostIt(innerHTML,MaxShow,id,background,border) {
	if (afmod_showPostItTimeout) window.clearTimeout(afmod_showPostItTimeout);
	if (typeof(id) == "undefined") id="afmod_globalPostIt";

	if (id!='') {
		afmod_hidePostIt(); // afmod_hideAllOverlay();
		afmod_showPostItObj = afmod_getEltById(id);
		if (afmod_showPostItObj) {
			var content = afmod_getEltById(id+'Content');
			var cadre = afmod_getEltById(id+'Cadre');
			cadre.style.background= (typeof(background) != "undefined") ? background : '#FFFFE0';
			cadre.style.border= (typeof(border) != "undefined") ? border : '1px solid #FFFFA0';

			try { afmod_showPostItObj.filters[0].Apply(); } catch(e) {}
			if (innerHTML) content.innerHTML='';
			afmod_showPostItObj.style.visibility='visible';
			if (innerHTML) content.innerHTML=innerHTML;
			try { afmod_showPostItObj.filters[0].Play(); } catch(e) {}

			afmod_showPostItTimeout = window.setTimeout("afmod_hidePostIt()",MaxShow);
		}
	} else if (afmod_showPostItObj) {
		try { afmod_showPostItObj.filters[0].Apply(); } catch(e) {}
		afmod_showPostItObj.style.visibility='hidden';
		try { afmod_showPostItObj.filters[0].Play(); } catch(e) {}
		afmod_showPostItObj = null;
	}
}
function afmod_hidePostIt() {
	if (afmod_showPostItObj) afmod_showPostIt('',0,'');
}

function afmod_hideAllOverlay() {
	afmod_hidePostIt();
	afmod_hideMenu();
	if (typeof(afmod_hideOptionsHard) != "undefined") afmod_hideOptionsHard();
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
}


/*************************************
		fonctions affichage d'une layer d'attente pour upload d'image
	 								*/
var afmod_WaitUploadFg; var afmod_WaitUploadBg;
function afmod_WaitUpload(msg) {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	try {
		if (!afmod_WaitUploadFg) {
			afmod_WaitUploadFg=document.createElement("DIV");
			afmod_WaitUploadFg.className = 'afmod_WaitUpload';
			document.body.insertBefore(afmod_WaitUploadFg,document.body.firstChild);
		}
		afmod_WaitUploadFg.style.visibility = 'visible';
		afmod_WaitUploadFg.innerHTML='<table align=center cellpadding=0 cellspacing=0 border=0 class="afmod_WaitUpload"><tr><td width=300>&nbsp;</td><td class="afmod_WaitUpload"><br>'+msg+'<br><br><img src=/world/communaute/album/im/uploadtimer.gif border=0 /><br><br></td><td width=350>&nbsp;</td></tr></table>';
		if (!afmod_WaitUploadBg) {
			afmod_WaitUploadBg=document.createElement("DIV");
			afmod_WaitUploadBg.innerHTML='&nbsp;';
			afmod_WaitUploadBg.className = 'afmod_WaitUploadBg';
			document.body.insertBefore(afmod_WaitUploadBg,document.body.firstChild);
		}
		afmod_WaitUploadBg.style.height=document.body.scrollHeight+"px";
		afmod_WaitUploadBg.style.visibility = 'visible';
		window.scrollTo(0,0);
	} catch (e) {}
	document.afmod_avoidStopEdit=true;
}
function afmod_WaitUploadHide() {
	try {
		if (afmod_WaitUploadFg) afmod_WaitUploadFg.style.visibility = 'hidden';
		if (afmod_WaitUploadBg) afmod_WaitUploadBg.style.visibility = 'hidden';
	} catch (e) {}
	document.afmod_avoidStopEdit=false;
}

/*************************************
		fonctions d'affichage en couleur des pubs ggle
	 								*/
function afmod_toHex(N) {
 if (N==null) return "00";
 N=parseInt(N); if (N==0 || isNaN(N)) return "00";
 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
 return "0123456789ABCDEF".charAt((N-N%16)/16)
      + "0123456789ABCDEF".charAt(N%16);
}
function afmod_getGgleColor(p) {
	var obj, keyie, keyns, color;
	p=p.toLowerCase();
	if (p=='fg' || p=='texte') { obj=afmod_getEltById('afmod_GgleColorTexte'); keyie='color'; keyns='color'; }
	if (p=='titre') { obj=afmod_getEltById('afmod_GgleColorTitre'); keyie='color'; keyns='color'; }
	if (p=='site') { obj=afmod_getEltById('afmod_GgleColorSite'); keyie='color'; keyns='color'; }
	if (p=='bg') { obj=afmod_getEltById('afmod_GgleColorBg'); keyie='backgroundColor'; keyns='background-color'; }
	if (obj.currentStyle) {
		color=obj.currentStyle[keyie];
	} else if (window.getComputedStyle){
		var objstyle=window.getComputedStyle(obj, '');
		color=objstyle.getPropertyValue(keyns);
	}
	if (color=="white") color="FFFFFF";
	if (color.indexOf("#")>=0) color=color.replace(/#/gi,'');
	if (color.indexOf("rgb")>=0) {
		color=color.replace(/[rgb\(\)\s]/gi,'');
		var c=color.split(",");
		color=afmod_toHex(c[0])+afmod_toHex(c[1])+afmod_toHex(c[2]);
	}
	return color;
}

/*************************************
			fonctions diverses
	 								*/
/*------------ORIGINAL
function afmod_popupImage(src,titre,w,h) {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	popupContent='<div align="center"><br><table cellpadding=0 cellspacing=0><tr><td class="afmod_photo">';
	popupContent+='<img src="' + src + '" width="'+w+'" height="'+h+'" border=0 />';
	popupContent+='</td></tr></table><br></div>';
	afmod_popupWindow(titre,popupContent,w,h+30);
}
*/
/*-------------ISJ------------------*/
function afmod_popupImage(src,titre,w,h) {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	popupContent='<div align="center"><br><table cellpadding=0 cellspacing=0><tr><td class="afmod_photo">';
	popupContent+='<script type="text/javascript">AC_FL_RunContent( "codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width","'+w+'","height","'+h+'","src","'+src+'","quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","movie","'+src+'" ); </script>';
	popupContent+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="'+w+'" height="'+h+'">'+
'<param name=movie value="'+src+'" >'+
'<param name=quality value=high>'+
'<embed src="'+src+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>';
	popupContent+='</td></tr></table><br></div>';
	afmod_popupWindow(titre,popupContent,w,h+30);
}
function afmod_popupImageTexto(src,titre,w,h) {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	popupContent='<div align="center"><br><table cellpadding=0 cellspacing=0 width="'+w+'" height="'+h+'"><tr><td class="afmod_photo"><div class="Texto" align="center">';
	popupContent+=src;
	popupContent+='</div></td></tr></table><br></div>';
	afmod_popupWindow2(titre,popupContent,w,h+30);
}

var afmod_popupBg;
function afmod_popupWindow(popupTitle, popupContent,w,h) {
	if (!afmod_popupBg) {
		afmod_popupBg=document.createElement("DIV");
		afmod_popupBg.innerHTML='&nbsp;';
		afmod_popupBg.className = 'afmod_popupBg';
		document.body.insertBefore(afmod_popupBg,document.body.firstChild);
		afmod_popupBg.onclick=afmod_popupHide;
	}
	var thePopup=afmod_getEltById("afmod_popup");
	w+=40; h+=40;
	thePopup.style.width=w+"px";
	afmod_getEltById("afmod_popupTitle").innerHTML=popupTitle;
	afmod_getEltById("afmod_popupContent").innerHTML=popupContent;

	winwidth = window.innerWidth ? window.innerWidth : document.body.clientWidth;
	winheight = window.innerHeight ? window.innerHeight : document.body.clientHeight;

	afmod_popupBg.style.height=document.body.scrollHeight+"px";
	thePopup.style.left=((winwidth - w)/2 + document.body.scrollLeft) + "px";
	thePopup.style.top=((winheight - h)/2 + document.body.scrollTop) + "px";
	afmod_showHide(thePopup,true);
	afmod_popupBg.style.visibility='visible';
}
function afmod_popupWindow2(popupTitle, popupContent,w,h) {
	if (!afmod_popupBg) {
		afmod_popupBg=document.createElement("DIV");
		afmod_popupBg.innerHTML='&nbsp;';
		afmod_popupBg.className = 'afmod_popupBg';
		document.body.insertBefore(afmod_popupBg,document.body.firstChild);
		afmod_popupBg.onclick=afmod_popupHide2;
	}
	var thePopup=afmod_getEltById("afmod_popup");
	w+=40; h+=40;
	thePopup.style.width=w+"px";
	afmod_getEltById("afmod_popupTitle").innerHTML=popupTitle;
	afmod_getEltById("afmod_popupContent").innerHTML=popupContent;

	winwidth = window.innerWidth ? window.innerWidth : document.body.clientWidth;
	winheight = window.innerHeight ? window.innerHeight : document.body.clientHeight;

	afmod_popupBg.style.height=document.body.scrollHeight+"px";
	thePopup.style.left=((winwidth - w)/2 + document.body.scrollLeft) + "px";
	thePopup.style.top=((winheight - h)/2 + document.body.scrollTop) + "px";
	afmod_showHide(thePopup,true);
	afmod_popupBg.style.visibility='visible';
}

function afmod_popupHide() {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	if (afmod_popupBg) afmod_popupBg.style.visibility='hidden';
	afmod_showHide(afmod_getEltById("afmod_popup"),false);
	document.getElementById('id_header').style.visibility='visible';
}
function afmod_popupHide2() {
	if (typeof(afvid_stopVideo)!="undefined") afvid_stopVideo();
	if (afmod_popupBg) afmod_popupBg.style.visibility='hidden';
	afmod_showHide(afmod_getEltById("afmod_popup"),false);
	//document.getElementById('id_header').style.visibility='visible';
	window.location="novedades.php";
}
function llenarContenido(opcion){
	switch(opcion)	{
		case "showroom":
				//alert('todo bien');
				document.getElementById("pie_div").innerHTML="";	
		break;
		default:
				document.getElementById("pie_div").innerHTML="";
	}
}
function llamarDiv(){
	document.getElementById('id_header').style.visibility='hidden';
	afmod_popupImage('interaccion.swf','X', 900,500);
	llenarContenido('interaccion');

}
