	function popGlossary(destination){
	open(destination,"Glossary","width=315,height=360,left=80,top=80,directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resize=no,menubar=no,copyhistory=no")
	}

	function chkEmail(sEmail){
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid        
	if (!reg1.test(sEmail) && reg2.test(sEmail)) { // if syntax is valid
	   return true;	     
	}
	else{
	   return false;   	  	 
	}      
} // chkEmail

function emailCheck (emailStr) {
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	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];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
//			alert("Ths username contains invalid characters.");
			return false;
	  }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
//			alert("Ths domain name contains invalid characters.");
			return false;
	  }
	}
	if (user.match(userPat)==null) {
//		alert("The username doesn't seem to be valid.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
//				alert("Destination IP address is invalid!");
				return false;
	   }
	}
	return true;
	}
	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("The domain name does not seem to be valid.");
			return false;
	   }
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
//		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}
	if (len<2) {
//		alert("This address is missing a hostname!");
		return false;
	}
	return true;
}

function fValidForm(){
	var iForm=document.frmRegister;
	var iErr="";
	
	if(!iForm.Company_Name.value){
		iErr+="Please enter a value for the \"Company Name\" field.\n";
	}
	if(!iForm.Company_URL.value){
		iErr+="Please enter a value for the \"Company URL\" field.\n";
	}
	if(!iForm.Contact_Name.value){
		iErr+="Please enter a value for the \"Your Name\" field.\n";
	}
	if(!iForm.Contact_Position.value){
		iErr+="Please enter a value for the \"Your Position\" field.\n";
	}
	if(!iForm.Contact_Phone.value){
		iErr+="Please enter a value for the \"Contact Phone\" field.\n";
	}
	if(!iForm.Address.value){
		iErr+="Please enter a value for the \"Address\" field.\n";
	}
	if(!iForm.City.value){
		iErr+="Please enter a value for the \"City\" field.\n";
	}

	if(iForm.Country.selectedIndex=="1"){
		if (iForm.State.value == "" || iForm.State.value == "00"){
			iErr+="Please select a value for the \"State\" field.\n";
		}
	}

//	if(iForm.State.selectedIndex==0){
//		iErr+="Please select a value for the \"State\" field.\n";
//	}
	if(iForm.Country.selectedIndex==0){
		iErr+="Please select a value for the \"Country\" field.\n";
	}
	if(iForm.Contact_Email.value){
       if(!emailCheck(iForm.Contact_Email.value)){
	      iErr += "Please enter a correct value for the \"Your Email\" field.\n";
	   }
	}else{
		iErr += "Please enter a value for the \"Your Email\" field.\n";
	}
	if(iErr.length>0){
		alert(iErr);
		return false;
	}else{
		return true;
	}
}

function CheckDate(){
//webtutorial_main.asp
	if(document.DomainSearch.mDomain.value==""){
		alert ("Please enter the domain name\n");
		return false;
	}
}

	function checkdata(){
		var TheForm=document.Add_user;
		var errormsg="";
		if(TheForm.Name.value==""){
			errormsg+="Please enter your name.\n";
		}
		if(TheForm.Email.value==""){
			errormsg+="Please enter your email.\n";
		}else{
			iEmail=TheForm.Email.value;
			iCheckEmail=emailCheck(iEmail)
			if(!iCheckEmail) {
				errormsg += "Please check your email.\n";
			}
		}
		if(errormsg.length>0){
			alert(errormsg);
			return false;
		}
	}

	   function clearName(textInput){
      if (textInput.value == 'Enter Name')
         textInput.value = '';
   }
   function fillName(textInput){
      if (textInput.value == '')
         textInput.value = 'Enter Name';
   }
   function clearEmail(textinput){
      if (textinput.value == 'Enter eMail Address')
         textinput.value = '';
   }
   function fillEmail(textinput){
      if (textinput.value == '')
         textinput.value = 'Enter eMail Address';
   }

	function interview_search() {
		var frm = document.frm_interview_search;
		frm.submit();
	}
	
	function highlighttext(iForm){
		iForm.itxt.focus();
		iForm.itxt.select();
	}
	
		function CheckForm(){
		var TheForm=document.frmSubmit;
		var ErrMsg='';
		if(TheForm.field1.value==""){
			ErrMsg+="\nWeb site title";
		}
		if(TheForm.field2.value==""){
			ErrMsg+="\nDescription";
		}
		if(TheForm.field3.value==""){
			ErrMsg+="\nURL";
		}
		if(TheForm.field4.value==""){
			ErrMsg+="\nEmail";
		}else{
			if(!chkEmail(TheForm.field4.value)){
				ErrMsg+="\nEmail is invalid";
			}
		}
		if(TheForm.field5.value==""){
			ErrMsg+="\nContact name";
		}
		if(TheForm.field6.value==""){
			ErrMsg+="\nLink back to HostSearch";
		}
		if(ErrMsg.length>0){
			alert("Please enter information in the following field(s):\n"+ErrMsg);
			return false;
		}
	}

