/*
 * Copyright 2003-2004, Peter Rowntree. All Rights Reserved.
 * http://www.hdyn.com/wr/common/contact.php?addr=pr
 * needs: nothing
 */
 
//errMsg is the content of the confirm (if allowFallback),
//or the alert (if not)
function openNewURLWindow(url,wName,props,allowFallback,ask,errMsg)
{
   var w = window.open(url,wName,props);
   if(w == null)
   {
      if(allowFallback)
      {
         if(!ask || confirm(errMsg))
         {
            window.location.href=url;
            return window;
         }
      }
      else
         alert(errMsg);
      return null; 
   }
   return w;
}
 
function openNewXMLWindow(xml,wName,props,allowFallback,ask,errMsg)
{ 
   var w = window.open("",wName,props);
   if(w == null)
   {
      if(allowFallback)
      {
         if(ask && !confirm(errMsg))
            return null;
         w=window;
         w.location.href="/wr/common/blank.html";
      }
      else
      {
         alert(errMsg);
         return null;
      }
   }
   try
   {
      w.document.write(xml);
   }
   catch(e)
   {
      alert(e);
   }
   w.document.close();
   w.focus();
   return w;
}
 
function openNewXMLDocWindow(xmlDoc,wName,props,allowFallback,ask,errMsg)
{ 
   var w = window.open("",wName,props);
   if(w == null)
   {
      if(allowFallback)
      {
         if(ask && !confirm(errMsg))
            return null;
         w=window;
         w.location.href="/wr/common/blank.html";
      }
      else
      {
         alert(errMsg);
         return null;
      }
   }
   try
   {
      w.document=xmlDoc;
   }
   catch(e)
   {
      alert(e);
   }
   w.focus();
   return w;
}

function goBlank()
{
   window.location.href="/wr/common/blank.html";
}
