//Disable errors
window.onerror=handleError
function handleError()
{
   return true;
}

function window.onafterprint()
{
   //Make sure all text is printed when printing
   determineRes();
}
      
function window.onbeforeprint()
{
   //Make sure all text is printed when printing
	document.body.scroll = 'yes';
   var winHeight = document.getElementById('winTest');
   winHeight.style.overflow = 'visible';
}

//Create a popup centered on the page
function popup(pagename)
{

   var width = 798;
   var height = 500;
   var left = (screen.width - width)/2 - 2;
   var top = (screen.height - height)/2 - 20;
   if (left < 0) left = 0;
   if (top < 0) top = 0;
   window.open(pagename, "_blank", "height=" + height + ",width=" + width + ", left=" + left + ",top=" + top);
}

//Create a popup centered on the page (with different dimensions
function popupdealer(pagename)
{

   var width = 780;
   var height = 536;
   var left = (screen.width - width)/2 - 2;
   var top = (screen.height - height)/2 - 20;
   if (left < 0) left = 0;
   if (top < 0) top = 0;
   window.open(pagename, "_blank", "height=" + height + ",width=" + width + ", left=" + left + ",top=" + top);
}

//Make sure the pages are also viewable on 800x600 reolutions.
function determineRes()
{
   if (screen.width <= 800) 
   {
      document.body.scroll = 'yes';
      var winHeight = document.getElementById('winTest');
      winHeight.style.overflow = 'visible';
   }
   else
   {
      document.body.scroll = 'no';
      var winHeight = document.getElementById('winTest');
      winHeight.style.overflow = 'auto';
   }
}

function popupLink(pagename)
{
   window.opener.document.location.href=pagename;
   window.close();
}