function NewWindow(mypage, myname, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no ,resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus();
	}
}

function NewImageWindow(mypage, myimage, myname) {
  function getWidthAndHeight() {
    alert("'" + this.name + "' is " + this.width + " by " + this.height + " pixels in size.");
    return true;
  }
  function loadFailure() {
    alert("'" + this.name + "' failed to load.");
    return true;
  }  
  function openWindow() {
     if (readCookie('popup') == null) {
       var winl = (screen.availWidth - this.width) / 2;
       var wint = (screen.availHeight - this.height) / 2;
       winprops = 'height='+this.height+',width='+this.width+',top='+wint+',left='+winl+',scrollbars=no,resizable=no'    
       win = window.open(mypage, '', winprops);
       
       if (parseInt(navigator.appVersion) >= 4) {win.window.focus();}
    
       createCookie('popup', '1', ''); 
    
       return true;
     }
  }
  
  function createCookie(name,value,days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
  }

  function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  }

  var myImage = new Image();
  myImage.name = myimage;
  myImage.onload = openWindow;
  myImage.onerror = loadFailure;
  myImage.src = myimage;
}