function checkdom() {
	var sDom = new String(document.srchfoot.dom.value);
	if ((sDom == "") || (sDom.length == 0)) {
		alert("Please enter domain name");
		document.srchfoot.dom.focus();
		return false;
	} else {	
		var aDom = sDom.split("\n");
		for (var i = 0; i < aDom.length ; i++) {//mainstring.indexOf(searchstring));			
			var sErrorMsg = "";
			var sSecTLD = new String(aDom[i].split(".")[0]);
			if (sSecTLD.length < 3 || sSecTLD.length > 62) {
				sErrorMsg = "Domain must be at least 3 characters long and\nat most 62 characters without the TLD (ie. \".com\").";
			} else if (IsNumeric(sSecTLD)) {
				sErrorMsg = "Domain must not be a purely numeric value.";
			} else if (!IsAlphaNumericHyphen(sSecTLD)) {
				sErrorMsg = "Domain must consist only of alphanumeric characters\n(a-z, 0-9) and the hyphen character (-).";
			} else if (InvalidHyphenCheck(sSecTLD)) {
				sErrorMsg = "Domain must not start nor end with hyphen character(-).";
			}
			
			if (sErrorMsg != "") {
				alert(sErrorMsg);
				return false;
				break;
			}
		}
		
		
	}
}

function IsNumeric(str) {
	return (!isNaN(str));
}

function InvalidHyphenCheck(str) {
	var sTemp = new String(str);
	return (sTemp.charAt(0) == "-" || sTemp.charAt(sTemp.length - 1) == "-")
}

function IsAlphaNumericHyphen(str) {
	for(var j=0; j < str.length; j++) {
		var strChar = str.charAt(j);
		var iCharCode = strChar.charCodeAt(0);
		if (!((iCharCode > 47 && iCharCode < 59) || 
			(iCharCode > 64 && iCharCode < 91) || 
			(iCharCode > 96 && iCharCode < 123) || (strChar == "-"))) {
			return false;
		}
	}
	return true;
}

function chk_mem() {
	var strMem = new String(document.login.login_id.value);
	if ((strMem == "") || (strMem.length == 0)) {
		alert("Please enter your user name.");
		document.login.login_id.focus();
		return false;
	} else {
		strMem = new String(document.login.pwd1.value);
		if ((strMem == "") || (strMem.length == 0)) {
			alert("Please enter your password.");
			document.login.pwd1.focus();
			return false;
		}
	}
}

function checkbox1(){
	var iCount = 0;
	var el = eval("document.forms.getav.d");
	var iLength = el.length;
		
	for (c = 0; c < iLength; c++) if (el[c].checked==true) iCount++;
	
	if (document.getav.d.checked==true) iCount++;
	
	if (iCount==0) {
		alert("Please select a domain to register.");
		return false;
	}
}

function checkall(){	

	var k = 0;

	for (var i=0; i< document.memb.elements.length; i++) {
    	if (document.memb.elements[i].name== "dom_id") {
			k += 1;	
		}
	}

	if (k != 0 && k > 1) {
		var el=eval("document.forms.memb.dom_id");
		
		var intC = 0;
	
		for (c=0;c<el.length;c++)
		if (el[c].checked==false) intC++;
		
		if (intC==0) {
			for (c=0;c<el.length;c++)
			el[c].checked=false
		} else {
			for (c=0;c<el.length;c++)
			el[c].checked=true
		}	
	} else {
		if (k != 0 && k==1) {
			if (document.forms.memb.dom_id.checked) {
				document.forms.memb.dom_id.checked = false;
			} else {
				document.forms.memb.dom_id.checked = true;
			}
		}
	}
}

