

function popup_windowNorm(sUrl)
{
	popup_windowSize(sUrl,600,440);
}

function popup_windowLarge(sUrl)
{
	popup_windowSize(sUrl,802,600);
}

function popup_windowAdvancedSearch(sUrl)
{
	popup_windowSize(sUrl,802,600,'status=yes,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=yes,scrollbars=yes');
}

function popup_windowSearch(sName)
{
	window.open('',sName,'top=0,left=0,height=600,width=802,status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=yes,scrollbars=yes');
}

function popup_windowLargeMenuBar(sUrl)
{
	window.open(sUrl,'','top=0,left=0,height=600,width=802,status=no,toolbar=yes,menubar=yes,location=yes,resizable=yes,titlebar=yes,scrollbars=yes');	
}

function popup_diaporama(fileDiapoPath, filePlayerPath)
{
  var diapowindow=window.open('','name','height=627,width=679');

    var diapo = diapowindow.document; 
    diapo.open();
  diapo.write('<html><head><title></title></head><body style="margin:0px;">');
  diapo.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="679" height="627" id="player" align="left">');
  diapo.write('<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+filePlayerPath+'" /><PARAM NAME=FlashVars VALUE="feed='+fileDiapoPath+'"><param name="quality" value="high" /><param name="bgcolor" value="#c0c0c0" />');
  diapo.write('<embed src="'+filePlayerPath+'" quality="high" FlashVars="feed=' + fileDiapoPath + '" bgcolor="#c0c0c0" width="679" height="627"  name="player" align="left" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
  diapo.write(' pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></body></html>');
  diapo.close();
 }

function popup_Image(theImage,  theImageWidth, theImageHeight)
{
	try{
	var popupImageWidth="";
	var popupImageHeight="";

	if (theImageWidth!=null){
		popupImageWidth = 'width="' + theImageWidth+'"';
	}
	if (theImageHeight!=null){
		popupImageHeight = 'height="' + theImageHeight+'"';
	}


  var docContent='<html><head><script src="'+getPATH_SCRIPT()+'popup.js"></script><link rel="stylesheet" type="text/css" href="'+getCssPATH()+'">';

  docContent += '<title>ZOOM</title></head><body class="popup" onLoad="addPopupImageInfos();chkImageLoad(\''+theImage+'\',  '+theImageWidth+', '+theImageHeight+');"><div id="theImage" name="theImage"></div><div id="popupImageCopyright"  name="popupImageCopyright" class="copyright"></div>';
 docContent += '</body></html>';
 var popupImage = theWindow = open("","","top=0,left=0,height=1,width=1,status=no,toolbar=no,mbar=no,location=no,resizable=yes,titlebar=yes,scrollbars=no");

  var doc = popupImage.document; 
  doc.open();
  doc.write(docContent);
  doc.close();
  }catch(e){}
 

 }


function addPopupImageInfos(){

	try{
		var theCopyright=window.opener.document.getElementById('galImageGFCopyright').innerHTML;
		document.getElementById('popupImageCopyright').innerHTML=theCopyright;
	}catch(e){}
	try{
		var theTitle=window.opener.document.getElementById('popupZoomTitle').innerHTML;
		document.title=theTitle;
	}catch(e){}

	
	

}


function chkImageLoad(theImage,  theImageWidth, theImageHeight) {
	var popupImageWidth="";
	var popupImageHeight="";

	
	var myImage = new Image();
	myImage.src = theImage;
	var ie = document . all ? 1 : 0;
	/*if (ie || myImage.complete) {*/
	if (myImage.width) {
		if (theImageWidth!=null){
			popupImageWidth = 'width="' + theImageWidth+'"';
		}else{
			popupImageWidth= 'width="' +myImage.width +'"';
		}
		if (theImageHeight!=null){
			popupImageHeight = 'height="' + theImageHeight+'"';
		}else{
			popupImageHeight= 'height="' + myImage.height+'"';
		}
		document.getElementById('theImage').innerHTML='<img src="'+theImage+'" '+popupImageHeight+' '+ popupImageWidth +'>';
		popupEnlargeToContent();
		if (typeof( window[ 'isLoaded' ] ) != "undefined" ){
			clearTimeout(isLoaded);
		}	
	}else{
	/*if (!myImage.complete && !ie) {*/
		document.getElementById('theImage').innerHTML='<font class="texte">Image en cours de chargement....</font>';
		isLoaded = setTimeout('chkImageLoad("'+theImage+'", '+ theImageWidth+', '+theImageHeight+')',100);
	}
	
}
function popup_windowLargeToolBar(sUrl)
{
	window.open(sUrl,'','top=0,left=0,height=600,width=802,status=yes,toolbar=yes,menubar=yes,location=no,resizable=yes,titlebar=yes,scrollbars=yes');	
}

function popup_windowSize(sUrl,width,height,features)
{	
	if ( features!=null )
		window.open(sUrl,'','top=0,left=0,height='+height+',width='+width+','+features);
	else
		window.open(sUrl,'','top=0,left=0,height='+height+',width='+width+',status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=yes,scrollbars=yes');	
}

function popup_windowNAV(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.open(sUrl,"","top=0,left=0,width=650,height=440,status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes");
		return winNAV;
	}
}
function popup_windowNAVSmall(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.open(sUrl,"","top=0,left=0,width=428,height=318,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no,scrollbars=no");
		return winNAV;
	}
}
function popup_window(sUrl)
{
	if (sUrl!="") {
		window.open(sUrl,"","top=0,left=0,width=510,height=600,status=no,toolbar=yes,menubar=yes,location=no,resizable=yes,titlebar=no,scrollbars=yes");
	}
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function popup_windowFull(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.open(sUrl,"","top=0,left=0,width=650,height=440,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,titlebar=yes,scrollbars=yes");
		return winNAV;
	}
}
function popup_windowLink(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.open(sUrl,"","top=0,left=0,width=650,height=440,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,titlebar=yes,scrollbars=yes");
		return winNAV;
	}
}

