/*

   @function      popup

   @abstract      for a popup window

   @discussion    Could center on the screen horizontally and vertically.
                  Would be cool to return false if blocked.
                  Could set a default template (w/RunWild image etc.)

   @requires     

   @param         msg - HTML/txt message to user
                  width and height - window dimensions
                  url - for optional html template for window

   @result        nada mucho


*/

function popup(msg, width, height, url){

   // FYI: some params have no influence in some browsers
   var params;
   if(width != 0 && height != 0)
      params =  "width=" + width + ",height=" + height;
   else params = "width=400,height=300";

   params +=   ",toolbar=0,location=0,directories=0," + 
               "addressbar=1,top=0,left=0," +
               "status=0,menubar=0," +
               "resizable=1,scrollbars=0";

   // browser will create a blank page w/o url supplied
   if(! url) url = "";
   // if no message warn developer
   if(! msg) msg = "TECHNICAL ERROR: no message arg!";

   // give window a unique name to allow multiple popups
   var windowName = "popup" + Math.round(Math.random()*1000000000);

   popupWindow = window.open(url, windowName, params);
   popupWindow.document.write("<html>" +
         "<head><title>RunWild Popup</title></head>" +
         "<!-- " + windowName + "-->" +
         "<body>" + msg + "</body></html>");
   // close document for writing (!= window.close)
   popupWindow.document.close();
}




function submitToNewWindow(formObj, formAction){
   randWindowNm = "window" + Math.round(Math.random()*1000);
   formObj.action = formAction;
   windowParams = 'top=100,left=100,height=200,width=200,location=no,' +
                  'resizable=no,scrollbars=no,status=no';
   window.open('', randWindowNm, windowParams);
   formObj.target = randWindowNm;
   formObj.submit();
}