function adminall(){
	var el=eval("document.forms.dom.admin_email");
	var dom=eval("document.forms.dom.domain");
	var r = 0;
	for (d=0;d<dom.length;d++) {
		if ((dom[d].value=="") || (dom[d].value.length==0)) break;
		else r++;
	}
	
	if (r>0) {	
		if ((el[0].value=="") || (el[0].value.length==0)) {
			alert("Please enter an admin email address.");
			document.dom.same_admin.checked=false;
			el[0].focus();	
		} else {
			if ((el[0].value.indexOf("@") == -1) || (el[0].value.indexOf(".") == -1)) {
				alert("Please enter a valid email address.");
				document.dom.same_admin.checked=false;
				el[0].select();
			} else {
				if (document.all.item('same_admin').checked) {
					for (c=1;c<r;c++)
					el[c].value=el[0].value
									
					if (dom[c].value=="") el[c].value=""
					
				} else {					
					for (c=1;c<r;c++)
					el[c].value=""	
				}
			}
		}
	} else {
		alert("Please enter a domain and its corresponding admin email address.");
		document.dom.same_admin.checked=false;
		dom[0].focus();
	}
}

function chk_validate(form1) {
	var strInput=eval("document.forms."+form1+".fname");
	
	if ((strInput.value == null)||(strInput.value.length==0)) {
		alert("Please enter your First Name.");
		strInput.focus();
		return false;
		
	} else {
		return true;
	}
}

function sendForm(action) {
    if (document.images) {
        document.registerForm.action = action;
    }
    return true;
}

function ValData() {

	var strInput = new String(document.mem.fname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter First Name");
		document.mem.fname.focus()
		return false;
	} else {
		if (strInput.length < 2) {
			alert("Please enter full First Name");
			document.mem.fname.select()
			return false;
		} 
	} 
	
	strInput = new String(document.mem.lname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter Last Name");
		document.mem.lname.focus()
		return false;
	} else {
		if (strInput.length < 2) {
			alert("Please enter full Last Name");
			document.mem.lname.select()
			return false;
		} 
	} 

	strInput = new String(document.mem.addr1.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a Street Address");
		document.mem.addr1.focus()
		return false;
	} else {
		if (strInput.length < 2) {
			alert("Please enter a full Street Address");
			document.mem.addr1.select()
			return false;
		} 
	} 
	
	strInput = new String(document.mem.city.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a City");
		document.mem.city.focus()
		return false;
	}

	strInput = new String(document.mem.state.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a State or Province");
		document.mem.state.focus()
		return false;
	} 

	strInput = new String(document.mem.email.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter an E-Mail Address");
		document.mem.email.focus()
		return false;
	} else {
		if ((strInput.indexOf("@") == -1) || (strInput.indexOf(".") == -1)) {
			alert("Please enter a valid E-Mail Address");
			document.mem.email.select()
			return false;
		} 
	}

	strInput = new String(document.mem.phone.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a Phone Number");
		document.mem.phone.focus()
		return false;
	} else {
		if (strInput.length < 7) {
			alert("Please enter a valid Phone Number");
			document.mem.phone.select()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a valid Phone Number");
				document.mem.phone.select()
				return false;
			}
		}
	} 

	strInput = new String(document.mem.fax.value);

	if ((strInput == null) || (strInput.length == 0)) {
	} else {
		if (strInput.length < 7) {
			alert("Please enter a Fax Number");
			document.mem.fax.focus()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a Valid Fax Number");
				document.mem.fax.select()
				return false;
			}
		}
	} 
	
	strInput = new String(document.mem.login_id.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a unique Member ID");
		document.mem.login_id.focus()
		return false;
	} else {
		if (strInput.length <= 1) {
			alert("Please make Member ID more than 3 characters long.");
			document.mem.login_id.select()
			return false;
		} 
	}

	strInput = document.mem.pwd1.value;

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please re-type New Password");
		document.mem.pwd1.focus()
		return false;
	} else {
		var strPass = document.mem.pwd2.value;
		if ((strPass== null) || (strPass.length == 0)) {
			alert("Please re-type New Password");
			document.mem.pwd2.focus()
			return false;
		} else {
			if (strInput == strPass) {
				return true;
			} else {
				alert("Please match New Password Entries");
				document.mem.pwd2.select()
				return false;
			} 
		}
	}
}