function ValidFormGlossary(){
	var iForm=document.frmRegister;
	var iErr="";
	
	if(!iForm.iname.value){
		iErr+="Please enter a value for the \"Name\" field.\n";
	}
	if(iForm.email.value){
       if(!chkEmail(iForm.email.value)){
	      iErr += "Please enter a correct value for the \"Email\" field.\n";
	   }
	}else{
		iErr += "Please enter a value for the \"Email\" field.\n";
	}
	if(!iForm.term.value){
		iErr+="Please enter a value for the \"Term or Abbreviation\" field.\n";
	}
	if(iErr.length>0){
		alert(iErr);
		return false;
	}else{
		return true;
	}
}
 
function HostSearch_registration_form_Validator(theForm)
{
var howhear="";
var iproduct=0;

if (theForm.CompanyName.value == ""){
	alert("Please enter a value for the \"Company Name\" field.");
	theForm.CompanyName.focus();
	return (false);
}
													
if (theForm.Address.value == ""){
	alert("Please enter a value for the \"Address\" field.");
	theForm.Address.focus();
	return (false);
}
													
if (theForm.City.value == ""){
	alert("Please enter a value for the \"City\" field.");
	theForm.City.focus();
	return (false);
}

if(theForm.Country.options[theForm.Country.selectedIndex].value==""){
	alert("Please enter a value for the \"Country\" field.");
	theForm.Country.focus();
	return (false);
}else{
	if(theForm.Country.selectedIndex=="1"){
		if (theForm.State.value == "" || theForm.State.value == "00"){
			alert("Please select a state.");
			theForm.State.focus();
			return (false);
		}
	}else{
		if (theForm.State.value != "00") {
			alert("Please select \"Outside USA\.");
			return (false);
		}
	}
}
														
if (theForm.State.value == ""){
	alert("Please enter a value for the \"State\" field.");
	theForm.State.focus();
	return (false);
}
													
if (theForm.Zipcode.value == ""){
	alert("Please enter a value for the \"Zip/Postal Dode\" field.");
	theForm.Zipcode.focus();
	return (false);
}
													
if (theForm.CompanyURL.value == ""){
	alert("Please enter a value for the \"Company URL\" field.");
	theForm.CompanyURL.focus();
	return (false);
}
													
if (theForm.FirstName.value == ""){
	alert("Please enter a value for the \"Your First Name\" field.");
	theForm.FirstName.focus();
	return (false);
}
													
if (theForm.LastName.value == ""){
	alert("Please enter a value for the \"Your Last Name\" field.");
	theForm.LastName.focus();
	return (false);
}
													
if (theForm.Phone.value == ""){
	alert("Please enter a value for the \"Phone\" field.");
	theForm.Phone.focus();
	return (false);
}
													
if (theForm.Email.value == ""){
	alert("Please enter a value for the \"Email\" field.");
	theForm.Email.focus();
	return (false);
}
//if(theForm.budgetper.options[theForm.budgetper.selectedIndex].value==""){
//	alert("Please select your budget period.");
//	theForm.budgetper.focus();
//	return (false);
//}

/* howhear=theForm.howhear.options[theForm.howhear.selectedIndex].value;
if(howhear=="0"){
	if(theForm.howhear_text.value==""){
		alert("Please tell us how do you hear about HostSearch.");
		theForm.howhear.focus();
		return (false);
	}
}else if(((howhear=="Search engine") || (howhear=="Directory") || (howhear=="Magazine") || (howhear=="Banner ad") || (howhear=="Partner web site") || (howhear=="Forum discussion site") || (howhear=="Others")) && (theForm.howhear_text.value=="")){
	alert("Please specify.");
	theForm.howhear_text.focus();
	return (false);
}

*/
return (true);
}



function CheckFormArticle(){
	var TheForm=document.frmArticle;
	var ErrMSG='';
	if(TheForm.iName.value==""){
		ErrMSG+="Please enter Name.\n";
	}
	if(TheForm.iEmail.value==""){
		ErrMSG+="Please enter Email.\n";
	}else{
		if(!chkEmail(TheForm.iEmail.value)){
			ErrMSG+="Your email is invalid.\n";
		}
	}
	if(TheForm.iUrl.value=="" && TheForm.iComment.value==""){
		ErrMSG+="Please enter URL of your recommendation or enter your comment on the counters/trackers above.\n";
	}
	if(ErrMSG.length>0){
		alert(ErrMSG);
		return false;
	}
}
//-->
 
