function doSelectDisable(str){
	doCountWord();
	var oForm = document.FrontPage_Form1;
	if(str==1){
		oForm.fmonth.disabled=true;
		oForm.fyear.disabled=true;
		oForm.tmonth.disabled=true;
		oForm.tyear.disabled=true;
		oForm.smonth.disabled=false;
		oForm.syear.disabled=false;
	}
	else {
		oForm.smonth.disabled=true;
		oForm.syear.disabled=true;
		oForm.fmonth.disabled=false;
		oForm.fyear.disabled=false;
		oForm.tmonth.disabled=false;
		oForm.tyear.disabled=false;
	}
}
	
	
	function popExplain(destination){
	open(destination,"ReviewExplanations","width=500,height=450,left=80,top=80,directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resize=no,menubar=no,copyhistory=no")
	}

function popup(destination,iWidth,iHeight){
	window.open(destination,"","width="+(iWidth+40)+",height="+(iHeight+91)+",directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resize=no,menubar=no,copyhistory=no");

}

function pop(destination)
{open(destination,"pop","width=319,height=200,directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resize=no,menubar=no,copyhistory=no")
}

	
		function FrontPage_Form1_Validator(theForm)	{
			var PlanCheck=0;
			if(theForm.Msg.value==""){
				alert("Please specify your review.");
				theForm.Msg.focus();
				return (false);
			}else if(theForm.Msg.value!=""){
				iMsg=theForm.Msg.value;
				if(iMsg.length>255){
					alert("Please limit your Review to 255 characters Max.");
					theForm.Msg.focus();
					return (false);
				}
			}
			if (theForm.Review_Name.value == ""){
				alert("Please enter a value for the \"Your name\" field.");
				theForm.Review_Name.focus();
				return (false);
			}
			if (theForm.Review_Email.value == ""){
				alert("Please enter a value for the \"Your email\" field.");
				theForm.Review_Email.focus();
				return (false);
			}else{
				iemail=theForm.Review_Email.value;
				if (!emailCheck(iemail)){
					alert("Please check you Email Address again.");
					theForm.Review_Email.focus();
					return (false);
				}
			}
			if (theForm.DomainName.value == ""){
				alert("Please complete the \"Your domain hosted with this provider\" field.");
				theForm.DomainName.focus();
				return (false);
			}
			if((!theForm.smonth.disabled) && (theForm.smonth.value=="")){
				alert("Please select the Month of service.");
				theForm.smonth.focus();
				return (false);
			}
			if((!theForm.syear.disabled) && (theForm.syear.value=="")){
				alert("Please select the Year of service.");
				theForm.syear.focus();
				return (false);
			}
			if((!theForm.fmonth.disabled) && (theForm.fmonth.value=="")){
				alert("Please select the Month of service.");
				theForm.fmonth.focus();
				return (false);
			}
			if((!theForm.fyear.disabled) && (theForm.fyear.value=="")){
				alert("Please select the Year of service.");
				theForm.fyear.focus();
				return (false);
			}
			if((!theForm.tmonth.disabled) && (theForm.tmonth.value=="")){
				alert("Please select the Month of service.");
				theForm.tmonth.focus();
				return (false);
			}
			if((!theForm.tyear.disabled) && (theForm.tyear.value=="")){
				alert("Please select the Year of service.");
				theForm.tyear.focus();
				return (false);
			}
//			if(theForm.fmonth.options[theForm.fmonth.selectedIndex].value=="" || theForm.fyear.options[theForm.fyear.selectedIndex].value=="" || theForm.tmonth.options[theForm.tmonth.selectedIndex].value=="" || theForm.tyear.options[theForm.tyear.selectedIndex].value==""){
//				alert("Please specify \"Services used during\" field.");
//				theForm.fmonth.focus();
//				return (false);
//			}
//			if(theForm.PlanCount.value!=0){
//				if(theForm.PlanCount.value>1){
//					for(i=0;i<theForm.PlanCount.value;i++){
//						if(eval("theForm.ServiceID["+i+"].checked")){
//							PlanCheck++;
//						}
//					}
//				}else{
//					if(theForm.ServiceID.checked){
//						PlanCheck++;
//					}	
//				}
//				if(PlanCheck==0){
//					if(theForm.ServiceOther.value==""){
//						alert("Please specify \"Plan name\" field.");
//						theForm.ServiceOther.focus();
//						return (false);
//					}
//				}
//			}
			return (true);
		}

		function Del(Word) {
		a = Word.indexOf("<");
		b = Word.indexOf(">");
		len = Word.length;
		c = Word.substring(0, a);
		if(b == -1)
		b = a;
		d = Word.substring((b + 1), len);
		Word = c + d;
		tagCheck = Word.indexOf("<");
		if(tagCheck != -1)
		Word = Del(Word);
		return Word;
		}		

function enforcechar(what,limit){
if (what.value.length>=limit)
return false
}

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 doCountWord(){
	var intCountTemp = document.FrontPage_Form1.Msg.value.length;
	var strLimit = 255;
	if(intCountTemp<=strLimit){
		document.getElementById("txtWordCound").innerHTML=strLimit - intCountTemp;
	}
	else{
		document.FrontPage_Form1.Msg.value = document.FrontPage_Form1.Msg.value.substring(0,strLimit);
		alert("Please limit your Review to 255 characters Max.");
		document.FrontPage_Form1.Msg.focus();
		return (false);
	}
	
}


function doReviewVote(review_id,vote){
	//alert(review_id+'/'+company_code+'/'+vote);
	$("#div_ReviewVoteResult_"+review_id).html('<div align="center"><img src="/images/ajax-loader.gif"></div>');
	$("#div_ReviewVoteResult_"+review_id).load('/includehtml/inc_review_vote_result.asp?review_id='+review_id+'&vote='+vote);
}

