var HOVER = false;
var newwin;

function openphoto(winurl,winx,winy)
{	
	winfeatures = 'width='+winx+',height='+winy+', resizable=no, status=no';
	
	if(newwin)
	{	newwin.close(); }   // 2 reason always bring up windows and resize didn't work!
	
	//This launches a new window and then focuses it if window.focus() is supported.
      newwin = window.open(winurl,'AbelCleo',winfeatures); //spaces in window's name causes error in IE!!!!
	// windowName: A name to be given to the new window. The name can be used to refer this window again.
	
    //delay a bit here because IE4 encounters errors
    //when trying to focus a recently opened window - javascript version > 1.0
    setTimeout('newwin.focus();',250);
}


function checkMsgform()
{
   if((document.forms[0].elements[0].value!="") && (document.forms[0].elements[2].value!=""))
   {
	if (document.forms[0].elements[1].value=="")
	{ return true; }
	if ((document.forms[0].elements[1].value.indexOf("@") > 0) && (document.forms[0].elements[1].value.indexOf(".") > 2))
	{ return true; }
    	alert("Adresse email invalide");
	return false;
   }
   alert("Nom ou message incorrecte");
   return false;
}


function SlideTo(pos)
{
  if (document.getElementById)
  {
  		target = document.getElementById('slider');
		target.style.top = pos;
		HOVER = true;
  }
}


function ShowSelect( )
{
  if ((document.getElementById) && (HOVER == false))
  {
  		target = document.getElementById('slider');
		target.style.display = "block";
  }
}

function DelayShow()
{
	HOVER = false;
	setTimeout("ShowSelect()",500);
	/* setTimeout("alert('Hover='+HOVER)",500); */
}

function LoadSlider(pos)
{
	ResizeForScroll();

	target = document.getElementById('slider');
	current = 180;
	nextstep = 0;
	while(current>pos)
	{
		current = current - 1;
		nextstep = nextstep + 10;
		setTimeout("target.style.top = "+current,nextstep);
		if (current==pos)
		{setTimeout("highlight()",nextstep);}
	}
}

function highlight()
{
  if (document.getElementById)
  {
	document.getElementById('selection').style.color = "#FFFFCC";
  }
}

function ResizeForScroll()
{
  X1 = document.body.clientWidth;
  
  if(document.all)	// for IE
  {
   		X2 = document.all['mainfoot'].clientWidth + 250;
		
		if(X1>X2)
		{		
			document.all['header'].style.width = document.body.clientWidth - (X1-X2);
			document.all['footer'].style.width = document.body.clientWidth - (X1-X2);
		}	
  }
  else if (document.getElementById)
  {
		X2 = document.getElementById('mainfoot').clientWidth + 250;

		if(X1>X2)
		{		
			document.getElementById('header').style.width = window.innerWidth - (X1-X2);
			document.getElementById('footer').style.width = window.innerWidth - (X1-X2);
		}
  }		
}



function resizePopWindow(iWidth, iHeight)
{
    var rezRef = document.getElementById('resizeRef');

    if (resizeRef) 
    {
        var iPreWidth = resizeRef.offsetWidth;
        var iPreHeight = resizeRef.offsetHeight;
        window.resizeTo(iPreWidth,iPreHeight);

        var iPostWidth = resizeRef.offsetWidth;
        var iPostHeight = resizeRef.offsetHeight;
        var iOuterWidth = iWidth + (iPreWidth-iPostWidth);
        var iOuterHeight = iHeight + (iPreHeight-iPostHeight);
    }

    window.resizeTo(iOuterWidth, iOuterHeight);
}



var ie5=document.all&&document.getElementById;

function showmenu (theElement)
{
	if (ie5) 
	{	document.getElementById(theElement).style.display='block';	}
}

function hidemenu (theElement)
{
	if (ie5) 
	{	document.getElementById(theElement).style.display='none';	}
}


function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}