
function getScreenResolution(){

    varScreenWidth = screen.width;
    varScreenHeight = screen.height;

	return [varScreenWidth,varScreenHeight]; 
}

function getPageSize(){

  if (window.innerHeight && window.scrollMaxY) { // Firefox
	BodyWidth = document.body.scrollWidth;
	BodyHeight = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	BodyWidth = document.body.scrollWidth;
	BodyHeight = document.body.scrollHeight;
  } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
	BodyWidth = document.documentElement.scrollWidth;
	BodyHeight = document.documentElement.scrollHeight;
  } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	BodyWidth = document.body.offsetWidth;
	BodyHeight = document.body.offsetHeight;
  }

     return [BodyWidth,BodyHeight]; 
}

function getScrollPos() {

  var posX = 0, posY = 0;

  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    posY = window.pageYOffset;
    posX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    posY = document.body.scrollTop;
    posX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    posY = document.documentElement.scrollTop;
    posX = document.documentElement.scrollLeft;
  }

	return[posX,posY];
}

function getBrowWinSize() {
  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,myHeight];
}

function getBrowType(){

    var browser=navigator.appName;
    var b_version=navigator.appVersion;
    var version=parseFloat(b_version);

	return[browser,version];
}

function FormsVisibility(action){

 var j = 0;

    while (document.forms[j]){
	for (var i = 0; i < document.forms[j].elements.length; i++)
	    if (document.forms[j].elements[i].nodeName.toLowerCase()=="select")document.forms[j].elements[i].style.visibility = action;
      j++
    }

}

function PhotoViewOpen(pid) {

  var width  = document.getElementById('W' + pid).offsetWidth;
  var height = document.getElementById('W' + pid).offsetHeight;

  FormsVisibility('hidden');

		varBrowWinSize = getPageSize();

	document.getElementById('substrate').style.display = 'block';
	document.getElementById('substrate').style.width = varBrowWinSize[0] + 'px';
	document.getElementById('substrate').style.height = varBrowWinSize[1] + 'px';

	photowin = document.getElementById(pid);
	photowin.style.visibility = 'visible';

		varScrollPos=getScrollPos();
		varBrowWinSize=getBrowWinSize();

	photowin.style.left = varScrollPos[0]+((varBrowWinSize[0]  - width)/2) + 'px';
	photowin.style.top = ((varBrowWinSize[1] - height)/2) + 'px';

}

function PhotoViewClose(pid) {

	document.getElementById(pid).style.visibility = 'hidden';
        document.getElementById('substrate').style.display = 'none';

   FormsVisibility('visible');

}