function popup_showModalLogin(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.showModalDialog(sUrl,"Login","dialogWidth:530px;dialogHeight:440px;center:1;scroll:0;help:0;status:0");
		return winNAV;
	}
}

function popup_windowLogin(sUrl)
{
	if (sUrl!="") {
		var winNAV = window.open(sUrl,"Login","top=0,left=0,width=530,height=440,status=no,toolbar=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes");
		return winNAV;
	}
}


function showSite(url) {   
	if (!url=="")
	{
		popup_windowSize(url,802,600);
	}
}  

function showSiteFromSelect(o)
{
	var v = o.options[o.selectedIndex].value;
	o.selectedIndex=0;
	showSite(v);
}

function showOpnw3FromSelect(o)
{
	var v = o.options[o.selectedIndex].value;
	o.selectedIndex=0;
	window.location=v;
}

function popupEnlargeToContent()
{
	self.document.body.scroll="no";
	var wBodyAff,hBodyAff, hBodyNeeded, wBodyNeeded, titleBarHeight;
	
	if (self.innerHeight) // all except Explorer
	{
		wBodyAff = self.innerWidth;
		hBodyAff = self.innerHeight;
		//titleBarHeight=20;
		//alert("outerHeight");
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		wBodyAff = document.documentElement.clientWidth;
		hBodyAff = document.documentElement.clientHeight;
		//titleBarHeight=22;
			//alert("clientHeight");
	}
	else if (document.body) // other Explorers
	{
		wBodyAff = document.body.clientWidth;
		hBodyAff = document.body.clientHeight;
			/*alert("clientHeight body");
			titleBarHeight=0;*/

	}
	
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight
if (test1 > test2) // all but Explorer Mac
{
	wBodyNeeded = document.body.scrollWidth;
	hBodyNeeded = document.body.scrollHeight;
}
else // Explorer Mac;
     //would also work in Explorer 6 Strict, Mozilla and Safari
{
	wBodyNeeded = document.body.scrollWidth;
	hBodyNeeded = document.body.offsetHeight;
}
//alert("wBodyAff="+wBodyAff+";hBodyAff="+hBodyAff+";wBodyNeeded="+wBodyNeeded+";hBodyNeeded="+hBodyNeeded+";"+self.window.width);
  var wResizeBy = 0;
    if (wBodyAff < wBodyNeeded)
    {       
        wResizeBy = wBodyNeeded - wBodyAff; 
    }
    var hResizeBy = 0;
     
    if (hBodyAff < hBodyNeeded)
    {
        hResizeBy = hBodyNeeded - hBodyAff;
    }
    self.window.resizeBy(wResizeBy, hResizeBy);


}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
function previewEnlargeToContent()
{
    
    var wBodyAff = self.document.body.clientWidth;
    var wBodyNeeded = self.document.body.scrollWidth;
    var wScreen = self.screen.width;
    var wResizeBy = 0;

    if (wBodyNeeded > wScreen)
    {       
        self.document.body.scroll.horizontal="yes"; 
        wResizeBy = wScreen - wBodyAff - 30;
    }
    else if (wBodyNeeded > wBodyAff)
    {
        wResizeBy = wBodyNeeded -wBodyAff;
    }
    
    var hBodyAff = self.document.body.clientHeight;
    var hBodyNeeded = self.document.body.scrollHeight;
    var hScreen = self.screen.height;
    var hResizeBy = 0;

    if (hBodyNeeded > hScreen-120)
    {       
        self.document.body.scroll.vertical="yes"; 
        hResizeBy = hScreen - hBodyAff-200;
    }
    else if (hBodyNeeded > hBodyAff)
    {
        self.document.body.scroll.vertical="no";
        hResizeBy = hBodyNeeded - hBodyAff;
    }
            
    self.window.resizeBy(wResizeBy, hResizeBy);
    self.window.moveTo(0,0);

}

