function getWindowHeight()
{
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight+window.pageYOffset;;
    }
    else {
        if (document.documentElement&&document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight+document.documentElement.scrollTop;
        }
        else {
            if (document.body&&document.body.clientHeight) {
                windowHeight=document.body.clientHeight+document.body.scrollTop;
            }
        }
    }
    if (windowHeight==0)
        return '100%';
    return windowHeight+'px';
}
function getWindowWidth()
{
    var windowWidth=0;
    if (typeof(window.innerWidth)=='number') {
        windowWidth=window.innerWidth+window.pageXOffset;;
    }
    else {
        if (document.documentElement&&document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth+document.documentElement.scrollLeft;
        }
        else {
            if (document.body&&document.body.clientWidth) {
                windowWidth=document.body.clientWidth+document.body.scrollLeft;
            }
        }
    }
    if (windowWidth==0)
        return '100%';
    return windowWidth+'px';
}

function centerDiv(objId)
{
	var obj = xajax.$(objId);
	if (obj==null) return;
	var theLeft=0;
	var theTop=0;
	var screenHeight=0;
	var screenWidth=0;
	var scrollTop=0;
	var scrollLeft=0;
	if (document.documentElement)
	{
	    scrollTop=document.documentElement.scrollTop;
	    scrollLeft=document.documentElement.scrollLeft;
	    screenHeight=document.documentElement.offsetHeight - scrollTop;
	    screenHeight=document.documentElement.clientHeight;
	    screenWidth=document.documentElement.offsetWidth - scrollLeft;
	    screenWidth=document.documentElement.clientWidth;
		//theLeft = document.documentElement.scrollLeft;
		//theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
	    scrollTop=document.body.scrollTop;
	    scrollLeft=document.body.scrollLeft;
		screenHeight=document.body.offsetHeight - document.body.scrollTop;
	    screenWidth=document.body.offsetWidth - document.body.scrollLeft
	}
	if (obj.offsetHeight > screenHeight)
	    theTop=scrollTop;
    else
    {
        theTop=scrollTop+(screenHeight-obj.offsetHeight)/2;
    }
    if (obj.offsetWidth > screenWidth)
	    theLeft=scrollLeft;
    else
    {
        theLeft=scrollLeft+(screenWidth-obj.offsetWidth)/2;
    }
    obj.style.left = theLeft + 'px' ;
	obj.style.top = theTop + 'px' ;
}

function showPhoto(path, width, height)
{
	grayOutPersistent(true,false);
	img=xajax.$("photoPopupImg");
	img.src=path;
	popup=xajax.$("photoPopup");
	if (width==0)
	    img.style.width="";
	else
	    img.style.width=width+"px";
	if (height==0)
	    img.style.height="";
	else
	    img.style.height=height+"px";
	popup.style.display="block";
	popup.style.visibility="visible";
	centerDiv('photoPopup');
}

function hidePhoto()
{
	img=xajax.$("photoPopupImg");
	img.src="";
	/*img.src="images/loading.gif";
	img.style.width="37px";
	img.style.height="37px";*/
	xajax.$('photoPopup').style.visibility='hidden';
	grayOutPersistent(false,false);
}


function showPanier()
{
	grayOutPersistent(true,false);
	popup=xajax.$("panierPopup");
	popup.style.display="block";
	popup.style.visibility="visible";
	centerDiv('panierPopup');
}

function hidePanier()
{
	xajax.$('panierPopup').style.visibility='hidden';
	grayOutPersistent(false,false);
}