var NS4 = (document.layers)? true:false
var IE4 = (document.all)? true:false
var VER4 = (IE4 || NS4) ? 1 : 0;
var tvPosX=0;
var tvPosY=0;
var tvXoffset=10;
var tvYoffset=10;

function fOpenZoom(pLocation, pType, pSessionID, pTotRow, pRequestId, pMultiPage)
{
	var	lvNavigator=navigator.userAgent.toLowerCase();
	var	lvMac=(lvNavigator.indexOf("mac") != -1);
	var	lvSize = "width=300,height=300";
	var	lvPageName = '';
	
	if (lvMac)
	{
		lvMenuBar=1;
	}
	else
	{
		lvMenuBar=0;
	}
	if ((pType==2)||(pType==3))
		lvSize = "width=600,height=500";
	
	if (pMultiPage==0)
		lvPageName = 'ZOOM';
	else
		lvPageName = 'ZOOM_'+pLocation;
	window.open('zoom.pgi?UNID='+pSessionID+'&OBJET='+pLocation+'&TY='+pType+'&TR='+pTotRow+'&RI='+pRequestId,lvPageName,"top=10,left=10,"+lvSize+",menubar="+lvMenuBar+",resizable=1,status=0,scrollbars=1");
}

function fNavigueZoom(pLocation)
{
	var lvDestFrame = top.document;
	lvDestFrame.location.href = pLocation + '&currentskin='+ lvDefaultSkin;
}


function fRedisplay(pSessionID, pCurrentID, pDisplayMode)
{
	var lvDestFrame = top.principal.document;

	lvDestFrame.location="requete.pgi?UNID="+pSessionID+"&AC=Refresh&RI=Get&CR="+pCurrentID+"&DM="+pDisplayMode;
}

function fMailDownload(pLocation)
{
	lvDestFrame = top.document;

	lvDestFrame.location.href = pLocation;
}

function fDetailDownload(pLocation)
{
	lvDestFrame = top.document;

	lvDestFrame.location.href = pLocation;
}

function fOpenURL(pLocation)
{
	var lvDestFrame = top.principal;
  	var text = new String(pLocation);
	var lvDM=0;
	var lvDate = new Date;
	var lvSubPath = '';

	if ((text.indexOf("requete.pgi",0) == 0) || (text.indexOf("photoslist.pgi",0) == 0))
	{
		lvDM = 5;
		if ((text.indexOf("photoslist.pgi",0) == 0) && (lvDM<4))
		{
			lvDestFrame.location.href = lvSubPath+'docslist.pgi'+pLocation.substring(14);
		}
		else
		{
			lvDestFrame.location.href = lvSubPath+pLocation;
		}
	}
	else if(text.indexOf("viewliasse.pgi",0) == 0)
	{
		lvDestFrame.location.href = lvSubPath+pLocation;
	}
	else
	{
		if(text.indexOf("treelist.pgi",0) == 0)
		{
			lvDestFrame = top.treelist;
			if (text.indexOf("?",0) > 0)
				pLocation = lvSubPath+pLocation + "&DT="+lvDate.getTime();
			else
				pLocation = lvSubPath+pLocation + "?DT="+lvDate.getTime();
	
			lvDestFrame.location.replace(pLocation);
		}
		else
		{
			if (text.indexOf("?",0) > 0)
				pLocation = lvSubPath+pLocation + "&DT="+lvDate.getTime();
			else
				pLocation = lvSubPath+pLocation + "?DT="+lvDate.getTime();
	
			lvDestFrame.location.href = pLocation;
		}
	}	
}

function fActionBasket(pIdObjet,pAction,pSessionID)
{
	var lvURL;
	var lvDate = new Date;
	lvURL = "portfolio.pgi?UNID="+pSessionID+"&Objet="+pIdObjet+"&AC="+pAction+"&DT="+lvDate.getTime();
	
	fChangeLeftView(lvURL);
}