function gotoLanguageSelector(select)
{
    var index = select.selectedIndex;
    if (index < 0) return;
    var value = select.options[index].value;
    document.location.href = value;
}


function popupNormalDialogResize()
{
    // Attention a bien g?rer le cas de la popup dans une frame ...
    // donc on n'utilise pas window, mais top
    self.document.body.scroll="no";

    var wBodyAff = self.document.body.clientWidth;
    var wBodyNeeded = self.document.body.scrollWidth;
    var wResizeBy = 0;
    if (wBodyAff < wBodyNeeded)
    {
        wResizeBy = wBodyNeeded - wBodyAff;
    }
    var hResizeBy = 0;
    var hBodyAff = self.document.body.clientHeight;
    var hBodyNeeded = self.document.body.scrollHeight;
    if (hBodyAff < hBodyNeeded)
    {
        hResizeBy = hBodyNeeded - hBodyAff;
    }
    top.resizeBy(wResizeBy, hResizeBy);

    // Z'et je vais z'au milieu
   // top.moveBy(-wResizeBy/2, -hResizeBy/2);
}
/********** POUR LE PLAYER PHOTO *****************/

function openHPGalZoom(imgUrl,largeur,hauteur,copyrightNoQuotes){
	try{


  var docContent='<html><head><script src="'+getPATH_SCRIPT()+'popup.js"></script><link rel="stylesheet" type="text/css" href="'+getCssPATH()+'">';

  docContent += '<title>ZOOM</title></head><body class="popup" onLoad="chkImageLoad(\''+imgUrl+'\',  '+largeur+', '+hauteur+');"><div id="theImage" name="theImage"></div><div id="popupImageCopyright"  name="popupImageCopyright" class="copyright">'+copyrightNoQuotes+'</div>';
 docContent += '</body></html>';
 var popupImage = theWindow = open("","","top=0,left=0,height=1,width=1,status=no,toolbar=no,mbar=no,location=no,resizable=yes,titlebar=yes,scrollbars=no");

  var doc = popupImage.document; 
  doc.open();
  doc.write(docContent);
  doc.close();
  }catch(e){}
}


/********** POUR LE PLAYER PHOTO *****************/