        function isEmail (emailStr) {
		
    		var b = 0 ;
    		var i = 0 ;
    		var errmsg = "Please enter a valid email address" ;
    		var punct = "" ;
    		var min = 0 ;
    		var max = 0 ;
            
            var checkTLD=1;
            var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|ws)$/;
            var emailPat=/^(.+)@(.+)$/;
            var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
            var validChars="\[^\\s" + specialChars + "\]";
            var quotedUser="(\"[^\"]*\")";
            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(errmsg);
              return false;
            }
            var user=matchArray[1];
            var domain=matchArray[2];
            
            for (i=0; i<user.length; i++) {
              if (user.charCodeAt(i)>127) {
              alert(errmsg);
              return false;
              }
            }
            for (i=0; i<domain.length; i++) {
              if (domain.charCodeAt(i)>127) {
              alert(errmsg);
              return false;
              }
            }
            
            if (user.match(userPat)==null) {
              alert(errmsg);
              return false;
            }
            
            var atomPat=new RegExp("^" + atom + "$");
            var domArr=domain.split(".");
            var len=domArr.length;
            for (i=0;i<len;i++) {
    			if (domArr[i].search(atomPat)==-1) {
                  alert(errmsg);
                  return false;
                }
            }
            
            if (checkTLD && domArr[domArr.length-1].length!=2 &&
              domArr[domArr.length-1].search(knownDomsPat)==-1) {
              alert(errmsg);
              return false;
            }
            
            if (len<2) {
              alert(errmsg);
              return false;
            }
            
           	return true;
        }		



