/////////////////////////////////////////////// vr_fonction.js//// Fonctions permmettant de gerer l'affichage des VR et des infos associees.//// Affiche un calque contenant l'appel au VR//         un calque contenant certaines infos(image et texte) relatives au VR//		   un calque indiquant la position sur la tour du vr actif//// Utilise le tableau GEN_aVR de data_vr.js pour constuire l'objet VR/////////////////////////////////////////////// Declaration des variables globalesvar GEN_Separateur = '###';// Le tableau des layers a detuireGEN_aLayerToDestroy = new Array();// Le tableau des layers a detuire (info)GEN_aLayerInfoToDestroy = new Array();GEN_SpecialeMac = false;function MM_findObj(n, d) { //v4.0  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && document.getElementById) x=document.getElementById(n); return x;}function MM_showHideLayers() { //v3.0  var i,p,v,obj,args=MM_showHideLayers.arguments;  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }    obj.visibility=v; }}function MM_setTextOfLayer(objName,x,newText) { //v3.0	  if ((obj=MM_findObj(objName))!=null) with (obj)	      if (navigator.appName=='Netscape') {document.write(unescape(newText)); document.close();}	          else innerHTML = unescape(newText);	          }////////////////////////////////////////////// /// Fonction constructeur de l'Objet VR////// Objet representant les proprietes d'un VR//////////////////////////////////////////////function VR(iKey,strText,strTemplateVR,strPosTemplateVR,strTemplateInfoVR,strPosTemplateInfoVR,strTemplateHighLightVR,strPosHighLight,strTemplateInfoROVR,strTemplateZoomVR,strPosTemplateZoomVR){	// Proprietes 	this.iKey					= iKey;	this.strText				= strText;	this.strTemplateVR			= strTemplateVR;	this.strPosTemplateVR		= strPosTemplateVR;	this.strTemplateInfoVR		= strTemplateInfoVR;		this.strPosTemplateInfoVR	= strPosTemplateInfoVR;		this.strTemplateHighLightVR	= strTemplateHighLightVR;		this.strPosHighLight		= strPosHighLight;		this.strTemplateInfoROVR	= strTemplateInfoROVR;	this.strTemplateZoomVR		= strTemplateZoomVR;	this.strPosTemplateZoomVR   = strPosTemplateZoomVR;}////////////////////////////////////////////// /// Fonction ShowVR(iKey)/// Affiche les differents calques relatifs au VR////// Fonction ShowDefault(iKey)/// Affiche le calque d'aide////// Fonction ShowInfo(iKey)/// Affiche le calque d'info////// Fonction HideInfo()/// Masque les calques d'infos////// Fonction ShowZoom(iKey)/// Affiche le calque pour avoir la fenetre en plein ecran (quicktime)//////////////////////////////////////////////// Affiche le calque de zoomfunction ShowZoom(iKey){	// On recupere l'objet VR a partir de iKey		var oVR = GetObj(iKey,GEN_oVR);	if (oVR != -1)	{		// Les noms des differents calques		var strNameLayerZoomVR 	= 'ZoomVR'+iKey;				// Les positions des calques		var aPosTemplateZoomVR	= oVR.strPosTemplateZoomVR.split(GEN_Separateur);								oLayerZoomVR = MM_findObj(strNameLayerZoomVR);				if (!oLayerZoomVR)				{						// On cree le layer qui va contenir les infos du vr  					createLayer(strNameLayerZoomVR , null, aPosTemplateZoomVR[0], aPosTemplateZoomVR[1], aPosTemplateZoomVR[2],aPosTemplateZoomVR[3] , '', null, 'hidden','50');								// Expression regulieres					strCritereKey = /%CLE%/g;					var strContentLayerZoomVR = oVR.strTemplateZoomVR.replace(strCritereKey,iKey);								strContentLayerZoomVR = strContentLayerZoomVR.replace(strCritereText,oVR.strText);									// On cree l'objet qui gere ce layer					oLayerZoomVR = new DynLayer(strNameLayerZoomVR);					oLayerZoomVR.write(strContentLayerZoomVR);					oLayerZoomVR.show();				}				else				{					MM_showHideLayers(strNameLayerZoomVR,'','show');							}				GEN_aLayerToDestroy[GEN_aLayerToDestroy.length] = strNameLayerZoomVR;		}}// Efface tous les calques et affiche defaultfunction ShowDefault(){	for (var i=0;i<GEN_aLayerInfoToDestroy.length;i++)	{				//destroyLayer(GEN_aLayerToDestroy[i]);		MM_showHideLayers(GEN_aLayerInfoToDestroy[i],'','hide');	}	MM_showHideLayers('aide','','show');}// Efface tous les calques d'infos utilisés pour les rolloversfunction HideInfo(){	for (var i=0;i<GEN_aLayerInfoToDestroy.length;i++)	{				//destroyLayer(GEN_aLayerToDestroy[i]);		MM_showHideLayers(GEN_aLayerInfoToDestroy[i],'','hide');	}}// Affiche un calque d'infofunction ShowInfo(iKey){	MM_showHideLayers('aide','','hide')	// On recupere l'objet VR a partir de iKey		var oVR = GetObj(iKey,GEN_oVR);	if (oVR != -1)	{		// Les noms des differents calques		var strNameLayerInfoROVR 	= 'InfoROVR'+iKey;				// Les positions des calques		var aPosTemplateInfoROVR	= oVR.strPosTemplateInfoVR.split(GEN_Separateur);								oLayerInfoROVR = MM_findObj(strNameLayerInfoROVR);						if (!oLayerInfoROVR)				{						// On cree le layer qui va contenir les infos du vr  					createLayer(strNameLayerInfoROVR , null, aPosTemplateInfoROVR[0], aPosTemplateInfoROVR[1], aPosTemplateInfoROVR[2],aPosTemplateInfoROVR[3] , '', null, 'hidden','20');								// Expression regulieres					strCritereKey = /%CLE%/g;						strCritereText = /%TEXT%/g;						var strContentLayerInfoROVR = oVR.strTemplateInfoROVR.replace(strCritereKey,iKey);								strContentLayerInfoROVR = strContentLayerInfoROVR.replace(strCritereText,oVR.strText);									// On cree l'objet qui gere ce layer					oLayerInfoROVR = new DynLayer(strNameLayerInfoROVR);					oLayerInfoROVR.write(strContentLayerInfoROVR);					oLayerInfoROVR.show();				}				else				{					MM_showHideLayers(strNameLayerInfoROVR,'','show');							}				GEN_aLayerInfoToDestroy[GEN_aLayerInfoToDestroy.length] = strNameLayerInfoROVR;				}}// Affiche le calque contenant le VR, le calque d'info sans la vignette, et le calque de highlightfunction ShowVR(iKey){			MM_showHideLayers('default','','hide')	MM_showHideLayers('aide','','hide')	// On detruit les anciens layers	for (var i=0;i<GEN_aLayerToDestroy.length;i++)	{				MM_showHideLayers(GEN_aLayerToDestroy[i],'','hide');	}	GEN_aLayerToDestroy.length = 0;		// On recupere l'objet VR a partir de iKey		var oVR = GetObj(iKey,GEN_oVR);	if (oVR != -1)	{		// Les noms des differents calques		var strNameLayerVR 		= 'VR'+iKey;		var strNameLayerInfoVR 	= 'InfoVR'+iKey;		var strNameLayerHighLightVR 	= 'HighLight'+iKey;				// Les positions des calques		var aPosTemplateVR 		= oVR.strPosTemplateVR.split(GEN_Separateur);		var aPosTemplateInfoVR	= oVR.strPosTemplateInfoVR.split(GEN_Separateur);		var aPosTemplateHighLightVR	= oVR.strPosHighLight.split(GEN_Separateur);								oLayerInfoVR = MM_findObj(strNameLayerInfoVR);		oLayerVR = MM_findObj(strNameLayerVR);		oLayerHighLightVR = MM_findObj(strNameLayerHighLightVR);//alert(strNameLayerInfoVR + " : " + oLayerInfoVR);		if (!oLayerInfoVR)		{							// On cree le layer qui va contenir les infos du vr  			createLayer(strNameLayerInfoVR , null, aPosTemplateInfoVR[0], aPosTemplateInfoVR[1], aPosTemplateInfoVR[2],aPosTemplateInfoVR[3] , '', null, 'hidden','1');						// Exprression regulieres			strCritereKey = /%CLE%/g;				strCritereText = /%TEXT%/g;				var strContentLayerInfoVR = oVR.strTemplateInfoVR.replace(strCritereKey,iKey);						strContentLayerInfoVR = strContentLayerInfoVR.replace(strCritereText,oVR.strText);					// On cree l'objet qui gere ce layer			oLayerInfoVR = new DynLayer(strNameLayerInfoVR);						oLayerInfoVR.write(strContentLayerInfoVR);			oLayerInfoVR.show();//alert('strContentLayerInfoVR : ' + strContentLayerInfoVR);						//MM_setTextOfLayer(strNameLayerInfoVR,null,strContentLayerInfoVR);					//MM_showHideLayers(strNameLayerInfoVR,'','show');		}		else		{//alert("else");						MM_showHideLayers(strNameLayerInfoVR,'','show');					}							if (is.platform == 'mac' && GEN_SpecialeMac)			{						//MM_setTextOfLayer(strNameLayerVR,null,strContentLayerVR)						//MM_showHideLayers(strNameLayerVR,'','show');			//alert(strContentLayerVR);			}		else		{											if (!oLayerVR)			{				// On cree le layer qui va contenir le vr  				createLayer(strNameLayerVR , null, aPosTemplateVR[0], aPosTemplateVR[1], aPosTemplateVR[2],aPosTemplateVR[3] , '', null, 'hidden');					// Exprression regulieres				strCritereKey = /%CLE%/g;					var strContentLayerVR = oVR.strTemplateVR.replace(strCritereKey,iKey);								// On cree l'objet qui gere ce layer				oLayerVR = new DynLayer(strNameLayerVR);					oLayerVR.write(strContentLayerVR);				oLayerVR.show();					//MM_setTextOfLayer(strNameLayerVR,null,strContentLayerVR);						//MM_showHideLayers(strNameLayerVR,'','show');			}								else			{				MM_showHideLayers(strNameLayerVR,'','show');						}		}					if (!oLayerHighLightVR)		{					// On cree le layer qui va contenir le vr  			createLayer(strNameLayerHighLightVR , null, aPosTemplateHighLightVR[0], aPosTemplateHighLightVR[1], aPosTemplateHighLightVR[2],aPosTemplateHighLightVR[3] , '', null, 'hidden');					// Expression regulieres			strCritereKey = /%LAYERCLE%/g;			strCritereLeft = /%LEFT%/g;			strCritereTop = /%TOP%/g;			var strContentLayerHighLightVR = oVR.strTemplateHighLightVR.replace(strCritereKey,'high'+iKey);			strContentLayerHighLightVR = strContentLayerHighLightVR.replace(strCritereLeft,oVR.iLeftHighLight);				strContentLayerHighLightVR = strContentLayerHighLightVR.replace(strCritereTop,oVR.iTopHighLight);								// On cree l'objet qui gere ce layer			oLayerHighLightVR = new DynLayer(strNameLayerHighLightVR);						oLayerHighLightVR.write(strContentLayerHighLightVR);			oLayerHighLightVR.show();						//MM_setTextOfLayer(strNameLayerHighLightVR,null,strContentLayerHighLightVR);					//MM_showHideLayers(strNameLayerHighLightVR,'','show');		}		else		{			MM_showHideLayers(strNameLayerHighLightVR,'','show');					}			// On met ces layers dans le tableau des layers a detruire		GEN_aLayerToDestroy[GEN_aLayerToDestroy.length] = strNameLayerVR;			GEN_aLayerToDestroy[GEN_aLayerToDestroy.length] = strNameLayerInfoVR;		GEN_aLayerToDestroy[GEN_aLayerToDestroy.length] = strNameLayerHighLightVR;					}}////////////////////////////////////////////////////// Fonction GetObj(iKey,aObj)  // // ///////////////////////////////////////////    function GetObj(iKey,aObj)  {			for (var i=0;i<aObj.length;i++)	{				if ( aObj[i].iKey == iKey )		{			return aObj[i];		}	}	return -1;} ////////////////////////////////////////////////////// Fonction Init()  // // Cree le tableau d'objet VR a partir du tableau GEN_aVR defini dans data_vr.js///////////////////////////////////////////// function Init(){	// Pour chaque element du tableau GEN_aVR	// On cree un nouvel objet VR	for (var i=0;i<GEN_aVR.length;i=i+11)	{		GEN_oVR[GEN_oVR.length] = new VR(GEN_aVR[i],GEN_aVR[i+1],GEN_aVR[i+2],GEN_aVR[i+3],GEN_aVR[i+4],GEN_aVR[i+5],GEN_aVR[i+6],GEN_aVR[i+7],GEN_aVR[i+8],GEN_aVR[i+9],GEN_aVR[i+10]);	}}Init();function Init_Layer(strTemplate,iCle,PosLayer){	var aPosLayer 		= PosLayer.split(GEN_Separateur);		strCritereKey = /%CLE%/g;	var strTemplateNew = strTemplate.replace(strCritereKey,iCle);	strTemplateNew = '<div id="VR'+iCle+'" style="position:absolute; left:'+aPosLayer[0]+'px; top:'+aPosLayer[1]+'px; width:'+aPosLayer[2]+'px; height:'+aPosLayer[3]+'px; z-index:40; visibility: hidden">' + strTemplateNew;	strTemplateNew += '</div>';					document.write(strTemplateNew);	var NameLayer = 'VR'+iCle;	MM_showHideLayers(NameLayer,'','show');		}