
// Checks if a given string is a valid e-mail address

function isEmail (addr) {
   if ( addr.value.indexOf("@") != "-1" &&
        addr.value.indexOf(".") != "-1" &&
        addr.value != "" )
      return true;
   else
      return false;
}



// Checks if a given form field has a value

function isFilled (s) {
   if ( s.value == "" ||
        s.value == null )
      return false
   else
      return true;
}



// Shows an error message

function showError (msg , styleSheet) {
   var content = "<HEAD><TITLE>Error</TITLE></HEAD>";
   if ( styleSheet != null && styleSheet.length > 0 ) {
      content = content + "<LINK REL=\"stylesheet\" HREF=\"" +
         styleSheet + "\">";
   }
   content = content +
       "<BODY BGCOLOR='#FFFFFF'> <FONT SIZE=-1>" +
       "<BR> <BR>" +
       "<P ALIGN=CENTER> <STRONG> " + msg + "</STRONG> </P>" +
       "<P ALIGN=CENTER> Please revise your input. </P>" +
       "</FONT></P> <BR>" +
       "<P ALIGN=CENTER> <A HREF=\"javascript:close()\">" +
       "Close</A>" + "</P> </BODY>"

   errorwin = window.open("", "", "width=300,height=250,scrollbars=yes");
   errorwin.document.write(content);
   errorwin.document.close();
   return true;
}



// Shows sponsor URL on a separate window

function showSponsor ( sponsorURL ) {
   if ( sponsorURL != "" ) {
      window.open(
         sponsorURL,
         "sponsorWin",
         "width=640,height=480,scrollbars,location,resizable,status");
   }

   return false;
}