function ValDataR() {

	var strInput = "";

	strInput = new String(document.cinfo.compname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter a Registrant Name");
		document.cinfo.compname.focus()
		return false;
	} else {
		if (strInput.length < 1) {
			alert("Please enter full Registrant Name");
			document.cinfo.compname.select()
			return false;
		} 
	} 
	
	strInput = new String(document.cinfo.email.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter E-Mail Address");
		document.cinfo.email.focus()
		return false;
	} else {
		if ((strInput.indexOf("@") == -1) || (strInput.indexOf(".") == -1)) {
			alert("Please enter a valid E-Mail Address");
			document.cinfo.email.select()
			return false;
		} else {
			var i = 0;
			var checknum = 0;
			for (i = 0; i < strInput.length; i++) {
				if (strInput.substring(i, i+1) == "@") checknum++;	
			}
			if (checknum > 1) {
				alert("Please enter only one E-Mail Address");
				document.cinfo.email.select()
				return false;
			}
		}
	}	
	
	strInput = new String(document.cinfo.addr1.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter Street Address");
		document.cinfo.addr1.focus()
		return false;
	} else {
		if (strInput.length < 2) {
			alert("Please enter a valid Street Address");
			document.cinfo.addr1.select()
			return false;
		} 
	} 
	
	strInput = new String(document.cinfo.city.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter City");
		document.cinfo.city.focus()
		return false;
	}
	
	/*

	strInput = new String(document.cinfo.state.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter State or Province");
		document.cinfo.state.focus()
		return false;
	} 

	*/

	strInput = new String(document.cinfo.phone.value);

	if ((strInput == null) || (strInput.length == 0)) {
	/*
		alert("Please enter Phone Number");
		document.cinfo.phone.focus()
		return false;
	*/
	} else {
		if (strInput.length < 7) {
			alert("Please enter a valid Phone Number");
			document.cinfo.phone.select()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a valid Phone Number");
				document.cinfo.phone.select()
				return false;
			}
		}
	} 

	strInput = new String(document.cinfo.fax.value);

	if ((strInput == null) || (strInput.length == 0)) {
		//return confirm("Are you sure you want to proceed with change?");
		return true;
	} else {
		if (strInput.length < 7) {
			alert("Please enter a valid Fax Number");
			document.cinfo.fax.select()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a valid Fax Number");
				document.cinfo.fax.select()
				return false;
			} else {
				//return confirm("Are you sure you want to proceed with change?");
				return true;
			}
		}
	} 
}


function ValData2() {

	var strInput = "";

	strInput = new String(document.cinfo.fname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter First Name");
		document.cinfo.fname.focus()
		return false;
	} else {
		if (strInput.length < 1) {
			alert("Please enter full First Name");
			document.cinfo.fname.select()
			return false;
		} 
	} 
	
	strInput = new String(document.cinfo.lname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter Last Name");
		document.cinfo.lname.focus()
		return false;
	} else {
		if (strInput.length < 1) {
			alert("Please enter full Last Name");
			document.cinfo.lname.select()
			return false;
		} 
	} 

	strInput = new String(document.cinfo.addr1.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter Street Address");
		document.cinfo.addr1.focus()
		return false;
	} else {
		if (strInput.length < 2) {
			alert("Please enter a valid Street Address");
			document.cinfo.addr1.select()
			return false;
		} 
	} 
	
	strInput = new String(document.cinfo.city.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter City");
		document.cinfo.city.focus()
		return false;
	}
	
	/*

	strInput = new String(document.cinfo.state.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter State or Province");
		document.cinfo.state.focus()
		return false;
	} 
	*/

	strInput = new String(document.cinfo.email.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter E-Mail Address");
		document.cinfo.email.focus()
		return false;
	} else {
		if ((strInput.indexOf("@") == -1) || (strInput.indexOf(".") == -1)) {
			alert("Please enter a valid E-Mail Address");
			document.cinfo.email.select()
			return false;
		} else {
			var i = 0;
			var checknum = 0;
			for (i = 0; i < strInput.length; i++) {
				if (strInput.substring(i, i+1) == "@") checknum++;	
			}
			if (checknum > 1) {
				alert("Please enter only one E-Mail Address");
				document.cinfo.email.select()
				return false;
			}
		}
	}
	

	strInput = new String(document.cinfo.phone.value);

	if ((strInput == null) || (strInput.length == 0)) {
	/*
		alert("Please enter Phone Number");
		document.cinfo.phone.focus()
		return false;
	*/
	} else {
		if (strInput.length < 7) {
			alert("Please enter a valid Phone Number");
			document.cinfo.phone.select()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a valid Phone Number");
				document.cinfo.phone.select()
				return false;
			}
		}
	} 

	strInput = new String(document.cinfo.fax.value);

	if ((strInput == null) || (strInput.length == 0)) {
		//return confirm("Are you sure you want to proceed with change?");
		return true;
	} else {
		if (strInput.length < 7) {
			alert("Please enter a valid Fax Number");
			document.cinfo.fax.select()
			return false;
		} else {
			var i;
			var j = strInput.length;
			for (i =0; i <= strInput.length - 1; i++) {
				if (isNaN(strInput.charAt(i))==true) {
					j-=1;
				} 
			} 
			if (j < 7) {
				alert("Please enter a valid Fax Number");
				document.cinfo.fax.select()
				return false;
			} else {
				//return confirm("Are you sure you want to proceed with change?");
				return true;
			}
		}
	} 
}

