loaded = 0;
function getWindowWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 return myWidth;
}

function getWindowHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 return myHeight;
}

function im_replace(which,status,online)
{
	if (which != online)
	{	
		if (status){if (document.images && (loaded == 1)) {document.images["im"+which].src = img[which]+".gif"}}
		  else {if (document.images && (loaded == 1)) {document.images["im"+which].src = img[which]+"_.gif"}}
	}
}

function showGaleryImage(imageUrl,iw,ih,pID,divName)
{
	var dv = document.getElementById(divName);
	var pd = document.getElementById(pID);
	dv.innerHTML = '<a href="javascript:void(0);" onclick="closeGaleryImage(\''+divName+'\',\''+pID+'\');"><img src="'+imageUrl+'" border="0"></a>';
	/*
	dv.style.left = GetElementLeft(pID)+pID.width;//*(2/3);
	dv.style.top = GetElementTop(pID);//+parentBlock.height/3;
	dv.style.offsetLeft = GetElementLeft(pID)+pID.width;//*(2/3);
	dv.style.offsetTop = GetElementTop(pID);//+parentBlock.height/2;
	*/
	//alert(document.body.clientWidth);
	var delta = 0;
	if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1)
		delta = 20;
	dv.style.left = Math.round(document.body.clientWidth/2 - iw/2 - 5);
	dv.style.top = Math.round(document.body.clientHeight/2 - ih/2 - 5);
	pd.style.width = (document.body.clientWidth - 10 - delta);
	pd.style.Height = (document.body.clientHeight - 10 - delta);
	pd.style.left = 5;
	pd.style.top = 5;
	pd.style.visibility = 'visible';
	dv.style.visibility = 'visible';
	return false;
}

function closeGaleryImage(divName,pID)
{
	var pd = document.getElementById(pID);
	var dv = document.getElementById(divName);
	dv.innerHTML = '';
	dv.style.visibility = 'hidden';
	pd.style.visibility = 'hidden';
	return false;
}