function fChangeLeftView(pLocation) 
{
	var lvDestFrame = '';

	if ((self.name!='principal') && (self.name!='MailList'))
	{
		if (self.name!='treelist')
			lvDestFrame = window.opener.parent.treelist.document; 
		else
			lvDestFrame = top.treelist.document;
	}
	else
		lvDestFrame = top.treelist.document; 

        var lvDate = new Date;

	if (pLocation.length>0)
	{	
		
		if (pLocation.indexOf("?",0) > 0)
			pLocation = pLocation+"&DT="+lvDate.getTime();
		else
			pLocation = pLocation+"?DT="+lvDate.getTime();
		
		lvDestFrame.location = pLocation;
	}
}

function fCloseWindow(pLocation)
{
	RemoteWindow=window.open('','OWSZoom',"top=4000,left=0,width=10,height=10,resizable=0,status=0,scrollbars=0");
	RemoteWindow.close();
	top.location = pLocation;
}

function passMailtoRead(pIcon) 
{
   if (pIcon == 'help')
   {
         document.help.src =  "images/help.gif";
   }

}

function AffectValue()
{
	lvDM = 5;
	
}

function CheckDate(pDate)
{
	var lvCount;
	var lvNumber1, lvNumber2, lvNumber3;
	var lvValue1, lvValue2, lvValue3;
	var lvDate;
	
	if (pDate.length>0)
	{
		lvNumber1 = (pDate.substring(0,2));
		lvNumber2 = (pDate.substring(3,5));
		lvNumber3 = (pDate.substring(6,10));

		lvDate = new Date(lvNumber3,lvNumber2-1,lvNumber1);

		lvValue1 = lvDate.getDate();
		lvValue2 = lvDate.getMonth()+1;
		lvValue3 = lvDate.getFullYear();
		
		if ((lvNumber1 == lvValue1)&&(lvNumber2 == lvValue2)&&(lvNumber3 == lvValue3))
		{
			if((pDate.charAt(2)=="/")&&(pDate.charAt(5)=="/"))
			{
				return(true);
			}
		}
		else
		{
			return(false);
		}	
	}
	else
	{
		return(true);
	}
}