function chk_dom_ren() {
	var chk_col=eval("document.forms.ren_dom.rdom_id")
	var iCount = 0;
	for (c=0;c<chk_col.length;c++) {
		if (chk_col[c].checked==true) iCount++; 
	}	

	if (iCount==0){
		alert("Please select a domain to renew");
		return false;
	} else {
		return confirm("Are you sure you want to renew registration of selected domains?")
	}
}


function addom() {

	var strInput = new String(document.formaddom.html_text.value);

	if ((strInput == null) || (strInput.length == 0)) {
	} else {
		if (strInput.length > 800) {
			var iCount = strInput.length - 800
			alert("Please shorten the HTML Text by " + iCount + " characters");
			document.formaddom.html_text.select()
			return false;
		}
	} 
}

function isNumeric(string) {
	if (string.search) {
		if ((string.search(/[^\d\s]/) != -1) || (string.search(/\D/) != -1)) return false;
	}
	return true;
}

function valContact() {

	var strInput = "";

	strInput = new String(document.contact1.pname.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter your Name");
		document.contact1.pname.focus()
		return false;
	}
	
	strInput = new String(document.contact1.from.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter an E-Mail Address");
		document.contact1.from.focus()
		return false;
	} else {
		if ((strInput.indexOf("@") == -1) || (strInput.indexOf(".") == -1)) {
			alert("Please enter a valid E-Mail Address");
			document.contact1.from.select()
			return false;
		} 
	}

	strInput = new String(document.contact1.message.value);

	if ((strInput == null) || (strInput.length == 0)) {
		alert("Please enter your Message");
		document.contact1.message.focus()
		return false;
	} else {
		if (strInput.length > 1000) {
			alert("Please make your message brief.");
			document.contact1.message.select()
			return false;
		} else {
			return true;
		}
	} 
}


	function valdns123() {
		var sInput;
		
		alert(document.dns.fwdtype.value);
		
		if (document.dns.fwdtype.value==1) {
		
			sInput = new String(document.dns.htmltext.value);
			var iExcess = eval(800 - sInput.length);
			
			if (sInput.length == 0 || sInput == "") {
				document.dns.htmltext.focus();
				return false;
			} else {
				if (sInput.length > 800) {
					alert("Please shorten Welcome Text by " + iExcess + " characters.");
					document.dns.htmltext.focus();
					document.dns.htmltext.select();
					return false;
				} 
			}
			
		} else { // web forwarding is picked
			sInput = new String(document.dns.url.value);
			if (sInput == "" || sInput.length == 0 || sInput == "http://") {
				alert("Please enter an Url.");
				document.dns.url.focus();
				return false;
			} else {
				return true;
			}
		}
	} 
	
	
	
function isNumber (s) {
    if (s == "") {
		return false;
	} else if (s.search(/^\$?\.?\d{1,3}(,?\d{3})*(\.\d{1,2})?$/) == -1) {
         return false;
    }
    return true;
}