
//////////////////////////////////////////
// wp
//////////////////////////////////////////
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
/*
<INPUT TYPE=text VALUE="E-Mail Address" ONFOCUS="clearDefault(this)">
*/
//////////////////////////////////////////
function changeCellBG(el, myColor) {
      el.style.background =myColor;
}
//////////////////////////////////////////
// onMouseover="return hidestatus()"
var statusmsg=""
function hidestatus(){
window.status=statusmsg
return true
}  
//////////////////////////////////////////
//A required global variable for the loadImages() function
loadedImages = null
/**
 * loadImages() accepts a list of file names to load into cache.
 * For each file name it creates a new image object and begins
 * downloading the file into the browser's cache. 
 **/
function loadImages(){
   var img
   if (document.images){
      if (!loadedImages) loadedImages = new Array()
      for (var i=0; i < arguments.length; i++){
         img = new Image()
         img.src = arguments[i]
         loadedImages[loadedImages.length] = img
      }
   }   
}

/**
 * flip(imgName, imgSrc) sets the src attribute of a named
 * image in the current document. The function must be passed
 * two strings. The first is the name of the image in the document
 * and the second is the source to set it to.
 **/
function flip(imgName, imgSrc){
   if (document.images){
      document[imgName].src = imgSrc
   }
}
//////////////////////////////////////////
function emailCheck (emailStr)
	 {
            var emailPat=/^(.+)@(.+)$/
            var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
            var validChars="\[^\\s" + specialChars + "\]"
            var quotedUser="(\"[^\"]*\")"
            var ipDomainPat=/^\[(\d)\.(\d)\.(\d)\.(\d)\]$/
            var atom=validChars + '+'
            var word="(" + atom + "|" + quotedUser + ")"
            var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
            var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
            var matchArray=emailStr.match(emailPat)

            if (matchArray==null)
	    {
                    alert("Email address seems incorrect (check @ and .'s)")
                    return false
            }
            var user=matchArray[1]
	    var domain=matchArray[2]
            if (user.match(userPat)==null)
	    {
                // user is not valid
                alert("The username doesn't seem to be valid.")
                return false
            }
            var IPArray=domain.match(ipDomainPat)
            if (IPArray!=null)
	    {
                // this is an IP address
                      for (var i=1;i<=4;i++)
		      {
                        if (IPArray[i]>255)
			{
                            alert("Destination IP address is invalid!")
                            return false
                        }
                }
                return true
            }
            var domainArray=domain.match(domainPat)

            if (domainArray==null)
	    {
                    alert("The domain name doesn't seem to be valid.")
                return false
            }
            var atomPat=new RegExp(atom,"g")
            var domArr=domain.match(atomPat)
            var len=domArr.length
            if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3)
            {
               // the address must end in a two letter or three letter word.

               alert("The address must end in a three-letter domain, or two letter country.")
               return false
            }
            if (len<2)
	    {
               var errStr="This address is missing a hostname!"
               alert(errStr)
               return false
            }
            return true;
         }
//END OF EMAIL CHECK
function validate()
	{
		formcust=document.form2;
		if(formcust.subject.value=="")
		{
			alert("Please Enter Subject");
			formcust.subject.focus();
			return false;
		}
		if(formcust.replyemail.value=="")
		{
			alert("Please Enter Email");
			formcust.replyemail.focus();
			return false;
		}
		if(!emailCheck(formcust.replyemail.value))
		{
			alert("Please Enter Valid Email Address");
			formcust.replyemail.focus();
			return false;
		}
		if(formcust.message.value=="")
		{
			alert("Please Enter Message");
			formcust.message.focus();
			return false;
		}
		return true;
	}

//////////////////////////////////////////
/*hi*/