var popUpWin=0;


function sh_popup(URLStr,widthw,heightw)
{
  var width=(widthw>0) ? widthw:380;
  var height=(heightw>0) ? heightw:470;
  var left = parseInt((screen.availWidth/2) - (width/2));
  var top = parseInt((screen.availHeight/2) - (height/2));

  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr+'?popup', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

 
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;

function popImage(imageURL,imgTitle) {
	imageURL=location.protocol+'//'+location.host+imageURL;
	var defWidth=0.75*screen.availWidth;
	var defHeight=0.75*screen.availHeight;
	var defWidth1=10;
	var defHeight1=10;
	var f="width="+defWidth1+",height="+defHeight1;	
	f+=",left="+((screen.availWidth-defWidth)/2)+",scrollbars=yes,resizable=yes,top="+((screen.availHeight-defHeight)/2);
	imgWin=window.open('about:blank','',f);
	imDoc=imgWin.document;
	with (imDoc) {
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);if (width>0.75*screen.availWidth) width=0.75*screen.availWidth;');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);if (height>0.75*screen.availHeight) height=0.75*screen.availHeight;');
		writeln('window.resizeTo(width,height);}');writeln('else {');       
		writeln('window.innerWidth=document.images["George"].width<0.75*screen.availWidth ? document.images["George"].width:0.75*screen.availWidth;');
		writeln('window.innerHeight=document.images["George"].height<0.75*screen.availHeight ? document.images["George"].height:0.75*screen.availHeight;}}');
		writeln('function doTitle(){document.title="'+imgTitle+'";}');writeln('</sc'+'ript>');
		writeln('</head><body bgcolor="#FFFFFF" onload="reSizeToImage();doTitle();self.focus()">')
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
		
		close();
	}
}

function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }

   var tDate = new Date();

   if (tDate.getHours()<10) zero1='0'; else zero1='';
   if (tDate.getMinutes()<10) zero2='0'; else zero2='';
   document.getElementById('time').innerHTML = "" 
                                   + zero1 + tDate.getHours() + ":" 
                                   + zero2 + tDate.getMinutes();
   
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
}