function CheckForm1(pForm, pLanguage)
{
	var lvSaisieOK = 1;
	var lvHasDate, lvValueDate = 0;
	var lvIdx, lvChecked=0,lvChoice=0,lvCountObj = 0;

	
	lvCountObj = pForm.elements.length;
	for(lvIdx=0; lvIdx<lvCountObj; lvIdx++)
	{
		if (pForm.elements[lvIdx].type=="date")
		{
			// Test du champ Date
			lvHasDate = 1;
			if (CheckDate(pForm.datestart.value) == 0)
			{
			  if (pLanguage==1) 
				  alert("La date de début de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Anfangsdatum der Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data di inizio non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha inicial no es válido. El formato de fecha es dd/mm/aaaa.");
				else
				  alert("The Start date value is not valid. The date format is dd/mm/yyyy.");
				pForm.datestart.focus();
				lvSaisieOK = 0;
			}
			if (CheckDate(pForm.dateend.value) == 0)
			{
			  if (pLanguage==1) 
				  alert("La date de fin de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Enddatum für die Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data finale non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha final no es válido. El formato de fecha es dd/mm/aaaa.");
				else
				  alert("The End date value is not valid. The date format is dd/mm/yyyy.");
				pForm.dateend.focus();
				lvSaisieOK = 0;
			}
		}
		else if (pForm.elements[lvIdx].type=="checkbox")
		{
			if ((pForm.elements[lvIdx].checked)&&(pForm.elements[lvIdx].name!='explain')&&(pForm.elements[lvIdx].name!='synonyms'))
			{
				lvChecked++;
			}
		}
	}
	if (lvSaisieOK == 1)
	{
		if (lvHasDate==1) 
		{
			if ((pForm.datestart.value=="")&&(pForm.dateend.value==""))
			{
				lvValueDate = 0;
			}
			else
			{
				lvValueDate = 1;
			}
		}
		if ((pForm.ValueWord.value=="")&&(lvChecked==0)&&(lvValueDate==0))
		{
		  if (pLanguage==1) 
			 alert("Vous devez renseigner au moins une valeur pour effectuer une recherche.");
			else if (pLanguage==3) 
			  alert("Sie müssen mindestens einen Wert angeben, um die Suche durchführen zu können.");
			else if (pLanguage==5) 
			  alert("Devi inserire almeno un valore per eseguire una ricerca.");
			else if (pLanguage==6) 
			  alert("Debe introducir al menos un valor para llevar a cabo la búsqueda.");
			else
			 alert("You must enter at least one value to perform a search.");
			pForm.ValueWord.focus();
			lvSaisieOK = 0;
		}
		else
		{
			lvSaisieOK = 1;
		}
	}

	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function CheckForm2(pForm, pLanguage)
{
	var lvSaisieOK = 1;
	var lvHasDate, lvValueDate = 0;
	var lvIdx, lvChecked=0,lvChoice=0,lvCountObj = 0;

	lvCountObj = pForm.elements.length;

	for(lvIdx=0; lvIdx<lvCountObj; lvIdx++)
	{
		if (pForm.elements[lvIdx].type=="date")
		{
			// Test du champ Date
			lvHasDate = 1;
			if (CheckDate(pForm.datestart.value) == 0)
			{
			 	if (pLanguage==1) 
				  alert("La date de début de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Anfangsdatum der Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data di inizio non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha inicial no es válido. El formato de fecha es dd/mm/aaaa.");
				else
				  alert("The Start date value is not valid. The date format is dd/mm/yyyy.");
				pForm.datestart.focus();
				lvSaisieOK = 0;
			}
			if (CheckDate(pForm.dateend.value) == 0)
			{
			  if (pLanguage==1) 
				  alert("La date de fin de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Enddatum für die Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data finale non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha final no es válido. El formato de fecha es dd/mm/aaaa.");
				else
				  alert("The End date value is not valid. The date format is dd/mm/yyyy.");
				pForm.dateend.focus();
				lvSaisieOK = 0;
			}	
		}
		else if (pForm.elements[lvIdx].type=="checkbox")
		{
			if (pForm.elements[lvIdx].checked)
			{
				lvChecked++;
			}
		}
		else
		{
			if ((pForm.elements[lvIdx].type=="select-one")&&(pForm.elements[lvIdx].name.substr(0,7) == 'KeyWord'))
			{
				var lvOperator = pForm.elements[lvIdx+1].options[pForm.elements[lvIdx+1].selectedIndex].value;
				if ((pForm.elements[lvIdx].selectedIndex>0)&&(lvOperator>=0)&&(pForm.elements[lvIdx+2].value.length>1))
				{
					lvChoice++;
				}
			}			
		}
	}

	if (lvSaisieOK == 1)
	{
		if (lvHasDate==1) 
		{
			if ((pForm.datestart.value=="")&&(pForm.dateend.value==""))
				lvValueDate = 0;
			else
				lvValueDate = 1;
		}
		if ((lvChecked==0)&&(lvChoice==0)&&(lvValueDate==0))
		{	
		  if (pLanguage==1) 
			 alert("Vous devez renseigner au moins une valeur pour effectuer une recherche.");
			else if (pLanguage==3) 
			  alert("Sie müssen mindestens einen Wert angeben, um die Suche durchführen zu können.");
			else if (pLanguage==5) 
			  alert("Devi inserire almeno un valore per eseguire una ricerca.");
			else if (pLanguage==6) 
			  alert("Debe introducir al menos un valor para llevar a cabo la búsqueda.");
			else
			 alert("You must enter at least one value to perform a search.");
			pForm.ValueWord1.focus();
			lvSaisieOK = 0;
		}
		else
		{
			lvSaisieOK = 1;
		}
	}

	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function CheckForm3(pForm, pLanguage)
{
	var lvSaisieOK = 1;
	var lvHasDate, lvValueDate = 0;
	var lvIdx, lvIdx2=0, lvChecked=0,lvChoice=0,lvCountObj = 0,lvCountOption=0;
	var lvSelection="";
	
	lvCountObj = pForm.elements.length;
	for(lvIdx=0; lvIdx<lvCountObj; lvIdx++)
	{
		if (pForm.elements[lvIdx].type=="date")
		{
			// Test du champ Date
			lvHasDate = 1;
			if (CheckDate(pForm.datestart.value) == 0)
			{
				if (pLanguage==1)
					alert("La date de début de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Anfangsdatum der Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data di inizio non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha inicial no es válido. El formato de fecha es dd/mm/aaaa.");
				else
					alert("The Start date value is not valid. The date format is dd/mm/yyyy.");
				pForm.datestart.focus();
				lvSaisieOK = 0;
			}
			if (CheckDate(pForm.dateend.value) == 0)
			{
				if (pLanguage==1)
					alert("La date de fin de recherche n'est pas valide. Le format est jj/mm/aaaa.");
				else if (pLanguage==3) 
				  alert("Das Enddatum für die Suche ist nicht gültig. Das Format lautet tt/mm/jjjj.");
				else if (pLanguage==5) 
				  alert("Il valore data finale non è valido. Il formato della data è gg/mm/aaaa.");
				else if (pLanguage==6) 
				  alert("El valor de fecha final no es válido. El formato de fecha es dd/mm/aaaa.");
				else
					alert("The End date value is not valid. The date format is dd/mm/yyyy.");
				pForm.dateend.focus();
				lvSaisieOK = 0;
			}	
		}
		else if (pForm.elements[lvIdx].type=="checkbox")
		{
			if ((pForm.elements[lvIdx].checked)&&(pForm.elements[lvIdx].name!='explain')&&(pForm.elements[lvIdx].name!='synonyms'))
			{
				lvChecked++;
			}
		}
		if (pForm.elements[lvIdx].type=="select-multiple")
		{		
			lvCountOption = pForm.elements[lvIdx].length;
			for(lvIdx2=0; lvIdx2<lvCountOption; lvIdx2++)
			{	
				
				if (pForm.elements[lvIdx].options[lvIdx2].selected)
				{
					if (pForm.elements[lvIdx].options[lvIdx2].value != 0)
					{
						if (lvSelection.length>0)
						{
							lvSelection = lvSelection+','+pForm.elements[lvIdx].options[lvIdx2].value;
						}
						else
						{
							lvSelection = pForm.elements[lvIdx].options[lvIdx2].value;
						}
					}
				}
			}
		}
	}
	
	if (lvSaisieOK == 1)
	{
		if (lvHasDate==1) 
		{
			if ((pForm.datestart.value=="")&&(pForm.dateend.value==""))
				lvValueDate = 0;
			else
				lvValueDate = 1;
		}
		if ((lvSelection=="")&&(lvValueDate==0)&&(lvChecked==0))
		{
			if (pLanguage==1)
				alert("Vous devez renseigner au moins une valeur pour effectuer une recherche.");
			else if (pLanguage==3) 
			  alert("Sie müssen mindestens einen Wert angeben, um die Suche durchführen zu können.");
			else if (pLanguage==5) 
			  alert("Devi inserire almeno un valore per eseguire una ricerca.");
			else if (pLanguage==6) 
			  alert("Debe introducir al menos un valor para llevar a cabo la búsqueda.");
			else
				alert("You must enter at least one value to perform a search.");
			lvSaisieOK = 0;
		}
		else
		{
			lvSaisieOK = 1;
		}
	}
	
	pForm.ivSelection.value = lvSelection;

	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function GetForm3(pForm, pLanguage)
{
	var lvSaisieOK = 1;
	// Test du champ de saisie
	
	if (pForm.ValueWord.value=="")
	{	
		if (pLanguage==1)
			alert("Vous devez renseigner une valeur pour effectuer un filtre sur les mots-clés.");
		else if (pLanguage==3) 
		  alert("Sie müssen einen Wert angeben, um für Ihre Schlüsselwörter einen Filter einzubauen.");
		else if (pLanguage==5) 
		  alert("Devi inserire un termine o la parte di un termine per eseguire un filtro con delle parole chiave.");
		else if (pLanguage==6) 
		  alert("Debe introducir un término o parte de un término para realizar un filtrado de palabras clave.");
		else
			alert("You must enter a term or a part of a term in order to filter on keywords.");
		pForm.ValueWord.focus();
		lvSaisieOK = 0;
	}
	else
	{
		lvSaisieOK = 1;
	}


	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function CheckStdForm(pForm)
{
	var lvSaisieOK = 1;

	if (pForm.userrequest.value=="")
	{	
		alert("Vous devez renseigner une valeur pour effectuer une recherche.");
		pForm.userrequest.focus();
		lvSaisieOK = 0;
	}
	else
	{
		lvSaisieOK = 1;
	}

	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function CheckOrder(pForm, pLanguage)
{
	var lvSaisieOK = 1;
	
	lvCountObj = pForm.elements.length;
	for(lvIdx=0; lvIdx<lvCountObj; lvIdx++)
	{
		if ((pForm.elements[lvIdx].type=="checkbox") && (pForm.elements[lvIdx].checked==false))
		{	
			if (pForm.elements[lvIdx].name=="agree")
			{
				if (pLanguage==1)
					alert("Pour poursuivre, vous devez accepter nos conditions générales de cession et de vente.");
				else if (pLanguage==3) 
				  alert("Um weiterzuverfahren, müssen Sie erst die allgemeinen Geschäftsbedingungen akzeptieren.");
				else if (pLanguage==5) 
				  alert("Per ordinare devi accettare i nostri termini e le nostre condizioni.");
				else if (pLanguage==6) 
				  alert("Para realizar un pedido, debe aceptar nuestros términos y condiciones.");
				else
					alert("To order, you must accept our terms and conditions.");
				lvSaisieOK = 0;
			}
			else if((pForm.elements[lvIdx].name!="agree") && (pForm.elements[lvIdx].name.indexOf('ischeckeditem_',0) < 0))
			{
				if (pLanguage==1)
					alert("Pour poursuivre, vous devez valider votre commande.");
				else
					alert("To continue, you must confirm your order.");
				lvSaisieOK = 0;
			}
		}
	}
	

	if (lvSaisieOK == 0)
	{
		return(false);
	}
	else
	{
		return(true);
	}
}

function fPlayVideo(pName)
{
	var lvPosition=0;
	
	document.RPlayer.DoStop();
	document.RPlayer.SetSource(pName);
	document.RPlayer.DoPlayPause();
	document.RPlayer.SetSource(pName);
	document.RPlayer.DoPlayPause();
}

function popupWindow(pFile,width,height) 
{
	var w = width;
	var h = height;
	scrl='no';
	window.open(pFile,"popup","titlebar=no,menubar=no,toolbar=no,location=no,scrollbars=0,resizable=1,status=no,directories=no,copyhistory=no,hotkeys=no,width="+w+",height="+h);
}

function fOpenVideo(pLocation, pSessionID)
{
	var lvNavigator=navigator.userAgent.toLowerCase();
	var lvMac=(lvNavigator.indexOf("mac") != -1);
	if (lvMac)
	{
		lvMenuBar=1;
	}
	else
	{
		lvMenuBar=0;
	}
	window.open('video.pgi?UNID='+pSessionID+'&OBJET='+pLocation,"popup","top=10,left=10,width=300,height=300,menubar="+lvMenuBar+",resizable=1,status=0,scrollbars=1");
}

function fOpenWindow(pLocation)
{
	var lvNavigator=navigator.userAgent.toLowerCase();
	var lvMac=(lvNavigator.indexOf("mac") != -1);
	if (lvMac)
	{
		lvMenuBar=1;
	}
	else
	{
		lvMenuBar=0;
	}
	window.open(pLocation,"popup","top=10,left=10,width=400,height=400,menubar="+lvMenuBar+",resizable=1,status=0,scrollbars=1");
}

function fConfirm()
{
	var name = confirm("Confirmation?");
	
	return name;	
}

function fShowTips(pTitle,pText,pWidth, pPaththu, pBorderColor1, pBorderColor2) 
{
	var lvThumbnail='';
	var lvWinWidth=0;
	var lvFinalPosX=tvPosX-tvXoffset;
	
	if (fShowTips.arguments.length>=4)
	{
		if (pPaththu.length>0)
		{
			lvThumbnail='      <td CLASS="generictipsbody">\n' +
			'<img src="'+pPaththu+'" border="0" align="middle">\n' +
			'      </td>\n';
		}
	}
	
	if (pText.length>0)
	{
		lvTextDisplay = '      <td CLASS="generictipsbody" valign="top" width="100%">\n' + pText+'\n' +	' </td>\n';
	}
	else
		lvTextDisplay = '';

	if (lvThumbnail.length>0)
	{
		lvTextDisplay = '';
	}
		
	if (pBorderColor1==null)
		pBorderColor1 = "#000000";
	if (pBorderColor2==null)
		pBorderColor2 = "#000000";

	var lvText = '  <table border="1" bordercolor="'+pBorderColor1+'" bordercolorlight="'+pBorderColor1+'" bordercolordark="'+pBorderColor2+'" cellpadding="2" cellspacing="0" width="'+pWidth+'">';
	
	if (pTitle.length>0) 
	{	
		lvText = lvText + '    <tr>\n' +
				'      <td colspan="2" CLASS="generictipsheader">\n' +
				pTitle+'\n' +
				'      </td>\n' +
				'    </tr>\n';
	}	
	lvText = lvText + lvThumbnail +
	lvTextDisplay+
	'    </tr>\n' +
	'  </table>\n';

	if (lvFinalPosX<0) 
		lvFinalPosX=0;
		
	if (document.layers) 
	{
		lvWinWidth = window.innerWidth;
		
		if (lvWinWidth<lvFinalPosX+pWidth)
			lvFinalPosX = lvWinWidth - pWidth - 20;
		document.layers["lyPhoto"].document.write(lvText);
		document.layers["lyPhoto"].document.close();
		document.layers["lyPhoto"].top=tvPosY+tvYoffset;
		document.layers["lyPhoto"].left=lvFinalPosX;
		document.layers["lyPhoto"].visibility="show";
	}

	if (document.all) 
	{
		lvWinWidth = document.body.offsetWidth;

		if (lvWinWidth<lvFinalPosX+pWidth)
			lvFinalPosX = lvWinWidth - pWidth - 20;

		lyPhoto.innerHTML=lvText;
		document.all["lyPhoto"].style.top=tvPosY+tvYoffset;
		document.all["lyPhoto"].style.left=lvFinalPosX;
		document.all["lyPhoto"].style.visibility="visible";
	}
	else if (document.getElementById) 
	{
		lvWinWidth = window.innerWidth;
		
		if (lvWinWidth<lvFinalPosX+pWidth)
			lvFinalPosX = lvWinWidth - pWidth - 20;
					
		document.getElementById("lyPhoto").innerHTML=lvText;
		document.getElementById("lyPhoto").style.top=tvPosY+tvYoffset;
		document.getElementById("lyPhoto").style.left=lvFinalPosX;
		document.getElementById("lyPhoto").style.visibility="visible";
	}

}

function getMousePos(e) 
{
	if (document.all) 
	{
		tvPosX=event.clientX+document.body.scrollLeft; 
		tvPosY=event.clientY+document.body.scrollTop;
	}
	else 
	{
		tvPosX=e.pageX; 
		tvPosY=e.pageY; 
	}
}


function fHideTips() 
{
	if (document.layers) 
	{
		document.layers["lyPhoto"].visibility="hide";
	}

	if (document.all) 
	{
		document.all["lyPhoto"].style.visibility="hidden";
	}
	else if (document.getElementById)
	{
		document.getElementById("lyPhoto").style.visibility="hidden";
	}
}

function InitShowTips() 
{
	if (document.layers) 
	{
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove=getMousePos;
		document.write("<LAYER name='lyPhoto' top=0 left=0 visibility='hide'></LAYER>");
	}
	else 
	{
		document.onmousemove=getMousePos;
		document.write("<DIV id='lyPhoto' style='position:absolute;top:0;left:0;visibility:hidden;z-index:9999'></DIV>");
	}
}

function fDocumentAdded(pNum, pMode)
{
	if (document.layers)
	{
		if (pMode==6)
			eval('document.docLayer_' + pNum).className = "thumbselected";
		else if (pMode==7)
			eval('document.docLayer_' + pNum).className = "minithumbselected";
		else if (pMode==8)
			eval('document.docLayer_' + pNum).className = "listthumbselected";

	}
	else
	{
		if(document.getElementById('docLayer_' + pNum))
		{ 
	 		if (pMode==6)
				document.getElementById('docLayer_' + pNum).className = "thumbselected";
			else if (pMode==7)
				document.getElementById('docLayer_' + pNum).className = "minithumbselected";
			else if (pMode==8)
				document.getElementById('docLayer_' + pNum).className = "listthumbselected";
		}
	}
}

function fGetPageSize(pQueryString){
	if (document.all){
		pWinWidth = document.body.clientWidth-1;
		pWinHeight = document.body.clientHeight;
	}else{
		pWinWidth = window.innerWidth-22;
		pWinHeight = window.innerHeight;
	}
	document.location.href = 'photoslist.pgi?'+pQueryString+'&ww='+pWinWidth+'&wh='+pWinHeight;
}

function fGetPageSizeByName(pQueryString, pName)
{
	if (document.all){
		pWinWidth = document.body.clientWidth-1;
		pWinHeight = document.body.clientHeight;
	}else{
		pWinWidth = window.innerWidth-22;
		pWinHeight = window.innerHeight;
	}
	document.location.href = pName + '?'+pQueryString+'&ww='+pWinWidth+'&wh='+pWinHeight;
}

function fOpenDiapoWindow(pLocation)
{
  var lvArg = fOpenDiapoWindow.arguments;
  if((lvArg[1].toString().length > 2) && (lvArg[2].toString().length > 2))
  {
	var lvLeft  = (screen.availWidth - lvArg[1])/2; 
  	var lvTop = (screen.availHeight - lvArg[2])/2; 
	window.open(pLocation,"diapo","width="+ lvArg[1] +",height="+ lvArg[2] +",top="+ lvTop +",left="+ lvLeft +",scrollbars=no"); 
  }
  else
  {
	  if(navigator.appName.indexOf('MSIE') == -1) lvBrowserName = 'NS'; 
	  else lvBrowserName = 'IE'; 
	  
	  if(navigator.userAgent.indexOf('Win') == -1) lvOS = 'Mac'; 
	  else lvOS = 'Win'; 
	  
	  if(lvOS == 'Win')
	  {
		if(lvBrowserName == 'IE')
		{
		  var lvDiapoWindow = window.open(pLocation,"diapofull","fullscreen=yes","scrollbars=no"); 
		  lvDiapoWindow.moveTo(0,0); 
		  lvDiapoWindow.resizeBy(16,0); 
		}
		else if(lvBrowserName == 'NS')
		{
		  var lvScreenWidth  = screen.availWidth -12; 
		  var lvScreenHeight = screen.availHeight; 
		  var lvDiapoWindow  = window.open(pLocation,"diapo","width="+ lvScreenWidth +",height="+ lvScreenHeight +",scrollbars=no"); 
		  lvDiapoWindow.moveTo(0,0); 
		}	 
	  }
	  else if(lvOS == 'Mac')
	  {
		if(lvBrowserName == 'IE')
		{
		  var lvScreenWidth  = screen.availWidth; 
		  var lvScreenHeight = screen.availHeight; 
		  var lvDiapoWindow  = window.open(pLocation,"diapo","scrollbars=no"); 
		  lvDiapoWindow.moveTo(0,0); 
		  lvDiapoWindow.resizeTo(lvScreenWidth,lvScreenHeight); 
		}
		else if(lvBrowserName == 'NS')
		{
		  var lvScreenWidth  = screen.availWidth -10; 
		  var lvScreenHeight = screen.availHeight -30; 
		  var lvDiapoWindow  = window.open(pLocation,"diapo","width="+ lvScreenWidth +",height="+ lvScreenHeight +",scrollbars=no"); 
		  lvDiapoWindow.moveTo(0,0); 
		}
	  } 
	}
}
  
function fDisplayMode(pForm, pList, pLastId, pURL)
{
	if (pList.value==-1)
	{
		for (var i=0; i<pList.options.length; i++)
		{
			if (pList.options[i].value == pLastId)
				pList.options[i].selected = true;
		}
		var lvArg = fDisplayMode.arguments;
		fOpenDiapoWindow(pURL,lvArg[4],lvArg[5]);	
	}
	else
		pForm.submit();
}

function fAddHistory(pLocation)
{
	var lvCurrentLocation =  new String(pLocation);
	if(lvCurrentLocation.indexOf('&back=1',0) == -1)
		parent.header.gHistory = lvCurrentLocation +'||'+ parent.header.gHistory;
}
