function AutoSize(tableName, paddingX, paddingY) //OK
{
	var popW = parseInt(document.getElementById(tableName).getAttribute("clientWidth")) + paddingX;
	var popH = parseInt(document.getElementById(tableName).getAttribute("clientHeight")) + paddingY;
	var winLeft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;

	window.moveTo(winLeft,winUp);
	window.resizeTo(popW,popH);
}

function ResizeWindow(width, height)
{
	var popW = width;
	var popH = height;
	var winLeft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	
	window.moveTo(winLeft,0);
	window.resizeTo(popW,popH);
}

function toggleBox(szDivID, iState, name, width, height) // iState = 1 visible or 0 hidden
{
	if (iState)
	{
		var NS = (navigator.appName=="Netscape")?true:false;
		
		iWidth = (NS)?window.innerWidth:document.body.clientWidth;
		iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
		
		iWidth = iWidth/2 - width/2;
		iHeight = iHeight/2 - height/2; 

		objDiv = document.getElementById("photos");
		objDiv.innerHTML = "<table width=\"" + width + "\" height=\"" + height + "\"><tr><td bgcolor='#000000' align='right' height='14'><a href=\"javascript:toggleBox('"+ szDivID +"',0,'');\"><img src='images/x.jpg' border=0></a></td></tr><tr><td><a href=\"javascript:toggleBox('"+ szDivID +"',0,'');\"><img src=\"photos/membres/" + name + ".jpg" + "\" border=0></a></td></tr></table>"; 
	
		objDiv.style.left = iWidth;
		objDiv.style.top = iHeight;
		objDiv.style.width = width;
		objDiv.style.height = height;
	}
	
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function toggleBoxLogin(szDivID, iState) // iState = 1 visible or 0 hidden
{
	if (iState)
	{
		var NS = (navigator.appName=="Netscape")?true:false;
		
		iWidth = (NS)?window.innerWidth:document.body.clientWidth;
		iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
		
	
	
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
	}
}

function OuvrirPopupSite(page)
{
	var popW = 1003;
	var popH = 690;
	var winLeft = (screen.width - popW) / 2;
	var winUp = 0;

	window.open(page,""," toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no, left=" + winLeft + ", top=" + winUp + ", width=" + popW + ",height=" + popH);
	opener = self;
	self.close();
	return true;        
}

function OuvrirPopupLogin(page)
{
	var popW = 400;
	var popH = 200;
	var winLeft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;

	window.open(page,""," toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no, left=" + winLeft + ", top=" + winUp + ", width=" + popW + ",height=" + popH);
	return true;        
}

function RefreshOpener() //OK
{	
	if(self.opener != null)
	{
		self.opener.location = self.opener.location;
		window.close();
	}      
}
