//<!--
function validfield() 
{
 var myoption = false;
   for (i=0; i<document.nhform.interest.length; i++) {
     if (document.nhform.interest[i].checked == true) { myoption = true; } 
   } 
 if (myoption == false){ alert("Please select Trade Show Alliance, Micro-site or Trade Show Listing."); document.nhform.interest[0].focus(); return false; }
 
 
	if (document.nhform.showname.value == "") { alert ("Please enter the Show Name."); document.nhform.showname.focus();	return false; }			
	//dates
	//date1
	var inputday = document.nhform.showday.value;		
	if (inputday == "") { alert ("Please enter the show\'s Opening Date (DD)."); document.nhform.showday.focus(); return false; }			
	if (inputday != "") {
	   for (var i = 0; i < inputday.length; i++){      
			var d = inputday.substring(i, i + 1);      
			if (d < "0" || "9" < d) { alert("Please enter only numbers for Show Dates.");         
			document.nhform.showday.focus();
			return false; }      
		}  	
	} 	
	var monthindx = document.nhform.showmonth.options.selectedIndex;
	var month = document.nhform.showmonth.options[monthindx].value;
	if (month == "") { alert ("Please select the Month the show starts in."); document.nhform.showmonth.focus(); return false; }		
	var yearindx = document.nhform.showyear.options.selectedIndex;
	var yearr = document.nhform.showyear.options[yearindx].value;
	if (yearr == "") { alert ("Please select the Year the show starts in."); document.nhform.showyear.focus(); return false; }			
	//date1
	//to
	//date2
	var inputday2 = document.nhform.showday2.value;	
	if (inputday2 == "") { alert ("Please enter the show\'s Closing Date (DD)."); document.nhform.showday2.focus(); return false; }			
	if (inputday2 != "") {
	   for (var i = 0; i < inputday2.length; i++){      
			var d2 = inputday2.substring(i, i + 1);      
			if (d2 < "0" || "9" < d2) { alert("Please enter only numbers for Show Dates.");         
			document.nhform.showday2.focus();
			return false; }      
		}  	
	} 	
	
	var monthindx2 = document.nhform.showmonth2.options.selectedIndex;
	var month2 = document.nhform.showmonth2.options[monthindx2].value;
	if (month2 == "") { alert ("Please select the Month the show ends in."); document.nhform.showmonth2.focus(); return false; }		
	
	var yearindx2 = document.nhform.showyear2.options.selectedIndex;
	var yearr2 = document.nhform.showyear2.options[yearindx2].value;
	if (yearr2 == "") { alert ("Please select the Year the show ends in."); document.nhform.showyear2.focus(); return false; }			
	//date2
	// end dates
	if (document.nhform.venue.value == "") { alert ("Please enter the show\'s Venue."); document.nhform.venue.focus();	return false; }		
	
	//start year				
	now = new Date();
	currentyear = now.getYear();
	if (currentyear<999) { currentyear += 1900; }		
	var inputyear = document.nhform.year.value;
	var inputyearL = document.nhform.year.value.length;	
	//if (inputyear == "") { alert("Please enter year."); document.nhform.year.focus(); return false; }
	
	if (inputyear != "") {
	   for (var i = 0; i < inputyear.length; i++){      
			var chh2 = inputyear.substring(i, i + 1);      
			if (chh2 < "0" || "9" < chh2) { alert("Please enter only numbers in the Year Established field.");         
			document.nhform.year.focus();
			return false; }      
		}  	
	} 
	if (inputyear > currentyear) { alert("Please check the year entered."); document.nhform.year.focus(); return false; } 	
	if (inputyearL != "") {
		if (inputyearL < 4) { alert("The Year Established field only accepts 4 digits."); document.nhform.year.focus(); return false; } 
	}
	// end year	
	if (document.nhform.location.value == "") { alert ("Please enter the Location of your show (e.g. city, province)."); document.nhform.location.focus(); return false; }		
	if (document.nhform.products.value == "") { alert ("Please enter examples of Main Products exhibited at your show."); document.nhform.products.focus();	return false; }							
	
	//added feb 17 2005 - products field shld be limited to 200char
	if (document.nhform.products.value.length > 200) { alert ("Your Product List field has exceeded the maximum number of characters allowed.\n Please reduce it to 200 characters or less."); document.nhform.products.focus();	return false; }
	
	//Your Details field has exceeded the maximum number of characters allowed. \n Please reduce it to 200 characters or less.
	//Your Mailing address field has exceeded the maximum number of characters allowed. \n Please reduce it to 150 characters or less.
	//Your Comments field has exceeded the maximum number of characters allowed. \n Please reduce it to 200 characters or less.

	
	// showarea / unit of measure	
	var numarea = document.nhform.showarea.value;
	var indxmsr = document.nhform.umeasure.options.selectedIndex;
	var selcmsr = document.nhform.umeasure.options[indxmsr].value;		
	if (numarea != "") { 			
			// numbers only for showarea
		   for (var i = 0; i < numarea.length; i++){      
				var areasub = numarea.substring(i, i + 1);      
				if (areasub < "0" || "9" < areasub) { alert("Please enter only numbers for Total Show Area.");         
				    document.nhform.showarea.focus();document.nhform.showarea.select();	   	   				
					return false; }      
			} 		
			// numbers only for showarea		
			if (selcmsr == "") { alert ("Please select the Unit of Measurement for the Total Show Area."); document.nhform.umeasure.focus();	return false; }
	}			
	
	if ((numarea == "") && (selcmsr != "")) { alert("You have selected an option from Unit of Measure. \nPlease enter value for Total Show Area."); 
	document.nhform.showarea.focus();
	return false; }
	// /showarea / unit of measure
				
	if (document.nhform.organizer.value == "") { alert ("Please enter the name of the show\'s Organizer."); document.nhform.organizer.focus();	return false; }		
	
	//added feb 17 2005 - Details field shld be limited to 200char
	if (document.nhform.details.value.length > 200) { alert ("Your Details field has exceeded the maximum number of characters allowed.\n Please reduce it to 200 characters or less."); document.nhform.details.focus();	return false; }
			
	if (document.nhform.firstname.value == "") { alert ("Please enter your First/Given Name."); document.nhform.firstname.focus();	return false; }		
	if (document.nhform.lastname.value == "") { alert ("Please enter your Last Name."); document.nhform.lastname.focus(); return false; }				
   //start phone nos.
  
	   var tel1 = document.nhform.tel_ctry.value;
	   if (tel1 == "") { alert("Please enter your (TELEPHONE) COUNTRY CODE.");
	   document.nhform.tel_ctry.focus();document.nhform.tel_ctry.select();	   	   
	   return false; }
	   for (var i = 0; i < tel1.length; i++){      
			var telchh = tel1.substring(i, i + 1);      
			if (telchh < "0" || "9" < telchh) { alert("The (TELEPHONE) COUNTRY CODE field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.tel_ctry.focus();document.nhform.tel_ctry.select();	   	   				
				return false; }      
		}    
	   var tel2 = document.nhform.tel_area.value;
	   //if (tel2 == "") { alert("Please enter your (TELEPHONE) AREA CODE.");
	   //document.nhform.tel_area.focus(); document.nhform.tel_area.select();	   	   
	   //return false; }
	   for (var i = 0; i < tel2.length; i++){      
			var telchh2 = tel2.substring(i, i + 1);      
			if (telchh2 < "0" || "9" < telchh2) { alert("The (TELEPHONE) AREA CODE field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.tel_area.focus();document.nhform.tel_area.select();	   				
				return false; }      
		}    		
	   var tel3 = document.nhform.tel_num.value;
	   if (tel3 == "") { alert("Please enter your TELEPHONE NUMBER.");
	   document.nhform.tel_num.focus();document.nhform.tel_num.select();	   	   
	   return false; }
	   for (var i = 0; i < tel3.length; i++){      
	   //new function -- can have space & dash    
                var telchh3=tel3.charAt(i);
                if(i==0 || i==tel3.length-1){ //doesnt allow space OR dash on the 1st and last digit of the entered value
                    if(isNaN(telchh3) || telchh3==' '){
                      alert("Please use only numbers for Tel Number.  However, you may separate the numbers with space or dash.");
                      document.nhform.tel_num.focus();
				      document.nhform.tel_num.select();
				      //document.nhform.tel_num.value = '';
                      return false;
                    }
                }else{
                    if(telchh3==" "){ //doesnt allow space AND dash on the 1st and last digit of the entered value
                    }else if(telchh3=="-"){
                    }else if(telchh3>=0){
                    }else if(telchh3<=9){
                    }else{
                        alert("Please use only numbers for Tel Number.  However, you may separate the numbers with space or dash.");
                        document.nhform.tel_num.focus();
				        document.nhform.tel_num.select();
				        //document.nhform.tel_num.value = '';
                        return false;
                    }
				}
	    //end new function -- can have space & dash  	   
	  	//OLD JS
		/*	var telchh3 = tel3.substring(i, i + 1);      
		if (telchh3 < "0" || "9" < telchh3) { alert("\nThe TELEPHONE field accepts only numbers. \nPlease re-enter a NUMBER.");         
		    document.nhform.tel_num.focus();document.nhform.tel_num.select();	   				
			return false; }    
		*/					  
		// END OLD JS	
		}  //end  for (var i = 0; i < tel3.length; i++){		   
   
   	   var tel4 = document.nhform.tel_ext.value;
	   if (tel4 != "") { 
	   //if (tel4 == "") { alert("Please enter your EXT NUMBER.");
	   //document.nhform.tel_num.focus();document.nhform.tel_num.select();	   	   
	   //return false; }
	   for (var i = 0; i < tel4.length; i++){      
			var telchh4 = tel4.substring(i, i + 1);      
			if (telchh4 < "0" || "9" < telchh4) { alert("\nThe EXTENSION field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.tel_ext.focus();document.nhform.tel_ext.select();	   				
				return false; }      
		 }	 
 	   }
   //end phone nos.
   //start fax nos.
	   var fax1 = document.nhform.fax_ctry.value;
	   if (fax1 == "") { alert("Please enter your (FAX) COUNTRY CODE.");
	   document.nhform.fax_ctry.focus();document.nhform.fax_ctry.select();	   	   
	   return false; }
	   for (var i = 0; i < fax1.length; i++){      
			var faxchh = fax1.substring(i, i + 1);      
			if (faxchh < "0" || "9" < faxchh) { alert("The (FAX) COUNTRY CODE field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.fax_ctry.focus();document.nhform.fax_ctry.select();	   	   				
				return false; }      
		}    
	   var fax2 = document.nhform.fax_area.value;
	   //if (fax2 == "") { alert("Please enter your (FAX) AREA CODE.");
	   //document.nhform.fax_area.focus(); document.nhform.fax_area.select();	   	   
	   //return false; }
	   for (var i = 0; i < fax2.length; i++){      
			var faxchh2 = fax2.substring(i, i + 1);      
			if (faxchh2 < "0" || "9" < faxchh2) { alert("The (FAX) AREA CODE field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.fax_area.focus();document.nhform.fax_area.select();	   				
				return false; }      
		}    		
	   var fax3 = document.nhform.fax_num.value;
	   if (fax3 == "") { alert("Please enter your FAX NUMBER.");
	   document.nhform.fax_num.focus();document.nhform.fax_num.select();	   	   
	   return false; }
	   for (var i = 0; i < fax3.length; i++){      
	   //new function -- can have space & dash    
                var faxchh3=fax3.charAt(i);
                if(i==0 || i==fax3.length-1){ //doesnt allow space OR dash on the 1st and last digit of the entered value
                    if(isNaN(faxchh3) || faxchh3==' '){
                      alert("Please use only numbers for Fax Number.  However, you may separate the numbers with space or dash.");
                      document.nhform.fax_num.focus();
				      document.nhform.fax_num.select();
				      //document.nhform.fax_num.value = '';
                      return false;
                    }
                }else{
                    if(faxchh3==" "){ //doesnt allow space AND dash on the 1st and last digit of the entered value
                    }else if(faxchh3=="-"){
                    }else if(faxchh3>=0){
                    }else if(faxchh3<=9){
                    }else{
                        alert("Please use only numbers for Fax Number.  However, you may separate the numbers with space or dash.");
                        document.nhform.fax_num.focus();
				        document.nhform.fax_num.select();
				        //document.nhform.fax_num.value = '';
                        return false;
                    }
				}
	   //end new function -- can have space & dash    	   
	   //OLD JS
		/*	var faxchh3 = fax3.substring(i, i + 1);      
			if (faxchh3 < "0" || "9" < faxchh3) { alert("\nThe FAX field accepts only numbers. \nPlease re-enter a NUMBER.");         
			    document.nhform.fax_num.focus();document.nhform.fax_num.select();	   				
				return false; }      
		*/		
	   //END OLD JS					
	   				
		} //end  for (var i = 0; i < fax3.length; i++){   		   
   // end fax nos.		
   
    //email	
	if (document.nhform.usermail.value == "") { alert ("Please fill in the E-mail field"); document.nhform.usermail.focus(); return false; }	   
	//if ((document.nhform.usermail.value.indexOf ('@') == -1) || (document.nhform.usermail.value.indexOf ('.') == -1)) {
   	if ((document.nhform.usermail.value.indexOf ('@', 2) == -1) || (document.nhform.usermail.value.indexOf ('.', 4) == -1)) {	
      	alert('Please enter a valid E-mail Address (e.g yourname@yourcompany.com).');  
        document.nhform.usermail.focus(); document.nhform.usermail.select();
		return false; } 	   
   // an at sign (@) that at least the third character and a period (.) that is at least the fifth character 
   
	//added feb 17,2005 - multiple e-mail address is not accepted - more than 1 @ sign isnt accepted
	var email = document.nhform.usermail.value;
	var index = email.indexOf("@");
	index = email.indexOf("@",index+1);
	
	//added comma,semicolon validation
	indexcomma = email.indexOf(",");
	indexsemicolon = email.indexOf(";");	
	//added comma,semicolon validation
		
	//if(index !=-1){
	if((index !=-1) || (indexcomma > 0 )|| (indexsemicolon> 0 )){
		alert("Please enter only one E-mail Address.");
		document.nhform.usermail.focus();
		return false;
	}		
		
	//end email			
	
	
	//added feb 17 2005 - Mailing address field shld be limited to 150char, Comments field = 200chars
	if (document.nhform.mailadd.value.length > 150) { alert ("Your Mailing address field has exceeded the maximum number of characters allowed.\n Please reduce it to 150 characters or less."); document.nhform.mailadd.focus(); return false; }
	if (document.nhform.comments.value.length > 200) { alert ("Your Comments field has exceeded the maximum number of characters allowed.\n Please reduce it to 200 characters or less."); document.nhform.comments.focus(); return false; }		
	//Your Comments field has exceeded the maximum number of characters allowed. \n Please reduce it to 200 characters or less.		
	
 return true;
}

 
//-->