function getTimezoneName() {
        
		tmSummer = new Date(Date.UTC(2010, 6, 30, 0, 0, 0, 0));

        so = -1 * tmSummer.getTimezoneOffset();
        tmWinter = new Date(Date.UTC(2010, 12, 30, 0, 0, 0, 0));
        wo = -1 * tmWinter.getTimezoneOffset();
         
        if (-660 == so && -660 == wo) return 'Pacific/Midway';
        if (-600 == so && -600 == wo) return 'Pacific/Tahiti';
        if (-570 == so && -570 == wo) return 'Pacific/Marquesas';
        if (-540 == so && -600 == wo) return 'America/Adak';
        if (-540 == so && -540 == wo) return 'Pacific/Gambier';
        if (-480 == so && -540 == wo) return 'US/Alaska';
        if (-480 == so && -480 == wo) return 'Pacific/Pitcairn';
        if (-420 == so && -480 == wo) return 'US/Pacific';
        if (-420 == so && -420 == wo) return 'US/Arizona';
        if (-360 == so && -420 == wo) return 'US/Mountain';
        if (-360 == so && -360 == wo) return 'America/Guatemala';
        if (-360 == so && -300 == wo) return 'Pacific/Easter';
        if (-300 == so && -360 == wo) return 'US/Central';
        if (-300 == so && -300 == wo) return 'America/Bogota';
		if (-240 == so && -300 == wo) return 'US/Eastern';
        if (-240 == so && -240 == wo) return 'America/Caracas';
        if (-240 == so && -180 == wo) return 'America/Santiago';
        if (-180 == so && -240 == wo) return 'Canada/Atlantic';
        if (-180 == so && -180 == wo) return 'America/Montevideo';
        if (-180 == so && -120 == wo) return 'America/Sao_Paulo';
        if (-150 == so && -210 == wo) return 'America/St_Johns';
        if (-120 == so && -180 == wo) return 'America/Godthab';
        if (-120 == so && -120 == wo) return 'America/Noronha';
        if (-60 == so && -60 == wo) return 'Atlantic/Cape_Verde';
        if (0 == so && -60 == wo) return 'Atlantic/Azores';
        if (0 == so && 0 == wo) return 'Africa/Casablanca';
        if (60 == so && 0 == wo) return 'Europe/London';
        if (60 == so && 60 == wo) return 'Africa/Algiers';
        if (60 == so && 120 == wo) return 'Africa/Windhoek';
        if (120 == so && 60 == wo) return 'Europe/Amsterdam';
        if (120 == so && 120 == wo) return 'Africa/Harare';
        if (180 == so && 120 == wo) return 'Europe/Athens';
        if (180 == so && 180 == wo) return 'Africa/Nairobi';
        if (240 == so && 180 == wo) return 'Europe/Moscow';
        if (240 == so && 240 == wo) return 'Asia/Dubai';
        if (270 == so && 210 == wo) return 'Asia/Tehran';
        if (270 == so && 270 == wo) return 'Asia/Kabul';
        if (300 == so && 240 == wo) return 'Asia/Baku';
        if (300 == so && 300 == wo) return 'Asia/Karachi';
        if (330 == so && 330 == wo) return 'Asia/Calcutta';
        if (345 == so && 345 == wo) return 'Asia/Katmandu';
        if (360 == so && 300 == wo) return 'Asia/Yekaterinburg';
        if (360 == so && 360 == wo) return 'Asia/Colombo';
        if (390 == so && 390 == wo) return 'Asia/Rangoon';
        if (420 == so && 360 == wo) return 'Asia/Almaty';
        if (420 == so && 420 == wo) return 'Asia/Bangkok';
        if (480 == so && 420 == wo) return 'Asia/Krasnoyarsk';
        if (480 == so && 480 == wo) return 'Australia/Perth';
        if (540 == so && 480 == wo) return 'Asia/Irkutsk';
        if (540 == so && 540 == wo) return 'Asia/Tokyo';
        if (570 == so && 570 == wo) return 'Australia/Darwin';
        if (570 == so && 630 == wo) return 'Australia/Adelaide';
        if (600 == so && 540 == wo) return 'Asia/Yakutsk';
        if (600 == so && 600 == wo) return 'Australia/Brisbane';
        if (600 == so && 660 == wo) return 'Australia/Sydney';
        if (630 == so && 660 == wo) return 'Australia/Lord_Howe';
        if (660 == so && 600 == wo) return 'Asia/Vladivostok';
        if (660 == so && 660 == wo) return 'Pacific/Guadalcanal';
        if (690 == so && 690 == wo) return 'Pacific/Norfolk';
        if (720 == so && 660 == wo) return 'Asia/Magadan';
        if (720 == so && 720 == wo) return 'Pacific/Fiji';
        if (720 == so && 780 == wo) return 'Pacific/Auckland';
        if (765 == so && 825 == wo) return 'Pacific/Chatham';
        if (780 == so && 780 == wo) return 'Pacific/Enderbury';
        if (840 == so && 840 == wo) return 'Pacific/Kiritimati';

        return 'US/Pacific';
		
		
        }

		
		function valform(f) {

			var myform = document.getElementById(f);

			 uTZ = getTimezoneName();
			 //alert(uTZ);
 			 //document.getElementById("aw_TimeZone").value = uTZ;	
			 myform.aw_TimeZone.value = uTZ;					

			//Perform field validation
			if (myform.aw_Name.value == "") {
				 alert("Please enter your name");
				 myform.aw_Name.focus();
				 return (false)
	  		}
		  	
		    var Email  = myform.aw_Email.value;
		
		    if (!isEmail(Email)) {
		       //alert("Please enter a valid email address.");
		       myform.aw_Email.focus();
		       return (false);
			} 		 
	
	 		if (myform.aw_Phone.value == "") {
			   alert("Please enter your phone");
			   myform.aw_Phone.focus();
			   return (false);
			}	
	  		
			if (myform.aw_Phone.value.length < 10) {
				alert("Please enter at least 10 digits for your phone");
				myform.aw_Phone.focus();
				return (false);
			}				
			
			// only allow numbers to be entered
	  		var checkOK = "0123456789-() .+";
	  		var checkStr = myform.aw_Phone.value;
	  		var allValid = true;
	  		var allNum = "";
	  
	  		for (i = 0;  i < checkStr.length;  i++) {
				ch = checkStr.charAt(i);
	
			  for (j = 0;  j < checkOK.length;  j++)
	  			if (ch == checkOK.charAt(j))
	  			break;
		  
	  		    if (j == checkOK.length) {
		    	allValid = false;
		    	break;
		  
		  	}
		  
		  		if (ch != ",")
		    	allNum += ch;
	  		}
		  
	  	  	 if (!allValid) {
		 	 	alert("Please only use numerical characters for your phone");
		 		myform.aw_Phone.focus();
		 		return (false);
	  		 }

			 return (true);
		}		
		
        function OpenNewNormalWindow(fileName,w,h) {
          		   var winl = (screen.width - w) / 2;
             	   var wint = (screen.height - h) / 2;
             	   winprops = 'height='+ h +',width='+ w +',top='+wint+',left='+winl+',resizable=1,directories=no,location=no,menubar=no,scrollbars=1,titlebar=0,status=0,toolbar=no'
           		   window.open(fileName,"", winprops)
        } 
		
		//Count the number of characters left in textboxes 
		function textCounter(field, countfield, maxlimit) {
			if ( field.value.length > maxlimit ) {
    		   field.value = field.value.substring( 0, maxlimit );
			   alert('Textarea value can only be 350 characters in length.');
    		   return false;
  		 	} else {
    	 	  countfield.value = maxlimit - field.value.length;
  			}
		}		  

