function trim(str) {
	str = str.replace(/^\s+/, '');
	for (var i = str.length - 1; i >= 0; i--) {
		if (/\S/.test(str.charAt(i))) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return str;
}

function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// note that this function is the same as the one above, but is called specifically
// in obj40 for resellers ONLY
function MM_obj40_jumpMenu(targ,selObj,restore)
{
	urlString = selObj.options[selObj.selectedIndex].value;
	if (urlString.search("manage-hosting") != -1)
	{
		window.open(selObj.options[selObj.selectedIndex].value);
	}
	else
	{
  		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  		if (restore) selObj.selectedIndex=0;
	}
}

//----------------------------------------------------------
// GENERIC POPUP SCRIPT WITH scroll,width,height PARAMETERS
//----------------------------------------------------------
function popup(url, name, width, height, scroll)
{

// screen resolution
var scrheight = screen.availHeight;
var scrwidth = screen.availWidth;

// where to position the window
var toppos = scrheight * 0.1;
var leftpos = scrwidth * 0.1;

// create the window command
command = "aWindow=window.open('" + url + "', '" + name +"', 'width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",toolbar=no,menubar=no,top=10,left=10,screenX=10,screenY=10,resizable')";
// execute the command
eval(command);

}

function confirmer0(message) {
	if (confirm (message+'\nClick OK to continue OR cancel to reconsider...')){
		return true;
	} // end if
	else {
		return false;
	} // end else
}

function confirmer() {
	if (confirm ('Do you Really want to delete this item? \nClick OK to continue OR cancel to reconsider...')){
		return true;
	} // end if
	else {
		return false;
	} // end else
}

function confirmernotlive() {
	if (confirm ('Do you Really want to MARK THIS ORDER AS NOT LIVE?\nAre you sure?\nClick OK to continue OR cancel to reconsider...')){
		return true;
	} // end if
	else {
		return false;
	} // end else
}

function selectorChecker(fieldname,message){
	var selectfield = eval("document.selector."+fieldname+".value");
	if (selectfield=="#"){
		alert("You must select a "+message+". \nPlease try again.");
		eval("document.selector."+fieldname+".focus()");
		return false;
	}
}

function is_empty(fieldvalue,fieldname,errmessage,formname){
	if (fieldvalue==""){
		alert("You must enter a "+errmessage+".\nPlease try again.");
		eval("document."+formname+"."+fieldname+".focus()");
		return false;
	}
}

function check_dropdown(fieldvalue,fieldname,errmessage,formname){
	if (fieldvalue=="#"){
		alert("You must select a "+errmessage+".\nPlease try again.");
		eval("document."+formname+"."+fieldname+".focus()");
		return false;
	}
	return true;
}

function checkForNumberDot(variable){
	var result = "";
	if(variable != "")
	{
		var dot = /\./;
		var dotsposition = variable.search(dot);

		var thelength = variable.length;
		// - reject them if empty field . . .
		if(thelength == 0 || (thelength==1 && dotsposition!=-1))
		{
			result = "false";
		}
		x = 0;
		while(x < thelength)
		{
			// - the current digit . . .
			currentdig = variable.charAt(x);
			if((currentdig >= "0") && (currentdig <= "9") || (currentdig == " ") || (currentdig=="." && dotsposition==x))
			{
				x++;
			}
			else
			{
				result = "false";
				x = thelength;
			}
		} // - end while
	} else {
		result = "false";
	}
	return result;
} // end checkForNumber function

function checkForNumber(variable){
	var result = "";
	if(variable != "")
	{
		var thelength = variable.length;
		// - reject them if empty field . . .
		if(thelength == 0)
		{
			result = "false";
		}
		x = 0;
		while(x < thelength)
		{
			// - the current digit . . .
			currentdig = variable.charAt(x);
			//if((currentdig >= "0") && (currentdig <= "9") || (currentdig == " "))
			if((currentdig >= "0") && (currentdig <= "9"))
			{
				x++;
			}
			else
			{
				result = "false";
				x = thelength;
			}
		} // - end while
	} else {
		result = "false";
	}
	return result;
} // end checkForNumber function

function checkPHPtags(text)
{
	var filters = new Array(/<\?/g,/\?>/g);

	var element,tester;
	for (var i = 0; i < filters.length; i++)
	{
		element = filters[i];
		tester = element.test(text);
		if (tester == true)
		{
			return false;
		}
	}
	return true;
}

function nospaces_cntchars(stringvar,numchar0,numchar1){
	// deletes any spaces in stringvar and
	// checks that length is between numchar0 and numchar1
	var result;
	do {
		stringvar = stringvar.replace(/\s/,"");
	} while (stringvar.search(/\s/)!=-1);
	if (stringvar.length>=numchar0 && stringvar.length<=numchar1){
		stringvar = stringvar.toUpperCase();
		result = stringvar;
	} else {
		result = "false";
	}
	return result;
}

function checkPhone(ccvalue,pvalue,ccfield,pfield,form) {
	if (ccvalue!="" && pvalue==""){
		alert("You must enter a number here.\nPlease try again.");
		eval("document."+form+"."+pfield+".focus()");
		return false;
	}
	if (ccvalue=="" && pvalue!=""){
		alert("You must enter a number here.\nPlease try again.");
		eval("document."+form+"."+ccfield+".focus()");
		return false;
	}
	if (ccvalue!="" && pvalue!=""){
		var space = /\s/g;
		ccvalue = ccvalue.replace(space,"");
		eval("document."+form+"."+ccfield+".value=ccvalue");
		result = checkForNumber(ccvalue);
		if (result == "false"){
			alert("You must enter a number here\nPlease try again.");
			eval("document."+form+"."+ccfield+".focus()");
			return false;
		}

		pvalue = pvalue.replace(space,"");
		eval("document."+form+"."+pfield+".value=pvalue;");
		result = checkForNumber(pvalue);

		if (result == "false"){
			alert("You must enter a number here\nPlease try again.");
			eval("document."+form+"."+pfield+".focus()");
			return false;
		}
		if (pvalue.length==10 && pvalue.charAt(0)==0){
			eval("document."+form+"."+pfield+".value = pvalue.substring(1)");
		}
		//if (pvalue.length==10 && pvalue.charAt(0)!=0) {
		/*if (pvalue.length==10 && pvalue.charAt(0)>1) {
			alert("The first digit should be 0 or 1.\nPlease try again.");
			eval("document."+form+"."+pfield+".focus()");
			return false;
		}*/
	}
}

/**
 * This function will remove leading and trailing spaces from a given string.
 */
function Trim (stringVar)
{
	var temp = stringVar;

	if (temp == "")
	{
		return temp;
	}

	var obj = /^(\s*)([\W\w]*)(\b\s*$)/;

	if (obj.test(temp))
	{
		temp = temp.replace(obj, '$2');
	}
	else
	{
		/* This is to remove all blank spaces when a field is all blank spaces */
		obj = /(\s)/g;
		var result = temp.match(obj);
		if (result != null && result.length == temp.length)
		{
			temp = temp.replace (/\s/g, "");
		}
	}
	return temp;
}

/**
 * This function trims a list of fields of the same form.
 */
function TrimFields (formName, fieldsArray)
{
	for (var i = 0; i < fieldsArray.length; i ++)
	{

		oldfield = eval ("document."+formName+"."+fieldsArray[i]+".value");
		newfield = Trim(oldfield);
		eval ("document."+formName+"."+fieldsArray[i]+".value = newfield;");
	}
}

function checkIP(a, ipa, dots)
{
	var result = "test";
	if (a == "" && ipa == ""){
		return result;
	}
	if ((a == "" && ipa !="") || (a != "" && ipa ==""))
	{
		result = "wrong";
	} else {
		var space = new RegExp(" ");
		var spacesearch = a.search(space);
		HOSTlength = a.length;
		if (spacesearch != -1){
			if (spacesearch != (HOSTlength-1)) {
				result = "wrong";
			}

		}
		if (dots==1){
			//var dot = new RegExp("\.");
			var dot = /\./;
			var dotsearch = a.search(dot);
			if (dotsearch == -1 && HOSTlength!=0){
				result = "wrong";
			}
		}
	}
	if (result != "wrong" && (a != "" && ipa != "")){
		IPlength = ipa.length;
		var x = 0;
		var dots = 0;
		while(x < IPlength)
		{
			// - the current digit . . .
			currentdig = ipa.charAt(x);
			if(((currentdig >= "0") && (currentdig <= "9")) || (currentdig == "."))
			{
				if (currentdig == "."){
					dots++;
				}
				x++;
			}
			else
			{
				result = "wrongIP";
				break;
//				x = IPlength;
			}

		} // - end while

		// if there aren't any "." return wrongIP
		if (result != "wrongIP"){
			if (dots == 0) {
				result = "wrongIP";
			}
			if (result != "wrongIP"){
				// check that there are not more than 4 dots in the IP address
				if (dots>4 || dots<3){
					result = "wrongIP";
				}
				// check that if there are 4 dots, then there are no other chars after it
				if (dots==4 && ipa.lastIndexOf('.') != (ipa.length-1)){
					result = "wrongIP";
				}
				if (result != "wrongIP"){
					if (ipa.charAt(0) == "."){
						result = "wrongIP";
					}
					if (result != "wrongIP"){
						// divide the string in pieces between each DOT
						i = 0;
						var IP = new Array();
						while (i <= dots){
							IP[i] = "";
							i++
						}
						i = 0;
						x = 0;
						while (x < IPlength) {
							if (ipa.charAt(x) == ".")
							{
								i++
							} else
							{
								IP[i] = IP[i].concat(ipa.charAt(x));
							}
							x++;
						}
						var temp = 1;
						i = 0;
						while (i <= dots){
							temp *= IP[i];
							if (((temp < 0 || temp > 255) && i!=3) || ((temp < 1 || temp > 254) && i==3)){
								result = "wrongIP";
								i = dots;
							}
							temp = 1;
							i++;
						}
					}
				}
			}
		}
	}
	return result;

} // end of checkIP

function checkDomain(domain)
{
	/* this function checks that a domain meets all the rules:
	- between 2 & 63 characters long
	- no hyphen in 3rd and 4th positions
	- only alphanumeric characters and hyphens
	*/
	domain = domain.toLowerCase();

	var domainCheck = 1;
	var reg = /(^[a-z0-9])([a-z0-9\-]{1,62})/g;
	var result = domain.match(reg);
	var type = typeof(result);
	if (!result)
	{
		domainCheck = 0;
	}
	if (domainCheck == 1 && result[0] == domain)
	{
		reg = /\-\-/;
		result = domain.search(reg);
		if (result == 2)
		{
			domainCheck = 0;
		}
	}
	else
	{
		domainCheck = 0;
	}
	if (domainCheck == 0)
	{
		alert("Domain names specifications:\n- can only contain alphanumeric characters (a-z or 0-9) and hyphens (-),\n- must be between 2 and 63 characters long, and \n- must not have two hyphens together in the 3rd and 4th positions.\nPlease try again.");
		return false;
	}
	else
	{
		return true;
	}
}
// START of function to check that a domain name is correct
function checkDomainname(domainname,suffix){
	var domainiswrong = "no";
	var domainlength = domainname.length;
	var space = new RegExp(" ");
	var numspaces = domainname.search(space);
	if (numspaces!=-1 && numspaces!=(domainlength-1)) {
		domainiswrong = "yes";
	}
	var dot = /\./;
	var dotsposition = domainname.search(dot);
//	var dotsposition = domainname.lastIndexOf(dot);
	if (dotsposition==-1 || dotsposition==0 || dotsposition==(domainlength-1)){
		domainiswrong = "yes";
	}
	if (suffix!="" && domainname.substr(domainlength-2)!=suffix){
		domainiswrong = "yes";
	}
	if (domainiswrong=="yes"){
		return "wrong";
	} else {
		return "ok";
	}
}
// END of function to check that a domainname is correct

// START of function to check that a domain name is correct
function checkDomainname0(domainname,suffix){
	var domainiswrong = "no";
	var domainlength = domainname.length;
	var space = new RegExp(" ");
	var numspaces = domainname.search(space);
	if (numspaces!=-1 && numspaces!=(domainlength-1)) {
		domainiswrong = "yes";
	}
	var dot = /\./;
	var dotsposition = domainname.search(dot);
//	var dotsposition = domainname.lastIndexOf(dot);
	if (dotsposition>=0) {
	//if (dotsposition==-1 || dotsposition==0 || dotsposition==(domainlength-1)){
		domainiswrong = "yes";
	}
	if (domainlength<2) {
		domainiswrong = "yes";
	}
	if (domainiswrong=="yes") {
		return "wrong";
	} else {
		return "ok";
	}
}
// END of function to check that a domainname is correct

// START of function to check that an email is correct
function checkEmail(email){
	var emailiswrong = "no";
	var emaillength = email.length;
	var atindex1 = email.indexOf("@");
	var atindex2 = email.indexOf("@",atindex1+1);
//	alert ("@ is "+atindex1+ " and "+atindex2);
	if (atindex1==-1 || (atindex1!=-1 && atindex2!=-1) || atindex1==0 || atindex1==(emaillength-1)){
		emailiswrong = "yes";
	}
	var space = new RegExp(" ");
	var numspaces = email.search(space);
//	alert ("numspaces is "+numspaces);
	if (numspaces!=-1 && numspaces!=(emaillength-1)) {
		emailiswrong = "yes";
	}
	var dot = /\./;
	var dotsposition = email.search(dot);
	if (dotsposition==-1 || dotsposition==0 || dotsposition==(emaillength-1)){
		emailiswrong = "yes";
	}
	if (emailiswrong=="yes"){
		return "wrong";
	} else {
		return "ok";
	}
}
// END of function to check that an email is correct


// 14th Dec 2004 by Jonathan -  had to fix the filter reg expression in this function because the whole .js file
// was been ignored by IE5.2 on MAC due to the Mac IE browser not liking this 1 line.
// As a result all functions in this js file were not been read by IE on the MAC and caused problems on the web pages.
function checkEmailAddress(email)
{
	// This function should replace checkEmail, but it'll be changed as we find
	// where the other one is used
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function sourceandregistryChecker(formname){

	 var name = eval("document."+formname+".name.value");
	 if (name==""){
		alert("You must enter a Name.\nPlease try again.");
		eval("document."+formname+".name.focus()");
		return false;

	 }
}

function staffChecker(formname){
		var userlevel = eval("document."+formname+".userlevel.options[document."+formname+".userlevel.selectedIndex].value");

		if (userlevel=="#"){
			alert("You must select a user level for the staff member.\nPlease try again.");
			eval("document."+formname+".userlevel.focus()");
			return false;
		}
		var fields = new Array("name","username","password");
		var errmess = new Array("Full Name","Username","Password");
		var fieldlength = fields.length;
		var i = 0;
		while (i<fieldlength){
			var currentvar = eval("document."+formname+"."+fields[i]+".value");
			if (currentvar==""){
				alert("You must enter a "+errmess[i]+".\nPlease try again.");
				eval("document."+formname+"."+fields[i]+".focus();");
				return false;
			}
			i = i + 1;
		}
}

function domainnameChecker(){
	var domain = document.domainname.newdomain.value;

	if(domain == "") {
		alert("You must enter a domain name.\nPlease try again.");
		document.domainname.newdomain.focus();
		return false;
	}
	if(domain.length < 2) {
		alert("Domain names must be at least two characters long.\nPlease try again.");
		document.domainname.newdomain.focus();
		return false;
	}
	if (domain.search(" ") != -1){
		alert("A domain name must not contain spaces.\nPlease try again.")
		document.domainname.newdomain.focus();
		return false;
	}
	var dot = /\./;
	var n = domain.search(dot);
	if (n == -1){
		alert("You must enter the suffix of the Domain Name\nPlease try again.")
		document.domainname.newdomain.focus();
		return false;
	}
	if (n > 63){
		alert("A Domain Name can't be longer than 63 characters.\nPlease try again.")
		document.domainname.newdomain.focus();
		return false;
	}
	var onlyalphanum = domain;
	do {
		onlyalphanum = onlyalphanum.replace(dot,"");
	} while (onlyalphanum.search(dot) != -1);
	do {
		onlyalphanum = onlyalphanum.replace(/[-]/,"");
	} while (onlyalphanum.search(/[-]/) != -1);
	var nonallowedchars = onlyalphanum.search(/\W/);
//	alert(nonallowedchars + " - "+onlyalphanum);
	if (nonallowedchars != -1){
		alert("A Domain Name must have only A-Z characters, 0-9 digits and/or \"-\" (hyphen).\nPlease try again.")
		document.domainname.newdomain.focus();
		return false;
	}
}

function ppcDomainnameChecker(domain)
{
		
	if (domain.substring(0, 4) == "www.")
	{
		domain = domain.substring(4);
		getElemById('domainname').value = domain;
	}
	else if (domain.substring(0, 7) == "http://")
	{
		domain = domain.substring(7);
		getElemById('domainname').value = domain;
	}
	
	if(domain.length < 2) {
		alert("Domain names must be at least two characters long.\nPlease try again.");
		document.PPCOrder.domainname.focus();
		return false;
	}
	if (domain.search(" ") != -1){
		alert("A domain name must not contain spaces.\nPlease try again.")
		document.PPCOrder.domainname.focus();
		return false;
	}
	var dot = /\./;
	var n = domain.search(dot);
	if (n == -1){
		alert("You must enter the suffix of the Domain Name\nPlease try again.")
		document.PPCOrder.domainname.focus();
		return false;
	}
	if (n > 63){
		alert("A Domain Name can't be longer than 63 characters.\nPlease try again.")
		document.PPCOrder.domainname.focus();
		return false;
	}
	var onlyalphanum = domain;
	do {
		onlyalphanum = onlyalphanum.replace(dot,"");
	} while (onlyalphanum.search(dot) != -1);
	do {
		onlyalphanum = onlyalphanum.replace(/[-]/,"");
	} while (onlyalphanum.search(/[-]/) != -1);
	var nonallowedchars = onlyalphanum.search(/\W/);
	if (nonallowedchars != -1){
		alert("A Domain Name must have only A-Z characters, 0-9 digits and/or \"-\" (hyphen).\nPlease try again.")
		document.PPCOrder.domainname.focus();
		return false;
	}
}

// this function is to check domain registration form from ordering system (public website)
function domainregChecker(){
	var domain = document.domainname.domain.value;
	document.domainname.domain.value = domain.toLowerCase();

	if (!checkDomain(domain))
	{
		return false;
	}
	document.domainname.comau.checked = true;
	document.domainname.comau.value = "yes";
}

function setDefaultNS(formName,prim,primip,sec1,sec1ip,sec2,sec2ip,sec3,sec3ip)
{
	if (document[formName].primaryns) {
		eval("document."+formName+".primaryns.value = '"+prim+"';");
		eval("document."+formName+".primarynsip.value = '"+primip+"';");
		eval("document."+formName+".secondaryns1.value = '"+sec1+"';");
		eval("document."+formName+".secondaryns1ip.value = '"+sec1ip+"';");
		eval("document."+formName+".secondaryns2.value = '"+sec2+"';");
		eval("document."+formName+".secondaryns2ip.value = '"+sec2ip+"';");
		eval("document."+formName+".secondaryns3.value = '"+sec3+"';");
		eval("document."+formName+".secondaryns3ip.value = '"+sec3ip+"';");
	}
	else {
		eval("document."+formName+".ns1.value = '"+prim+"';");
		eval("document."+formName+".ns1ip.value = '"+primip+"';");
		eval("document."+formName+".ns2.value = '"+sec1+"';");
		eval("document."+formName+".ns2ip.value = '"+sec1ip+"';");
		eval("document."+formName+".ns3.value = '"+sec2+"';");
		eval("document."+formName+".ns3ip.value = '"+sec2ip+"';");
		eval("document."+formName+".ns4.value = '"+sec3+"';");
		eval("document."+formName+".ns4ip.value = '"+sec3ip+"';");
	}
	return;
}

function setTPPservers(manageclientid,prim,primip,sec1,sec1ip,sec2,sec2ip,sec3,sec3ip)
{

	if (sec2 == "no")
	{
		sec2 = "";
		sec2ip = "";
	}
	if (sec3 == "no")
	{
		sec3 = "";
		sec3ip = "";
	}
	setDefaultNS("nameservers",prim,primip,sec1,sec1ip,sec2,sec2ip,sec3,sec3ip);

	alert("Please click 'Update Name Servers' to delegate domain name!");

}

function nameserversChecker() {
	var primaryns = document.nameservers.primaryns.value.toLowerCase();
	var primarynsip = document.nameservers.primarynsip.value;
	var secondaryns1 = document.nameservers.secondaryns1.value.toLowerCase();
	var secondaryns1ip = document.nameservers.secondaryns1ip.value;
	var secondaryns2 = document.nameservers.secondaryns2.value.toLowerCase();
	var secondaryns2ip = document.nameservers.secondaryns2ip.value;
	var secondaryns3 = document.nameservers.secondaryns3.value.toLowerCase();
	var secondaryns3ip = document.nameservers.secondaryns3ip.value;
	if (primaryns=="" && primarynsip==""){
		alert("You must enter a Primary Name Server\n Please try again.")
		document.nameservers.primarynsip.focus();
		return false;
	}
	result = checkIP(primaryns,primarynsip,1);
	if (result == "wrong")
	{
		alert("You must enter a correct IP Address AND Server Name for the Primary Server\nPlease try again.");
		document.nameservers.primaryns.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.nameservers.primarynsip.focus();
		return false;
	}
	if (secondaryns1=="" && secondaryns1ip==""){
		alert("You must enter a Secondary Name Server 1\n Please try again.")
		document.nameservers.secondaryns1ip.focus();
		return false;
	}
	result = checkIP(secondaryns1,secondaryns1ip,1);
	if (result == "wrong")
	{
		alert("You must enter a correct IP Address AND Server Name for the Secondary Server 1\nPlease try again.");
		document.nameservers.secondaryns1.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.nameservers.secondaryns1ip.focus();
		return false;
	}

	if (primaryns == secondaryns1)
	{
		alert ("You've typed the same server for primary and secondary 1.\nPlease try again.");
		document.nameservers.secondaryns1.focus();
		return false;
	}

	result = checkIP(secondaryns2,secondaryns2ip,1);
	if (result == "wrong")
	{
		alert("You must enter a correct IP Address AND Server Name for the Secondary Server 2\nPlease try again.");
		document.nameservers.secondaryns2.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.nameservers.secondaryns2ip.focus();
		return false;
	}

	result = checkIP(secondaryns3,secondaryns3ip,1);
	if (result == "wrong")
	{
		alert("You must enter a correct IP Address AND Server Name for the Secondary Server 3\nPlease try again.");
		document.nameservers.secondaryns3.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.nameservers.secondaryns3ip.focus();
		return false;
	}

	if (primaryns != "")
	{
		document.nameservers.primaryns.value = primaryns;
	}
	if (secondaryns1 != "")
	{
		document.nameservers.secondaryns1.value = secondaryns1;
	}
	if (secondaryns2 != "")
	{
		document.nameservers.secondaryns2.value = secondaryns2;
	}
	if (secondaryns3 != "")
	{
		document.nameservers.secondaryns3.value = secondaryns3;
	}
}

function ArecordsChecker()
{
	var ipa1 = document.Arecords.ipa1.value;
	var a2 = document.Arecords.a2.value;
	var ipa2 = document.Arecords.ipa2.value;
	var a3 = document.Arecords.a3.value;
	var ipa3 = document.Arecords.ipa3.value;
	var a4 = document.Arecords.a4.value;
	var ipa4 = document.Arecords.ipa4.value;
	var a5 = document.Arecords.a5.value;
	var ipa5 = document.Arecords.ipa5.value;
	var a6 = document.Arecords.a6.value;
	var ipa6 = document.Arecords.ipa6.value;
	var a7 = document.Arecords.a7.value;
	var ipa7 = document.Arecords.ipa7.value;
	var a8 = document.Arecords.a8.value;
	var ipa8 = document.Arecords.ipa8.value;
	var a9 = document.Arecords.a9.value;
	var ipa9 = document.Arecords.ipa9.value;
	var a10 = document.Arecords.a10.value;
	var ipa10 = document.Arecords.ipa10.value;
	var result = "";

	if(ipa1 == "")
	{
		alert("You must enter an IP address for the hostless record\nPlease try again.")
		document.Arecords.ipa1.focus();
		return false;
	}

	result = checkIP("hostless",ipa1,0);
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa1.focus();
		return false;
	}

	result = checkIP(a2,ipa2,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 2\nPlease try again.");
		document.Arecords.a2.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa2.focus();
		return false;
	}

	result = checkIP(a3,ipa3,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 3\nPlease try again.");
		document.Arecords.a3.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa3.focus();
		return false;
	}

	result = checkIP(a4,ipa4,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 4\nPlease try again.");
		document.Arecords.a4.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa4.focus();
		return false;
	}

	result = checkIP(a5,ipa5,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 5\nPlease try again.");
		document.Arecords.a5.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa5.focus();
		return false;
	}

	result = checkIP(a6,ipa6,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 6\nPlease try again.");
		document.Arecords.a6.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa6.focus();
		return false;
	}

	result = checkIP(a7,ipa7,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 7\nPlease try again.");
		document.Arecords.a7.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa7.focus();
		return false;
	}

	result = checkIP(a8,ipa8,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 8\nPlease try again.");
		document.Arecords.a8.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa8.focus();
		return false;
	}

	result = checkIP(a9,ipa9,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 9\nPlease try again.");
		document.Arecords.a9.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa9.focus();
		return false;
	}

	result = checkIP(a10,ipa10,0);
	if (result == "wrong")
	{
		alert("You must enter an IP Address OR Host Name for the record 10\nPlease try again.");
		document.Arecords.a10.focus();
		return false;
	}
	if(result == "wrongIP")
	{
		alert("You must enter a valid IP Address here.");
		document.Arecords.ipa10.focus();
		return false;
	}
	document.Arecords.a2.value = document.Arecords.a2.value.toLowerCase();
	document.Arecords.a3.value = document.Arecords.a3.value.toLowerCase();
	document.Arecords.a4.value = document.Arecords.a4.value.toLowerCase();
	document.Arecords.a5.value = document.Arecords.a5.value.toLowerCase();
	document.Arecords.a6.value = document.Arecords.a6.value.toLowerCase();
	document.Arecords.a7.value = document.Arecords.a7.value.toLowerCase();
	document.Arecords.a8.value = document.Arecords.a8.value.toLowerCase();
	document.Arecords.a9.value = document.Arecords.a9.value.toLowerCase();
	document.Arecords.a10.value = document.Arecords.a10.value.toLowerCase();
} // end checker

function MXrecordsChecker()
{
	var mxvalue1 = document.MXrecords.mxvalue1.value;
	var mxserver1 = document.MXrecords.mxserver1.value;
	var mxvalue2 = document.MXrecords.mxvalue2.value;
	var mxserver2 = document.MXrecords.mxserver2.value;
	var result = "";

	if (mxvalue1 == "" && mxserver1 == "") {
		result = "";
	} else {
		result = checkForNumber(mxvalue1);
		if (result == "false"){
			alert("You must enter a number here\nPlease try again.")
			document.MXrecords.mxvalue1.focus();
			return false;
		}
		result = checkIP("twoplums.com.au",mxserver1,0);
		if (result == "wrongIP" || result == "wrong")
		{
			result = checkIP(mxserver1,"203.203.203.203",1);
			if(result == "wrong") {
				alert("You must enter an IP Address OR Host Name for the "+mxvalue1+" MX record\nPlease try again.");
				document.MXrecords.mxserver1.focus();
				return false;
			}
		}
	}
	if (mxvalue2 == "" && mxserver2 == ""){
		result = "";
	} else {
		result = checkForNumber(mxvalue2);
		if (result == "false"){
			alert("You must enter a number here\nPlease try again.")
			document.MXrecords.mxvalue2.focus();
			return false;
		}

		result = checkIP("twoplums.com.au",mxserver2,0);
		if (result == "wrongIP" || result == "wrong")
		{
			result = checkIP(mxserver2,"203.203.203.203",1);
			if(result == "wrong") {
				alert("You must enter an IP Address OR Host Name for the "+mxvalue2+" MX record\nPlease try again.");
				document.MXrecords.mxserver2.focus();
				return false;
			}
		}
	}
	document.MXrecords.mxserver1.value = document.MXrecords.mxserver1.value.toLowerCase();
	document.MXrecords.mxserver2.value = document.MXrecords.mxserver2.value.toLowerCase();
} // end MXrecordschecker


function emailforwardChecker(formname) {
	var alias = eval("document."+formname+".alias.value");
	var eforwardto = eval("document."+formname+".eforwardto.value");
	var aliasiswrong = "no";
	var eforwardtoiswrong = "no";
	if (alias==""){
		aliasiswrong = "yes";
	}
	var space = new RegExp(" ");
	var numspaces = alias.search(space);
	var aliaslength = alias.length;
	if (numspaces!=-1 && numspaces!=(aliaslength-1)) {
		aliasiswrong = "yes";
	}
	if (aliasiswrong=="yes"){
		alert("You must enter an alias.\nPlease try again.");
		eval("document."+formname+".alias.focus()");
		return false;
	}
	var eforwardtolength = eforwardto.length;
	var atindex1 = eforwardto.indexOf("@");
	var atindex2 = eforwardto.indexOf("@",atindex1+1);
//	alert ("@ is "+atindex1+ " and "+atindex2);
	if (atindex1==-1 || (atindex1!=-1 && atindex2!=-1) || atindex1==0 || atindex1==(eforwardtolength-1)){
		eforwardtoiswrong = "yes";
	}
	numspaces = eforwardto.search(space);
//	alert ("numspaces is "+numspaces);
	if (numspaces!=-1 && numspaces!=(eforwardtolength-1)) {
		eforwardtoiswrong = "yes";
	}
	var dot = /\./;
	dotsposition = eforwardto.search(dot);
	if (dotsposition==-1 || dotsposition==0 || dotsposition==(eforwardtolength-1)){
		eforwardtoiswrong = "yes";
	}
	if (eforwardtoiswrong=="yes"){
		alert("You must enter an Email Address here.\nPlease try again.");
		eval("document."+formname+".eforwardto.focus()");
		return false;
	}
	eval("document."+formname+".alias.value = document."+formname+".alias.value.toLowerCase()");
	eval("document."+formname+".eforwardto.value = document."+formname+".eforwardto.value.toLowerCase()");
	if (eval("document."+formname+".active.checked")==true) {
		eval("document."+formname+".active.value='t'");
	} else { eval("document."+formname+".active.value='f'"); }
	if (eval("document."+formname+".del.checked")==true) {
		eval("document."+formname+".del.value='t'");
	} else { eval("document."+formname+".del.value='f'"); }
}
/*
function paymentdetailsChecker() {
	var paymenttype = document.paymentdetails.paymenttype.value;
	var creditcard = document.paymentdetails.creditcard.value;
	if (paymenttype=="#"){
		alert("You must select a type of payment.\nPlease try again.");
		document.paymentdetails.paymenttype.focus();
		return false;
	}
	if (paymenttype=="1"){
		if (creditcard=="#"){
			alert("You must select a Credit Card.\nPlease try again.");
			document.paymentdetails.creditcard.focus();
			return false;
		}
		var fields = new Array("ccnumber","ccexpirydate","ccname");
		var errmess = new Array("Credit Card Number","Credit Card Expiry Date","Credit Card Name");
		var fieldlength = fields.length;
		var i = 0;
		while (i<fieldlength){
			var currentvar = eval("document.paymentdetails."+fields[i]+".value");
			if (currentvar==""){
				alert("You must enter a "+errmess[i]+".\nPlease try again.");
				eval("document.paymentdetails."+fields[i]+".focus();");
				return false;
			}
			i = i + 1;
		}
	}
}
*/
function contactnicChecker() {

	/* Here we remove leading and trailing spaces for all these fields */
	var FieldsToTrim = new Array ("company", "fname", "lname", "email", "address1", "address2", "suburb", "postcode", "state", "abn", "acn", "rbn");
	TrimFields ("contactnic", FieldsToTrim);

	var nicsource = document.contactnic.nicsource.value;
	var idau = document.contactnic.idau.value;
	var company = document.contactnic.company.value;
	var type = document.contactnic.type.value;
	var fields = new Array("fname","lname","address1","suburb","postcode","state");
	var errmess = new Array("First Name","Last Name","Address1","Suburb","Postcode","State");
	var email = document.contactnic.email.value;
	var ccphone = document.contactnic.ccphone.value;
	var phone = document.contactnic.phone.value;
	var ccfax = document.contactnic.ccfax.value;
	var fax = document.contactnic.fax.value;
	var abn = document.contactnic.abn.value;
	var acn = document.contactnic.acn.value;
	var rbn = document.contactnic.rbn.value;
	var rbnstate = document.contactnic.rbnstate.value;
	var country = document.contactnic.country.value;

	if (nicsource=="#"){
		alert("You must select a NIC Source.\nPlease try again.");
		document.contactnic.nicsource.focus();
		return false;
	}

	if (checkPhone(ccphone, phone, "ccphone", "phone","contactnic") == false)
	{
		return false;
	}
	if (checkPhone(ccfax, fax, "ccfax", "fax","contactnic") == false)
	{
		return false;
	}

	if (type=="R" && nicsource=="1" && idau!="yes" && company==""){
		alert("You must enter a Company Name.\nPlease try again.");
		document.contactnic.company.focus();
		return false;
	}
	if (email==""){
		alert("You must enter an email address.\nPlease try again.");
		document.contactnic.email.focus();
		return false;
	} else {
		var emailresult = checkEmail(email);
		if (emailresult == "wrong"){
			alert("You must enter a valid Email Address here.\nPlease try again.");
			document.contactnic.email.focus();
			return false;
		}
	}
	var fieldlength = fields.length;
	var i = 0;
	while (i<fieldlength){
		var currentvar = eval("document.contactnic."+fields[i]+".value");
		if (currentvar==""){
			alert("You must enter a "+errmess[i]+".\nPlease try again.");
			eval("document.contactnic."+fields[i]+".focus();");
			return false;
		}
		i = i + 1;
	}
	if (country=="#"){
		alert("You must select a Country.\nPlease try again.");
		document.contactnic.country.focus();
		return false;
	}

	/*
	//We don't need to check for ABN, ACN or RBN from this form as the business ID
	//must have already been entered when the registration order for this domain was entered
	if (idau!="yes" && nicsource=="1" && type=="R" && abn=="" && acn=="" && rbn=="" && rbnstate=="#"){
		alert("You must enter ABN, ACN or RBN.\nPlease try again.");
		document.contactnic.abn.focus();
		return false;
	}
	*/
	var res;
	if (abn!=""){
		// delete spaces & check number of characters
		res = nospaces_cntchars(abn,6,11);
		if (res=="false"){
			alert("The ABN should have between 6 and 11 characters.\nPlease try again.");
			document.contactnic.abn.focus();
			return false;
		} else {
			document.contactnic.abn.value = res;
		}
	}
	if (acn!=""){
		// delete spaces & check number of characters
		res = nospaces_cntchars(acn,6,9);
		if (res=="false"){
			alert("The ACN should have between 6 and 9 characters.\nPlease try again.");
			document.contactnic.acn.focus();
			return false;
		} else {
			document.contactnic.acn.value = res;
		}
	}
	if (nicsource=="1" && type=="R" && rbn!=""){
		// delete spaces & check number of characters
		res = nospaces_cntchars(rbn,2,20);
		if (res=="false"){
			alert("The RBN should have between 2 and 20 characters.\nPlease try again.");
			document.contactnic.rbn.focus();
			return false;
		} else {
			document.contactnic.rbn.value = res;
		}
		if (check_dropdown(rbnstate,"rbnstate","RBN State","contactnic")==false){
			return false;
		}
	}

	if (nicsource=="1" && type=="R" && (abn=="" && acn=="" && rbn=="" && rbnstate!="#"))
	{
		alert("As you have selected an RBN state you must enter an RBN.\nPlease try again.");
		document.contactnic.rbn.focus();
		return false;
	}

}

function transfers() {
	var contact = document.transfer.contact.value;
	var phone = document.transfer.phone.value;
	var email = document.transfer.email.value;
	var multiple = document.transfer.multiple.value;
	var single = document.transfer.single.value;

	if (contact==""){
		alert("You must enter a contact name.\nPlease try again.");
		document.transfer.contact.focus();
		return false;
	}

	if (phone==""){
		alert("You must enter a contact phone number.\nPlease try again.");
		document.transfer.phone.focus();
		return false;
	}

	if (email==""){
		alert("You must enter a valid email address.\nPlease try again.");
		document.transfer.email.focus();
		return false;
	}

	if (multiple=="" && single==""){
		alert("You must enter either a single domain or multiple domains in the listed areas.\nPlease try again.");
		document.transfer.single.focus();
		return false;
	}

}

function regreferencesChecker() {
	var reference = document.regreferences.reference.value;
	var comment = document.regreferences.comment.value;
	if (reference==""){
		alert("You must enter a Reference.\nPlease try again.");
		document.regreferences.reference.focus();
		return false;
	}
	if (comment==""){
		alert("You must enter a Comment.\nPlease try again.");
		document.regreferences.comment.focus();
		return false;
	}
}

function autransfers() {
//function transfersChecker(au){
	var organisation = document.transfer.organisation.value;
	var orgcontact = document.transfer.orgcontact.value;
	var orgemail = document.transfer.orgemail.value;
	var domorg = document.transfer.domorg.value;
	var domfname = document.transfer.domfname.value;
	var domsurname = document.transfer.domsurname.value;
	var ccdomphone = document.transfer.ccdomphone.value;
	var domphone = document.transfer.domphone.value;
	var domemail = document.transfer.domemail.value;
	var domaddress1 = document.transfer.domaddress1.value;
	var domsuburb = document.transfer.domsuburb.value;
	var domstate = document.transfer.domstate.value;
	var dompostcode = document.transfer.dompostcode.value;
	var domcountry = document.transfer.domcountry.value;
	var domainname = document.transfer.domainname.value;
	var password = document.transfer.password.value;

	if (organisation==""){
		alert("You must enter your organisation company name.\nPlease try again.");
		document.transfer.organisation.focus();
		return false;
	}

	if (orgcontact==""){
		alert("You must enter your name.\nPlease try again.");
		document.transfer.orgcontact.focus();
		return false;
	}
	var emailresult = checkEmail(orgemail);
	if (emailresult == "wrong"){
		alert("You must enter the requester email address.\nPlease try again.");
		document.transfer.orgemail.focus();
		return false;
	}

	if (domfname==""){
		alert("You must enter the domain holders first name.\nPlease try again.");
		document.transfer.domfname.focus();
		return false;
	}

	if (domsurname==""){
		alert("You must enter the domain holders surname.\nPlease try again.");
		document.transfer.domsurname.focus();
		return false;
	}
	if (domphone==""){
		alert("You must enter the domain holders phone number.\nPlease try again.");
		document.transfer.domphone.focus();
		return false;
	}
	if (checkPhone(ccdomphone,domphone,"ccdomphone","domphone","transfer")==false){
		return false;
	}
	var emailresult = checkEmail(domemail);
	if (emailresult == "wrong"){
		alert("You must enter the domain holders email address.\nPlease try again.");
		document.transfer.domemail.focus();
		return false;
	}
	if (domaddress1==""){
		alert("You must enter the domain holders address.\nPlease try again.");
		document.transfer.domaddress1.focus();
		return false;
	}
	if (domsuburb==""){
		alert("You must enter the domain holders suburb.\nPlease try again.");
		document.transfer.domsuburb.focus();
		return false;
	}
	if (domstate==""){
		alert("You must enter the domain holders state.\nPlease try again.");
		document.transfer.domstate.focus();
		return false;
	}

	if (dompostcode==""){
		alert("You must enter the domain holders postcode.\nPlease try again.");
		document.transfer.dompostcode.focus();
		return false;
	}
	if (domcountry=="#"){
		alert("You must enter the domain holders country origin.\nPlease try again.");
		document.transfer.domcountry.focus();
		return false;
	}
	var domainresult = checkDomainname(domainname,"au");
	if (domainresult == "wrong"){
		alert("You must enter a correct .au domain name.\nPlease try again.");
		document.transfer.domainname.focus();
		return false;
	}
/*	if (domainname==""){
		alert("You must enter a domain to transfer.\nPlease try again.");
		document.transfer.domainname.focus();
		return false;
	} else {

	}*/
	if (password==""){
// 	if (password=="" && au=="yes") {
		alert("You must enter the domain registry key.\nPlease try again.");
		document.transfer.password.focus();
		return false;
	}
}

function transferReqChecker() {

	/* This is to trim leading and trailing spaces from the fields listed in the FieldsToTrim array */
	var FieldsToTrim = new Array ("organisation", "orgcontact", "orgemail", "domorg", "domfname", "domsurname", "domemail", "domaddress1", "domaddress2", "domsuburb", "domstate", "dompostcode", "tdomorg", "tdomfname", "tdomsurname", "tdomemail", "tdomaddress1", "tdomaddress2", "tdomsuburb", "tdomstate", "tdompostcode");
	TrimFields ("transfer", FieldsToTrim);

	var organisation = document.transfer.organisation.value;
	var orgcontact = document.transfer.orgcontact.value;
	var orgemail = document.transfer.orgemail.value;
	var domorg = document.transfer.domorg.value;
	var domfname = document.transfer.domfname.value;
	var domsurname = document.transfer.domsurname.value;
	var ccdomphone = document.transfer.ccdomphone.value;
	var domphone = document.transfer.domphone.value;
	var domemail = document.transfer.domemail.value;
	var domaddress1 = document.transfer.domaddress1.value;
	var domsuburb = document.transfer.domsuburb.value;
	var domstate = document.transfer.domstate.value;
	var dompostcode = document.transfer.dompostcode.value;
	var domcountry = document.transfer.domcountry.value;
	var domainname = document.transfer.domainname.value;
	var tdomorg = document.transfer.tdomorg.value;
	var tdomfname = document.transfer.tdomfname.value;
	var tdomsurname = document.transfer.tdomsurname.value;
	var cctdomphone = document.transfer.cctdomphone.value;
	var tdomphone = document.transfer.tdomphone.value;
	var tdomemail = document.transfer.tdomemail.value;
	var tdomaddress1 = document.transfer.tdomaddress1.value;
	var tdomsuburb = document.transfer.tdomsuburb.value;
	var tdomstate = document.transfer.tdomstate.value;
	var tdompostcode = document.transfer.tdompostcode.value;
	var tdomcountry = document.transfer.tdomcountry.value;

	if (organisation==""){
		alert("You must enter your organisation company name.\nPlease try again.");
		document.transfer.organisation.focus();
		return false;
	}

	if (orgcontact==""){
		alert("You must enter your name.\nPlease try again.");
		document.transfer.orgcontact.focus();
		return false;
	}
	var emailresult = checkEmail(orgemail);
	if (emailresult == "wrong"){
		alert("You must enter the requester email address.\nPlease try again.");
		document.transfer.orgemail.focus();
		return false;
	}
	if (domfname==""){
		alert("You must enter the domain holders first name.\nPlease try again.");
		document.transfer.domfname.focus();
		return false;
	}
	if (domsurname==""){
		alert("You must enter the domain holders surname.\nPlease try again.");
		document.transfer.domsurname.focus();
		return false;
	}
	if (domphone=="" && ccdomphone==""){
		alert("You must enter the domain holders phone number.\nPlease try again.");
		document.transfer.ccdomphone.focus();
		return false;
	} else {
		if (checkPhone(ccdomphone,domphone,"ccdomphone","domphone","transfer")==false){
			return false;
		}
	}
	var emailresult = checkEmail(domemail);
	if (emailresult == "wrong"){
		alert("You must enter the domain holders email address.\nPlease try again.");
		document.transfer.domemail.focus();
		return false;
	}
	if (domaddress1==""){
		alert("You must enter the domain holders address.\nPlease try again.");
		document.transfer.domaddress1.focus();
		return false;
	}
	if (domsuburb==""){
		alert("You must enter the domain holders suburb.\nPlease try again.");
		document.transfer.domsuburb.focus();
		return false;
	}
	if (dompostcode==""){
		alert("You must enter the domain holders postcode.\nPlease try again.");
		document.transfer.dompostcode.focus();
		return false;
	}
	if (domstate==""){
		alert("You must enter the domain holders State/Province.\nPlease try again.");
		document.transfer.domstate.focus();
		return false;
	}
	if (domcountry=="#"){
		alert("You must enter the domain holders country origin.\nPlease try again.");
		document.transfer.domcountry.focus();
		return false;
	}

	if (tdomorg!="" || tdomfname!="" || tdomsurname!="" || tccdomphone!="" || tdomphone!="" || tdomemail!="" || tdomaddress1!="" || tdomsuburb!="" || tdompostcode!="" || tdomstate!=""){
		if (tdomfname==""){
			alert("You must enter the technical contact first name.\nPlease try again.");
			document.transfer.tdomfname.focus();
			return false;
		}
		if (tdomsurname==""){
			alert("You must enter the technical contact surname.\nPlease try again.");
			document.transfer.tdomsurname.focus();
			return false;
		}
		if (tdomphone=="" && cctdomphone=="") {
			alert("You must enter a phone number here.\nPlease try again.");
			document.transfer.cctdomphone.focus();
			return false;
		}
		if (tdomphone!="" || cctdomphone!=""){
			if (checkPhone(cctdomphone,tdomphone,"cctdomphone","tdomphone","transfer")==false){
				return false;
			}
		}
		emailresult = checkEmail(tdomemail);
		if (emailresult == "wrong"){
			alert("You must enter the technical contact email address.\nPlease try again.");
			document.transfer.tdomemail.focus();
			return false;
		}
		if (tdomaddress1==""){
			alert("You must enter the technical contact address.\nPlease try again.");
			document.transfer.tdomaddress1.focus();
			return false;
		}
		if (tdomsuburb==""){
			alert("You must enter the technical contact suburb.\nPlease try again.");
			document.transfer.tdomsuburb.focus();
			return false;
		}
		if (tdompostcode==""){
			alert("You must enter the technical contact postcode.\nPlease try again.");
			document.transfer.tdompostcode.focus();
			return false;
		}
		if (tdomstate==""){
			alert("You must enter the technical contact State/Province.\nPlease try again.");
			document.transfer.tdomstate.focus();
			return false;
		}
		if (tdomcountry=="#"){
			alert("You must enter the technical contact country.\nPlease try again.");
			document.transfer.tdomcountry.focus();
			return false;
		}
	}

}

function domainCategoryChecker(formname) {
	var category = eval("document."+formname+".category.value");
	var description = eval("document."+formname+".description.value");
	if (category==""){
		alert("You must enter a Category Name.\nPlease try again.");
		eval("document."+formname+".category.focus()");
		return false;
	}
	if (description==""){
		alert("You must enter a Description.\nPlease try again.");
		eval("document."+formname+".description.focus()");
		return false;
	}
}



function clientLoginChecker(formname) {
	var username = eval("document."+formname+".username.value");
	var password = eval("document."+formname+".password.value");
	if (username==""){
		alert("You must enter a Username.\nPlease try again.");
		eval("document."+formname+".username.focus()");
		return false;
	}
	if (password==""){
		alert("You must enter a Password.\nPlease try again.");
		eval("document."+formname+".password.focus()");
		return false;
	}
}

function transactionChecker(){
	var price = document.transaction.price.value;
	if (checkForNumberDot(price)=="false"){
		alert ("You must enter a number here.\nPlease try again");
		document.transaction.price.focus();
		return false;
	}
}

function mailboxChecker(formname){
	var alias = eval("document."+formname+".alias.value");
	var username = eval("document."+formname+".username.value");
	var password = eval("document."+formname+".password.value");
	if (is_empty(alias,"alias","Alias",formname)==false){
		return false;
	}
	if (username!="" && password==""){
		alert("You must enter a Password.\nPlease try again");
		eval("document."+formname+".password.focus()");
		return false;
	}
	if (username=="" && password!=""){
		alert("You must enter a Username.\nPlease try again");
		eval("document."+formname+".username.focus()");
		return false;
	}
}

function emaildomlistChecker(){
	var email = document.emaildomainslist.emailreport.value;
	var emailiswrong = "no";
	var emaillength = email.length;
	var atindex1 = email.indexOf("@");
	var atindex2 = email.indexOf("@",atindex1+1);
//	alert ("@ is "+atindex1+ " and "+atindex2);
	if (atindex1==-1 || (atindex1!=-1 && atindex2!=-1) || atindex1==0 || atindex1==(emaillength-1)){
		emailiswrong = "yes";
	}
	var space = new RegExp(" ");
	var numspaces = email.search(space);
//	alert ("numspaces is "+numspaces);
	if (numspaces!=-1 && numspaces!=(emaillength-1)) {
		emailiswrong = "yes";
	}
	var dot = /\./;
	var dotsposition = email.search(dot);
	if (dotsposition==-1 || dotsposition==0 || dotsposition==(emaillength-1)){
		emailiswrong = "yes";
	}
	if (emailiswrong=="yes"){
		alert("You must enter an Email Address here.\nPlease try again.");
		eval("document.emaildomainslist.emailreport.focus()");
		return false;
	}
}

function domainsearchChecker(){
	var searchdomain = document.domainsearch.searchdomain.value;
	if (searchdomain==""){
		alert("You must enter a Domain Name here.\nPlease try again.");
		document.domainsearch.searchdomain.focus();
		return false;
	}
}

function aupoliciesChecker() {
	var registranttypeid = document.aupolicies.registranttypeid.value;
	var registrantid = document.aupolicies.registrantid.value;
	var eligibilitytypeid = document.aupolicies.eligibilitytypeid.value;
	var eligibilityid = document.aupolicies.eligibilityid.value;
	var lenregistrantid;
	var wrong="";
	if (registranttypeid=="1") { //abn
		lenregistrantid = registrantid.length;
		if (lenregistrantid<6 || lenregistrantid>11) {
			wrong = "ABN";
		}
	}
	if (registranttypeid=="2") { //acn
		lenregistrantid = registrantid.length;
		if (lenregistrantid<6 || lenregistrantid>9) {
			wrong = "ACN";
		}
	}
	if (registranttypeid>2) { //other
		lenregistrantid = registrantid.length;
		if (lenregistrantid<2 || lenregistrantid>20) {
			wrong = "Registrant ID";
		}
	}
	if (wrong!=""){
		alert ("The "+wrong+" is not correct.\nPlease try again.");
		document.aupolicies.registrantid.focus();
		return false;
	}
	document.aupolicies.registrantid.value = registrantid.toUpperCase();
	if (registrantid!="" && registranttypeid=="#"){
		alert ("You must select an ID type.\nPlease try again.");
		document.aupolicies.registranttypeid.focus();
		return false;
	}
	wrong="";
	if (eligibilitytypeid=="1") { //abn
		lenregistrantid = eligibilityid.length;
		if (lenregistrantid<6 || lenregistrantid>11) {
			wrong = "ABN";
		}
	}
	if (eligibilitytypeid=="2") { //acn
		lenregistrantid = eligibilityid.length;
		if (lenregistrantid<6 || lenregistrantid>9) {
			wrong = "ACN";
		}
	}
	if (eligibilitytypeid>2) { //other
		lenregistrantid = eligibilityid.length;
		if (lenregistrantid<2 || lenregistrantid>20) {
			wrong = "Registrant ID";
		}
	}
	if (wrong!=""){
		alert ("The "+wrong+" is not correct.\nPlease try again.");
		document.aupolicies.eligibilityid.focus();
		return false;
	}
	document.aupolicies.eligibilityid.value = eligibilityid.toUpperCase();
	if (eligibilityid!="" && eligibilitytypeid=="#"){
		alert ("You must select an ID type.\nPlease try again.");
		document.aupolicies.eligibilitytypeid.focus();
		return false;
	}
}

function emailtoclientChecker() {
	var recipient = document.emailtoclient.recipient.value;
	var subject = document.emailtoclient.subject.value;
	if (recipient==""){
		alert("You must enter an email address.\nPlease try again.");
		document.emailtoclient.recipient.focus();
		return false;
	} else {
		var emailresult = checkEmail(recipient);
		if (emailresult == "wrong"){
			alert("You must enter a valid Email Address here.\nPlease try again.");
			document.emailtoclient.recipient.focus();
			return false;
		}
	}
	if (subject==""){
		alert("You must enter a subject.\nPlease try again.");
		document.emailtoclient.subject.focus();
		return false;
	}
}

function selectdomainChecker() {
	if (document.selectdomain.termsandconditions.checked==false){
		alert("Please read the Terms and Conditions before proceeding.");
		document.selectdomain.termsandconditions.focus();
		return false;
	}
}

function orderregandcontactsChecker() {
	var registryid = document.orderregandcontacts.registryid.value;
	var idau = document.orderregandcontacts.idau.value;
	var manageclientid = document.orderregandcontacts.manageclientid.value;
	var num_nics_result = document.orderregandcontacts.num_nics_result.value;
	var orgasnau = document.orderregandcontacts.orgasnau.value;

	var r_fname = document.orderregandcontacts.r_fname.value;
	var r_lname = document.orderregandcontacts.r_lname.value;
	var r_company = document.orderregandcontacts.r_company.value;
	var r_email = document.orderregandcontacts.r_email.value;
	var r_ccphone = document.orderregandcontacts.r_ccphone.value;
	var r_phone = document.orderregandcontacts.r_phone.value;
	var r_ccfax = document.orderregandcontacts.r_ccfax.value;
	var r_fax = document.orderregandcontacts.r_fax.value;
	var r_address1 = document.orderregandcontacts.r_address1.value;
	var r_address2 = document.orderregandcontacts.r_address2.value;
	var r_suburb = document.orderregandcontacts.r_suburb.value;
	var r_postcode = document.orderregandcontacts.r_postcode.value;
	var r_state = document.orderregandcontacts.r_state.value;
	var r_country = document.orderregandcontacts.r_country.value;
	if (registryid=="1" && idau!="yes"){
		var registrantidtype = document.orderregandcontacts.r_registrantidtype.value;
		var registrantid = document.orderregandcontacts.r_registrantid.value;
	}

	if (is_empty(r_fname,"r_fname","Name","orderregandcontacts")==false){
		return false;
	}
	if (is_empty(r_lname,"r_lname","Last Name","orderregandcontacts")==false){
		return false;
	}
	if (manageclientid=="" && idau!="yes" && r_company=="") {
		alert("You must enter a Company Name\nPlease try again.");
		document.orderregandcontacts.r_company.focus();
		return false;
	}
	if (idau=="yes" && manageclientid=="" && r_company==""){
		document.orderregandcontacts.r_company.value = r_fname+" "+r_lname;
	}
	var emailresult = checkEmail(r_email);
	if (emailresult == "wrong"){
		alert("You must enter a valid Email Address here.\nPlease try again.");
		document.orderregandcontacts.r_email.focus();
		return false;
	}
	if (r_ccphone=="" && r_phone==""){
		alert("You must enter a Phone number here.\nPlease try again.");
		document.orderregandcontacts.r_ccphone.focus();
		return false;
	}
	if (checkPhone(r_ccphone,r_phone,"r_ccphone","r_phone","orderregandcontacts")==false){
		return false;
	}
	if (checkPhone(r_ccfax,r_fax,"r_ccfax","r_fax","orderregandcontacts")==false){
		return false;
	}
	if (is_empty(r_address1,"r_address1","Street Address","orderregandcontacts")==false){
		return false;
	}
	if (is_empty(r_suburb,"r_suburb","Suburb","orderregandcontacts")==false){
		return false;
	}
	if (is_empty(r_postcode,"r_postcode","Postcode","orderregandcontacts")==false){
		return false;
	}
	if (is_empty(r_state,"r_state","State","orderregandcontacts")==false){
		return false;
	}
	if (check_dropdown(r_country,"r_country","Country","orderregandcontacts")==false){
		return false;
	}
	if (registryid=="1" && idau!="yes"){
		if (check_dropdown(registrantidtype,"r_registrantidtype","Type of ID","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(registrantid,"r_registrantid","Registrant ID","orderregandcontacts")==false){
			return false;
		}
		var idlength = registrantid.length;
		if (registrantidtype==1 && (idlength<6 || idlength>11)){
			alert("An ABN should have between 6 and 11 characters.\nPlease try again.");
			document.orderregandcontacts.r_registrantid.focus();
			return false;
		}
		if (registrantidtype==2 && (idlength<6 || idlength>9)){
			alert("An ACN should have between 6 and 9 characters.\nPlease try again.");
			document.orderregandcontacts.r_registrantid.focus();
			return false;
		}
		if (registrantidtype>2 && (idlength<2 || idlength>20)){
			alert("The ID should have between 2 and 20 characters.\nPlease try again.");
			document.orderregandcontacts.r_registrantid.focus();
			return false;
		}
		document.orderregandcontacts.r_registrantid.value = registrantid.toUpperCase();
	}

	if (orgasnau == "yes")
	{
		if (document.orderregandcontacts.orgasndeclaration.checked == false)
		{
			alert("You can not preceed without checking non-commercial organisation warrant checkbox! Please try again!");
			document.orderregandcontacts.orgasndeclaration.focus();
			return false;
		}
	}

	var tc_fname = document.orderregandcontacts.tc_fname.value;
	var tc_lname = document.orderregandcontacts.tc_lname.value;
	var tc_company = document.orderregandcontacts.tc_company.value;
	var tc_email = document.orderregandcontacts.tc_email.value;
	var tc_ccphone = document.orderregandcontacts.tc_ccphone.value;
	var tc_phone = document.orderregandcontacts.tc_phone.value;
	var tc_ccfax = document.orderregandcontacts.tc_ccfax.value;
	var tc_fax = document.orderregandcontacts.tc_fax.value;
	var tc_address1 = document.orderregandcontacts.tc_address1.value;
	var tc_address2 = document.orderregandcontacts.tc_address2.value;
	var tc_suburb = document.orderregandcontacts.tc_suburb.value;
	var tc_postcode = document.orderregandcontacts.tc_postcode.value;
	var tc_state = document.orderregandcontacts.tc_state.value;
	var tc_country = document.orderregandcontacts.tc_country.value;
	var checktech = "no";
	if (registryid!="1" && registryid!="12"){
		if (tc_fname!="" || tc_lname!="" || tc_company!="" || tc_email!="" || tc_ccphone!="" || tc_phone!="" || tc_ccfax!="" || tc_fax!="" || tc_address1!="" || tc_address2!="" || tc_suburb!="" || tc_postcode!="" || tc_state!=""){
			checktech = "yes";
		}
	} else {
		checktech = "yes";
	}
	if (manageclientid!="" && num_nics_result>0 && (registryid=="1" || registryid=="12")) {
		if (document.orderregandcontacts.nictech.value=="#"){
			checktech = "yes";
		} else {
			checktech = "no";
		}
	}
//alert ("checktech is "+checktech);
	if (checktech=="yes"){
		// check technical contact
		if (is_empty(tc_fname,"tc_fname","Name","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(tc_lname,"tc_lname","Last Name","orderregandcontacts")==false){
			return false;
		}
		var emailresult = checkEmail(tc_email);
		if (emailresult == "wrong"){
			alert("You must enter a valid Email Address here.\nPlease try again.");
			document.orderregandcontacts.tc_email.focus();
			return false;
		}
		if (tc_ccphone=="" && tc_phone==""){
			alert("You must enter a Phone Number here.\nPlease try again.");
			document.orderregandcontacts.tc_ccphone.focus();
			return false;
		}
		if (checkPhone(tc_ccphone,tc_phone,"tc_ccphone","tc_phone","orderregandcontacts")==false){
			return false;
		}
		if (checkPhone(tc_ccfax,tc_fax,"tc_ccfax","tc_fax","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(tc_address1,"tc_address1","Street Address","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(tc_suburb,"tc_suburb","Suburb","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(tc_postcode,"tc_postcode","Postcode","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(tc_state,"tc_state","State","orderregandcontacts")==false){
			return false;
		}
		if (check_dropdown(tc_country,"tc_country","Country","orderregandcontacts")==false){
			return false;
		}

	}
	// to check billing contact
	var bc_fname = document.orderregandcontacts.bc_fname.value;
	var bc_lname = document.orderregandcontacts.bc_lname.value;
	var bc_company = document.orderregandcontacts.bc_company.value;
	var bc_email = document.orderregandcontacts.bc_email.value;
	var bc_ccphone = document.orderregandcontacts.bc_ccphone.value;
	var bc_phone = document.orderregandcontacts.bc_phone.value;
	var bc_ccfax = document.orderregandcontacts.bc_ccfax.value;
	var bc_fax = document.orderregandcontacts.bc_fax.value;
	var bc_address1 = document.orderregandcontacts.bc_address1.value;
	var bc_address2 = document.orderregandcontacts.bc_address2.value;
	var bc_suburb = document.orderregandcontacts.bc_suburb.value;
	var bc_postcode = document.orderregandcontacts.bc_postcode.value;
	var bc_state = document.orderregandcontacts.bc_state.value;
	var bc_country = document.orderregandcontacts.bc_country.value;
	var checkbill = "no";
	if (bc_fname!="" || bc_lname!="" || bc_company!="" || bc_email!="" || bc_ccphone!="" || bc_phone!="" || bc_ccfax!="" || bc_fax!="" || bc_address1!="" || bc_address2!="" || bc_suburb!="" || bc_postcode!="" || bc_state!=""){
		checkbill = "yes";
	}
	if (manageclientid!="" && num_nics_result>0 && document.orderregandcontacts.nicbill.value!="#") {
		checkbill = "no";
	}
	if (checkbill=="yes"){
		// check billing contact
		if (is_empty(bc_fname,"bc_fname","Name","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(bc_lname,"bc_lname","Last Name","orderregandcontacts")==false){
			return false;
		}
		var emailresult = checkEmail(bc_email);
		if (emailresult == "wrong"){
			alert("You must enter a valid Email Address here.\nPlease try again.");
			document.orderregandcontacts.bc_email.focus();
			return false;
		}
		if (bc_ccphone=="" && bc_phone==""){
			alert("You must enter a Phone Number here.\nPlease try again.");
			document.orderregandcontacts.bc_ccphone.focus();
			return false;
		}
		if (checkPhone(bc_ccphone,bc_phone,"bc_ccphone","bc_phone","orderregandcontacts")==false){
			return false;
		}
		if (checkPhone(bc_ccfax,bc_fax,"bc_ccfax","bc_fax","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(bc_address1,"bc_address1","Street Address","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(bc_suburb,"bc_suburb","Suburb","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(bc_postcode,"bc_postcode","Postcode","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(bc_state,"bc_state","State","orderregandcontacts")==false){
			return false;
		}
		if (check_dropdown(bc_country,"bc_country","Country","orderregandcontacts")==false){
			return false;
		}
	}
	// to check admin contact
	var ac_fname = document.orderregandcontacts.ac_fname.value;
	var ac_lname = document.orderregandcontacts.ac_lname.value;
	var ac_company = document.orderregandcontacts.ac_company.value;
	var ac_email = document.orderregandcontacts.ac_email.value;
	var ac_ccphone = document.orderregandcontacts.ac_ccphone.value;
	var ac_phone = document.orderregandcontacts.ac_phone.value;
	var ac_ccfax = document.orderregandcontacts.ac_ccfax.value;
	var ac_fax = document.orderregandcontacts.ac_fax.value;
	var ac_address1 = document.orderregandcontacts.ac_address1.value;
	var ac_address2 = document.orderregandcontacts.ac_address2.value;
	var ac_suburb = document.orderregandcontacts.ac_suburb.value;
	var ac_postcode = document.orderregandcontacts.ac_postcode.value;
	var ac_state = document.orderregandcontacts.ac_state.value;
	var ac_country = document.orderregandcontacts.ac_country.value;
	var checkadmin = "no";
	if (ac_fname!="" || ac_lname!="" || ac_company!="" || ac_email!="" || ac_ccphone!="" || ac_phone!="" || ac_ccfax!="" || ac_fax!="" || ac_address1!="" || ac_address2!="" || ac_suburb!="" || ac_postcode!="" || ac_state!=""){
		checkadmin = "yes";
	}
	if (manageclientid!="" && num_nics_result>0 && document.orderregandcontacts.nicadmin.value!="#") {
		checkadmin = "no";
	}
	if (checkadmin=="yes"){
		// check admin contact
		if (is_empty(ac_fname,"ac_fname","Name","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(ac_lname,"ac_lname","Last Name","orderregandcontacts")==false){
			return false;
		}
		var emailresult = checkEmail(ac_email);
		if (emailresult == "wrong"){
			alert("You must enter a valid Email Address here.\nPlease try again.");
			document.orderregandcontacts.ac_email.focus();
			return false;
		}
		if (ac_ccphone=="" && ac_phone==""){
			alert("You must enter a Phone Number here.\nPlease try again.");
			document.orderregandcontacts.ac_ccphone.focus();
			return false;
		}
		if (checkPhone(ac_ccphone,ac_phone,"ac_ccphone","ac_phone","orderregandcontacts")==false){
			return false;
		}
		if (checkPhone(ac_ccfax,ac_fax,"ac_ccfax","ac_fax","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(ac_address1,"ac_address1","Street Address","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(ac_suburb,"ac_suburb","Suburb","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(ac_postcode,"ac_postcode","Postcode","orderregandcontacts")==false){
			return false;
		}
		if (is_empty(ac_state,"ac_state","State","orderregandcontacts")==false){
			return false;
		}
		if (check_dropdown(ac_country,"ac_country","Country","orderregandcontacts")==false){
			return false;
		}
	}
}

function fillContact(from,to,field,nicselect){
	// This function is used in the Registrant and Contacts form
	// of the public ordering processs
	var checkfield = eval("document.orderregandcontacts."+field+".checked");
	var registryid = document.orderregandcontacts.registryid.value;
	var idau = document.orderregandcontacts.idau.value;
	var manageclientid = document.orderregandcontacts.manageclientid.value;
	var num_nics_result = document.orderregandcontacts.num_nics_result.value;

	if (checkfield==true){
		if (manageclientid!="" && num_nics_result>0 && nicselect!="") {
			eval("document.orderregandcontacts."+nicselect+".value = '#'");
		}
		//document.orderregandcontacts.tc_fname.value = document.orderregandcontacts.r_fname.value;
		eval("document.orderregandcontacts."+to+"fname.value = document.orderregandcontacts."+from+"fname.value");
		eval("document.orderregandcontacts."+to+"lname.value = document.orderregandcontacts."+from+"lname.value");
		eval("document.orderregandcontacts."+to+"company.value = document.orderregandcontacts."+from+"company.value");
		eval("document.orderregandcontacts."+to+"email.value = document.orderregandcontacts."+from+"email.value");
		eval("document.orderregandcontacts."+to+"ccphone.value = document.orderregandcontacts."+from+"ccphone.value");
		eval("document.orderregandcontacts."+to+"phone.value = document.orderregandcontacts."+from+"phone.value");
		eval("document.orderregandcontacts."+to+"ccfax.value = document.orderregandcontacts."+from+"ccfax.value");
		eval("document.orderregandcontacts."+to+"fax.value = document.orderregandcontacts."+from+"fax.value");
		eval("document.orderregandcontacts."+to+"address1.value = document.orderregandcontacts."+from+"address1.value");
		eval("document.orderregandcontacts."+to+"address2.value = document.orderregandcontacts."+from+"address2.value");
		eval("document.orderregandcontacts."+to+"suburb.value = document.orderregandcontacts."+from+"suburb.value");
		eval("document.orderregandcontacts."+to+"postcode.value = document.orderregandcontacts."+from+"postcode.value");
		eval("document.orderregandcontacts."+to+"state.value = document.orderregandcontacts."+from+"state.value");
		eval("document.orderregandcontacts."+to+"country.value = document.orderregandcontacts."+from+"country.value");
		if (registryid=="1" && idau!="yes" && to=="r_"){
			eval("document.orderregandcontacts."+to+"registrantidtype.value = document.orderregandcontacts."+from+"registrantidtype.value");
			eval("document.orderregandcontacts."+to+"registrantid.value = document.orderregandcontacts."+from+"registrantid.value");
		}
	} else {
		eval("document.orderregandcontacts."+to+"fname.value = ''");
		eval("document.orderregandcontacts."+to+"lname.value = ''");
		eval("document.orderregandcontacts."+to+"company.value = ''");
		eval("document.orderregandcontacts."+to+"email.value = ''");
		eval("document.orderregandcontacts."+to+"ccphone.value = ''");
		eval("document.orderregandcontacts."+to+"phone.value = ''");
		eval("document.orderregandcontacts."+to+"ccfax.value = ''");
		eval("document.orderregandcontacts."+to+"fax.value = ''");
		eval("document.orderregandcontacts."+to+"address1.value = ''");
		eval("document.orderregandcontacts."+to+"address2.value = ''");
		eval("document.orderregandcontacts."+to+"suburb.value = ''");
		eval("document.orderregandcontacts."+to+"postcode.value = ''");
		eval("document.orderregandcontacts."+to+"state.value = ''");
		eval("document.orderregandcontacts."+to+"country.value = 'AU'");
		if (registryid=="1" && idau!="yes" && to=="r_"){
			eval("document.orderregandcontacts."+to+"registrantidtype.value = '#'");
			eval("document.orderregandcontacts."+to+"registrantid.value = ''");
		}
	}
}

function checkContact(nic,nicasregistrant,from,to) {
	var nicvalue = eval("document.orderregandcontacts."+nic+".value");
	if (nicvalue!="#"){
//		if (eval("document.orderregandcontacts."+nicasregistrant+".checked")==true){
		eval("document.orderregandcontacts."+nicasregistrant+".checked=false");
		return fillContact(from,to,nicasregistrant);
//		}
	}
}

function checkDelegation(){

	var delegationType;
	var Delegation = document.delegation.Delegation;
	for (i=0; i<Delegation.length; i++)
	{
		if (Delegation[i].checked == true)
		{
			delegationType = document.delegation.Delegation[i].value;
			break;
		}
	}
	if (delegationType == "yes")
	{
		// check nameservers
		var primaryns = document.delegation.primaryns.value;
		var primarynsip = document.delegation.primarynsip.value;
		var secondaryns1 = document.delegation.secondaryns1.value;
		var secondaryns1ip = document.delegation.secondaryns1ip.value;
		var secondaryns2 = document.delegation.secondaryns2.value;
		var secondaryns2ip = document.delegation.secondaryns2ip.value;
		var secondaryns3 = document.delegation.secondaryns3.value;
		var secondaryns3ip = document.delegation.secondaryns3ip.value;
		if (primaryns=="" && primarynsip==""){
			alert("You must enter a Primary Name Server\n Please try again.")
			document.delegation.primarynsip.focus();
			return false;
		}
		result = checkIP(primaryns,primarynsip,1);
		if (result == "wrong") {
			alert("You must enter an IP Address OR Server Name for the Primary Server\nPlease try again.");
			document.delegation.primaryns.focus();
			return false;
		}
		if(result == "wrongIP") {
			alert("You must enter a valid IP Address here.");
			document.delegation.primarynsip.focus();
			return false;
		}
		if (secondaryns1=="" && secondaryns1ip==""){
			alert("You must enter a Secondary Name Server 1\n Please try again.")
			document.delegation.secondaryns1ip.focus();
			return false;
		}
		result = checkIP(secondaryns1,secondaryns1ip,1);
		if (result == "wrong") {
			alert("You must enter an IP Address OR Server Name for the Secondary Server 1\nPlease try again.");
			document.delegation.secondaryns1.focus();
			return false;
		}
		if(result == "wrongIP") {
			alert("You must enter a valid IP Address here.");
			document.delegation.secondaryns1ip.focus();
			return false;
		}
		result = checkIP(secondaryns2,secondaryns2ip,1);
		if (result == "wrong") {
			alert("You must enter an IP Address OR Server Name for the Secondary Server 2\nPlease try again.");
			document.delegation.secondaryns2.focus();
			return false;
		}
		if(result == "wrongIP") {
			alert("You must enter a valid IP Address here.");
			document.delegation.secondaryns2ip.focus();
			return false;
		}
		result = checkIP(secondaryns3,secondaryns3ip,1);
		if (result == "wrong") {
			alert("You must enter an IP Address OR Server Name for the Secondary Server 3\nPlease try again.");
			document.delegation.secondaryns3.focus();
			return false;
		}
		if(result == "wrongIP") {
			alert("You must enter a valid IP Address here.");
			document.delegation.secondaryns3ip.focus();
			return false;
		}
	}
	if (delegationType == "dns")
	{
		if (document.delegation.email0.value=="" && document.delegation.emailforward0.value!=""){
			alert("You must enter an alias here.\nPlease try again.");
			document.delegation.email0.focus();
			return false;
		}
		var emailresult = "";
		if (document.delegation.email0.value!=""){
			emailresult = checkEmail(document.delegation.emailforward0.value);
			if (emailresult == "wrong"){
				alert("You must enter a valid Email Address here.\nPlease try again.");
				document.delegation.emailforward0.focus();
				return false;
			}
		}
		if (document.delegation.email1.value=="" && document.delegation.emailforward1.value!=""){
			alert("You must enter an alias here.\nPlease try again.");
			document.delegation.email1.focus();
			return false;
		}
		if (document.delegation.email1.value!=""){
			emailresult = checkEmail(document.delegation.emailforward1.value);
			if (emailresult == "wrong"){
				alert("You must enter a valid Email Address here.\nPlease try again.");
				document.delegation.emailforward1.focus();
				return false;
			}
		}
		if (document.delegation.email2.value=="" && document.delegation.emailforward2.value!=""){
			alert("You must enter an alias here.\nPlease try again.");
			document.delegation.email2.focus();
			return false;
		}
		if (document.delegation.email2.value!=""){
			emailresult = checkEmail(document.delegation.emailforward2.value);
			if (emailresult == "wrong"){
				alert("You must enter a valid Email Address here.\nPlease try again.");
				document.delegation.emailforward2.focus();
				return false;
			}
		}
		if (document.delegation.email3.value=="" && document.delegation.emailforward3.value!=""){
			alert("You must enter an alias here.\nPlease try again.");
			document.delegation.email3.focus();
			return false;
		}
		if (document.delegation.email3.value!=""){
			emailresult = checkEmail(document.delegation.emailforward3.value);
			if (emailresult == "wrong"){
				alert("You must enter a valid Email Address here.\nPlease try again.");
				document.delegation.emailforward3.focus();
				return false;
			}
		}
		if (document.delegation.email4.value=="" && document.delegation.emailforward4.value!=""){
			alert("You must enter an alias here.\nPlease try again.");
			document.delegation.email4.focus();
			return false;
		}
		if (document.delegation.email4.value!=""){
			emailresult = checkEmail(document.delegation.emailforward4.value);
			if (emailresult == "wrong"){
				alert("You must enter a valid Email Address here.\nPlease try again.");
				document.delegation.emailforward4.focus();
				return false;
			}
		}
	}
}

function setDelegation(field,delegation){
	// this function is used in the delegation form of the public ordering process
	if (eval("document.delegation."+field+".value")!="")
	{
		var Delegation = document.delegation.Delegation;
		for (i=0; i<Delegation.length; i++)
		{
			if (Delegation[i].value == delegation)
			{
				document.delegation.Delegation[i].checked = true;
				break;
			}
		}
		if (delegation != "dns") {
			document.delegation.webforward.value="";
			document.delegation.webforwardTitle.value="";
			document.delegation.email0.value="";
			document.delegation.email1.value="";
			document.delegation.email2.value="";
			document.delegation.email3.value="";
			document.delegation.email4.value="";
			document.delegation.emailforward0.value="";
			document.delegation.emailforward1.value="";
			document.delegation.emailforward2.value="";
			document.delegation.emailforward3.value="";
			document.delegation.emailforward4.value="";
		}
		if (delegation != "yes") {
			document.delegation.primarynsip.value="";
			document.delegation.primaryns.value="";
			document.delegation.secondaryns1ip.value="";
			document.delegation.secondaryns1.value="";
			document.delegation.secondaryns2ip.value="";
			document.delegation.secondaryns2.value="";
			document.delegation.secondaryns3ip.value="";
			document.delegation.secondaryns3.value="";
		}
		if (delegation != "freeURL")
		{
			document.delegation.FreeURLForwardTo.value = "";
			document.delegation.FreeURLForwardTitle.value = "";
		}
	}
}


function unsetDelegations()
{
	// this function is used in the delegation form of the public ordering process
	var Delegation = document.delegation.Delegation;
	var result;
	for (i=0; i<Delegation.length; i++)
	{
		if (Delegation[i].checked == true)
		{
			result = Delegation[i].value;
			break;
		}
	}
	if (result != "yes")
	{
		document.delegation.primarynsip.value="";
		document.delegation.primaryns.value="";
		document.delegation.secondaryns1ip.value="";
		document.delegation.secondaryns1.value="";
		document.delegation.secondaryns2ip.value="";
		document.delegation.secondaryns2.value="";
		document.delegation.secondaryns3ip.value="";
		document.delegation.secondaryns3.value="";
	}
	if (result != "dns")
	{
		document.delegation.email0.value="";
		document.delegation.email1.value="";
		document.delegation.email2.value="";
		document.delegation.email3.value="";
		document.delegation.email4.value="";
		document.delegation.emailforward0.value="";
		document.delegation.emailforward1.value="";
		document.delegation.emailforward2.value="";
		document.delegation.emailforward3.value="";
		document.delegation.emailforward4.value="";
		document.delegation.webforward.value="";
		document.delegation.webforwardTitle.value="";
	}
	if (result != "freeURL")
	{
		document.delegation.FreeURLForwardTo.value = "";
		document.delegation.FreeURLForwardTitle.value = "";
	}
}
function transferrequestChecker(){
	var domain = document.transferrequest.domain.value;
	var authinfo = document.transferrequest.authinfo.value;
	var registrantid = document.transferrequest.registrantid.value;
	if (is_empty(domain,"domain","Domain Name","transferrequest")==false){
		return false;
	}
	if (is_empty(authinfo,"authinfo","Domain Password","transferrequest")==false){
		return false;
	}
	if (is_empty(registrantid,"registrantid","Registrant ID","transferrequest")==false){
		return false;
	}
}

function GTLDtransferrequestChecker(){
	var domain = document.transferrequest.domain.value;
	//var authinfo = document.transferrequest.authinfo.value;
	if (is_empty(domain,"domain","Domain Name","transferrequest")==false){
		return false;
	} else {
		var dot = /\./;
		var searchau = /\.au/;
		//alert(searchau);
		if (domain.search(searchau)!=-1){
			alert("Please use the AUtransfer Request form for this domain.\nTry again");
			document.transferrequest.domain.focus();
			return false;
		}
		if (domain.search(" ")!=-1 && domain.search(" ")!=domain.length){
			alert("Please do not enter blank spaces.\nTry again");
			document.transferrequest.domain.focus();
			return false;
		}

		if (domain.search(dot)==-1){
			alert("Please enter a suffix (.com, .net, etc..).\nTry again");
			document.transferrequest.domain.focus();
			return false;
		}
	}
/*	if (is_empty(authinfo,"authinfo","Domain Password","transferrequest")==false){
		return false;
	}*/
}

function GTLDtransferrequestChecker2(){
	var registrantid = document.transferrequest.registrantid.value;
	var technic = document.transferrequest.technic.value;
	if (is_empty(registrantid,"registrantid","Registrant ID","transferrequest")==false){
		return false;
	}
	if (registrantid!=""){
		var result = checkForNumber(registrantid);
		if (result == "false"){
			alert("You must enter a number here\nPlease try again.");
			document.transferrequest.registrantid.focus();
			return false;
		}
	}
	if (technic!=""){
		result = checkForNumber(technic);
		if (result == "false"){
			alert("You must enter a number here\nPlease try again.");
			document.transferrequest.technic.focus();
			return false;
		}
	}
}

function editinvoiceChecker(){
	var price = document.editinvoice.price.value;
	if (checkForNumberDot(price)=="false"){
		alert ("You must enter a number here.\nPlease try again");
		document.editinvoice.price.focus();
		return false;
	}
}

function invoicesearchChecker() {
	var invid = document.invoicesearch.invoiceidsearch.value;
	if (checkForNumber(invid)=="false"){
		alert ("You must enter a number here.\nPlease try again");
		document.invoicesearch.invoiceidsearch.focus();
		return false;
	}
}

function myobChecker(){
	if (document.myob.myob.value==""){
		alert ("You must enter an MYOB reference number here.\nPlease try again");
		document.myob.myob.focus();
		return false;
	}
}

function policyrejectionChecker(){
	if (document.policyrejection.code.value=="#"){
		alert("You must select a reason\nPlease try again");
		document.policyrejection.code.focus();
		return false;
	}
	if (document.policyrejection.code.value=="1160" && document.policyrejection.comment.value==""){
		alert("You must enter a comment.\nPlease try again.");
		document.policyrejection.comment.focus();
		return false;
	}

}

function techasregTransfer(){
	if (document.transfer.techasreg.checked==true) {
		document.transfer.tdomorg.value = document.transfer.domorg.value;
		document.transfer.tdomfname.value = document.transfer.domfname.value;
		document.transfer.tdomsurname.value = document.transfer.domsurname.value;
		document.transfer.cctdomphone.value = document.transfer.ccdomphone.value;
		document.transfer.tdomphone.value = document.transfer.domphone.value;
		document.transfer.tdomemail.value = document.transfer.domemail.value;
		document.transfer.tdomaddress1.value = document.transfer.domaddress1.value;
		document.transfer.tdomaddress2.value = document.transfer.domaddress2.value;
		document.transfer.tdomsuburb.value = document.transfer.domsuburb.value;
		document.transfer.tdompostcode.value = document.transfer.dompostcode.value;
		document.transfer.tdomstate.value = document.transfer.domstate.value;
		document.transfer.tdomcountry.value = document.transfer.domcountry.value;
	} else {
		document.transfer.tdomorg.value = "";
		document.transfer.tdomfname.value = "";
		document.transfer.tdomsurname.value = "";
		document.transfer.cctdomphone.value = "";
		document.transfer.tdomphone.value = "";
		document.transfer.tdomemail.value = "";
		document.transfer.tdomaddress1.value = "";
		document.transfer.tdomaddress2.value = "";
		document.transfer.tdomsuburb.value = "";
		document.transfer.tdompostcode.value = "";
		document.transfer.tdomstate.value = "";
	}
}

function transferstatusChecker(){
	if (document.transferstatus.status.value=="#"){
		alert("You must select a status.\nPlease try again.");
		document.transferstatus.status.focus();
		return false;
	}
}

function commPayChecker(){

	var confirmed = Boolean(1);
	confirmed = confirmer0("Are you sure you want to PAY THIS COMMISSION NOW?");

	if (confirmed == false) {
		return false;
	}

	var reference = document.commissionpayment.reference.value;
	var paylength = document.commissionpayment.length.value;
	var selectall = document.commissionpayment.selectall.checked;
	if (selectall){
		for (i=0;i < paylength;i++){
			eval("document.commissionpayment.pay"+i+".checked=true;");
		}
	}

	var i = 0;
	var numpays = 0;
	var checked = Boolean(0);
	for (i=0;i < paylength;i++){
		thevalue = eval("document.commissionpayment.pay"+i+".value");
		checked = eval("document.commissionpayment.pay"+i+".checked");
		if (checked) {
			numpays += 1;
			break;
		}
	}
	if (numpays == 0) {
		alert("You must select at least one order to pay the commission.\nPlease try again.");
		for (i=0;i<document.commissionpayment.elements.length;i++){
			if (document.commissionpayment.elements[i].type=="checkbox"){
				document.commissionpayment.elements[i].focus();
				return false;
			}
		}
	}

	if (reference=="") {
		alert("You must enter a reference number.\nPlease try again.");
		document.commissionpayment.reference.focus();
		return false;
	}

}

function renewalyearChecker()
{
	var newtime = document.renewalyear.newtime.value;

	if (isNaN(newtime))
	{
		alert("You must enter a number here\nPlease try again.");
		document.renewalyear.newtime.focus();
		return false;
	}

	if (newtime<1 || newtime>10)
	{
		alert("Renewal can only be within 1 to 10 years\nPlease try again.");
		document.renewalyear.newtime.focus();
		return false;
	}
}



function ccmyobChecker() {

	if (document.ccmyob.myob.value=="" && document.ccmyob.todo.value=="reconcile"){
		alert ("You must enter an MYOB reference number here.\nPlease try again");
		document.ccmyob.myob.focus();
		return false;
	}
	var ordertoupdate = document.ccmyob.ordertoupdate;
	var orderslist = "";
	if (ordertoupdate.length==undefined){
		orderslist = document.ccmyob.ordertoupdate.value;
		orderslist = orderslist + ",";
	}
	for (x=0;x<ordertoupdate.length;x++){
		if (ordertoupdate[x].checked) {
			 orderslist = orderslist + ordertoupdate[x].value;
			 orderslist = orderslist + ",";
		}
	}
	document.ccmyob.orderslist.value = orderslist;
	if (orderslist==""){
		alert("Please select at least one transaction.");
		if (ordertoupdate.length==undefined){
			document.ccmyob.ordertoupdate[0].focus();
		} else {
			document.ccmyob.ordertoupdate.focus();
		}
		return false;
	}
}

function checkEmptyCnames(alias,canonicalname,aliasfield,cannamefield) {
	if ((alias!="" && canonicalname=="") || (alias=="" && canonicalname!="")) {
		if (alias=="") {
			alert("You must enter an ALIAS.\nPlease try again.");
			return aliasfield;
		}
		if (canonicalname=="") {
			alert("You must enter a CANONICAL NAME.\nPlease try again.");
			return cannamefield;
		}
	} else {
		return 1;
	}
}

function CNAMErecordsChecker() {
	var space = /\s/g;
	var cnamealias1 = document.CNAMErecords.cnamealias1.value.replace(space,"");
	var cnamecanname1 = document.CNAMErecords.cnamecanname1.value.replace(space,"");
	var cnamealias2 = document.CNAMErecords.cnamealias2.value.replace(space,"");
	var cnamecanname2 = document.CNAMErecords.cnamecanname2.value.replace(space,"");
	var cnamealias3 = document.CNAMErecords.cnamealias3.value.replace(space,"");
	var cnamecanname3 = document.CNAMErecords.cnamecanname3.value.replace(space,"");
	var cnamealias4 = document.CNAMErecords.cnamealias4.value.replace(space,"");
	var cnamecanname4 = document.CNAMErecords.cnamecanname4.value.replace(space,"");

	var field = checkEmptyCnames(cnamealias1,cnamecanname1,"cnamealias1","cnamecanname1")
	if (field != 1) {
		eval("document.CNAMErecords."+field+".focus()");
		return false;
	}
	field = checkEmptyCnames(cnamealias2,cnamecanname2,"cnamealias2","cnamecanname2");
	if (field != 1) {
		eval("document.CNAMErecords."+field+".focus()");
		return false;
	}
	field = checkEmptyCnames(cnamealias3,cnamecanname3,"cnamealias3","cnamecanname3");
	if (field != 1) {
		eval("document.CNAMErecords."+field+".focus()");
		return false;
	}
	field = checkEmptyCnames(cnamealias4,cnamecanname4,"cnamealias4","cnamecanname4");
	if (field != 1) {
		eval("document.CNAMErecords."+field+".focus()");
		return false;
	}

	document.CNAMErecords.cnamealias1.value = cnamealias1.toLowerCase();
	document.CNAMErecords.cnamecanname1.value = cnamecanname1.toLowerCase();
	document.CNAMErecords.cnamealias2.value = cnamealias2.toLowerCase();
	document.CNAMErecords.cnamecanname2.value = cnamecanname2.toLowerCase();
	document.CNAMErecords.cnamealias3.value = cnamealias3.toLowerCase();
	document.CNAMErecords.cnamecanname3.value = cnamecanname3.toLowerCase();
	document.CNAMErecords.cnamealias4.value = cnamealias4.toLowerCase();
	document.CNAMErecords.cnamecanname4.value = cnamecanname4.toLowerCase();

}

//-------------------------------------------------------------------
// isBlank(value)
//   Returns true if value only contains spaces
//-------------------------------------------------------------------
function isBlank(val)
{
	if(val==null){return true;}
	for(var i=0;i<val.length;i++)
	{
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r"))
		{
			return false;
		}
	}
	return true;
}

//-------------------------------------------------------------------
// getElemById(id)
//   Cross browser version of DOM function getElementByID
//-------------------------------------------------------------------

function getElemById(elem) {
	if(document.getElementById) {
		return document.getElementById(elem);
	} else if (document.all) {
		return document.all[elem];
	} else if (document.layers) {
		return document.layers[elem];
	} else {
		return null;
	}
}

function isNumeric(val){return(parseFloat(val,10)==(val*1));}

function in_array(needle,haystack) {

	for (var w = 0; w < haystack.length; w++) {
		if (haystack[w] == needle)
		{
			return w;
		}
	}

	return -1;

}

function toggleObject(id)
{

	obj = getElemById(id);

	if (obj.style.display == 'none')
	{
		obj.style.display = 'block';
	}
	else
	{
		obj.style.display = 'none';
	}


}

/* Keyboard shortcut */
function shortcut(shortcut,callback,opt) {
	//Provide a set of default options
	var default_options = {
		'type':'keydown',
		'propagate':false,
		'target':document
	}
	if(!opt) opt = default_options;
	else {
		for(var dfo in default_options) {
			if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
		}
	}

	var ele = opt.target
	if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
	var ths = this;

	//The function to be called at keypress
	var func = function(e) {
		e = e || window.event;

		//Find Which key is pressed
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;
		var character = String.fromCharCode(code).toLowerCase();

		var keys = shortcut.toLowerCase().split("+");
		//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
		var kp = 0;

		//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
		var shift_nums = {
			"`":"~",
			"1":"!",
			"2":"@",
			"3":"#",
			"4":"$",
			"5":"%",
			"6":"^",
			"7":"&",
			"8":"*",
			"9":"(",
			"0":")",
			"-":"_",
			"=":"+",
			";":":",
			"'":"\"",
			",":"<",
			".":">",
			"/":"?",
			"\\":"|"
		}
		//Special Keys - and their codes
		var special_keys = {
			'esc':27,
			'escape':27,
			'tab':9,
			'space':32,
			'return':13,
			'enter':13,
			'backspace':8,

			'scrolllock':145,
			'scroll_lock':145,
			'scroll':145,
			'capslock':20,
			'caps_lock':20,
			'caps':20,
			'numlock':144,
			'num_lock':144,
			'num':144,

			'pause':19,
			'break':19,

			'insert':45,
			'home':36,
			'delete':46,
			'end':35,

			'pageup':33,
			'page_up':33,
			'pu':33,

			'pagedown':34,
			'page_down':34,
			'pd':34,

			'left':37,
			'up':38,
			'right':39,
			'down':40,

			'f1':112,
			'f2':113,
			'f3':114,
			'f4':115,
			'f5':116,
			'f6':117,
			'f7':118,
			'f8':119,
			'f9':120,
			'f10':121,
			'f11':122,
			'f12':123
		}


		for(var i=0; k=keys[i],i<keys.length; i++) {
			//Modifiers
			if(k == 'ctrl' || k == 'control') {
				if(e.ctrlKey) kp++;

			} else if(k ==  'shift') {
				if(e.shiftKey) kp++;

			} else if(k == 'alt') {
					if(e.altKey) kp++;

			} else if(k.length > 1) { //If it is a special key
				if(special_keys[k] == code) kp++;

			} else { //The special keys did not match
				if(character == k) kp++;
				else {
					if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
						character = shift_nums[character];
						if(character == k) kp++;
					}
				}
			}
		}

		if(kp == keys.length) {
			callback(e);

			if(!opt['propagate']) { //Stop the event
				//e.cancelBubble is supported by IE - this will kill the bubbling process.
				e.cancelBubble = true;
				e.returnValue = false;

				//e.stopPropagation works only in Firefox.
				if (e.stopPropagation) {
					e.stopPropagation();
					e.preventDefault();
				}
				return false;
			}
		}
	}

	//Attach the function with the event
	if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
	else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
	else ele['on'+opt['type']] = func;
}

//-------------------------------------------------------------------
// SwitchClass(object,className)
//   Changes the class of the given object to the given class name
//-------------------------------------------------------------------

function SwitchClass(object,className)
{
	object.className = className;
}

function isValidPassword(password)
{
	var filter  = /^([a-zA-Z0-9]{8,20})$/;
	if (filter.test(password))
	{
		return true;
	}
	else
	{
		return false;
	}
}


function ClicktoCall(id){
        var w=370;
        var h=450;
        var leftPos=(screen.width)?(screen.width-w)/2:100;
        var topPos=(screen.height)?(screen.height-h)/2:100;
        var settings='width='+w+',height='+h+',top='+topPos+',left='+leftPos+',';
        settings = settings+'location=no,directories=no,menubar=no,toolbar=no,';
        settings = settings+'status=no,scrollbars=no,resizable=no,dependent=no';
        var sUrl='http://www.nascomms.com/ccConnect/Dialer.aspx?clientId='+id;
        var ccWindow=window.open(sUrl,'ClickCalling',settings);
        ccWindow.focus();
}


function setVisibleSmallPopUp(divid, def, serviceid)
{
	str = '<span id="close"><a href="javascript:setVisibleSmallPopUp(\''+divid+'\')" style="text-decoration: none"><strong>X</strong></a></span>';
	str = str + '<p >' + def + '</p>';
	obj = document.getElementById(divid);
	obj.innerHTML = str;
	placeIt(divid, serviceid);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}


function placeIt(divid, anchorid)
{
	anchor = document.getElementById(anchorid);
	if (anchor) {
		obj = document.getElementById(divid);
		theLeft = findPosX(anchor) + 10;
		theTop = findPosY(anchor)  + 2;
		obj.style.left = theLeft + 'px' ;
		obj.style.top = theTop + 'px' ;
	}
}


function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}


// START OF Code provided by NetRegistry for lead tracking

function sendCookie(cName, cVal, cExp) 
{
	// send this cookie to all sites
	// use a time stamp so the image isnt cached..
	var timestamp = Number(new Date());
	// generate random number so the image isnt cached...
	var randomNum = Math.round(Math.random()*1000000);
	// combine the two
	var randStr = ''+timestamp+''+randomNum+'';

	// we should hopefully have a random number each time now...

	var tmpImage1 = new Image;
	tmpImage1.src = 'http://www.planetdomain.com/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	var tmpImage2 = new Image;
	tmpImage2.src = 'http://www.netregistry.com.au/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	var tmpImage3 = new Image;
	tmpImage3.src = 'http://www.hostess.com.au/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	var tmpImage4 = new Image;
	tmpImage4.src = 'http://www.mdwebhosting.com.au/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	var tmpImage5 = new Image;
	tmpImage5.src = 'http://www.planetreseller.info/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	
	var tmpImage6 = new Image;
	tmpImage6.src = 'http://www.tppinternet.com/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;

	var tmpImage7 = new Image;
	tmpImage7.src = 'http://resellers.tppinternet.com/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;

// This doesn't work because there is no www.ssl.twoplums.com.au:
	var tmpImage8 = new Image;
	tmpImage8.src = 'https://ssl.twoplums.com.au/OnlineManagementSystem/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;

// This doesn't work yet. Need to discuss. JV 25/02/10
	//var tmpImage9 = new Image;
	//tmpImage9.src = 'http://www.hotgoanna.com.au/setCookie.php?cName='+cName+'&cVal='+cVal+'&cPath=/&cExp='+cExp+'&r='+randStr;
	


}

// go through each cookie, look for one name '_gc' and copy to the other sites
if (document.cookie.length > 0) 
{
	var cookies = document.cookie.split(';');
	for(x=0;x<cookies.length;x++) 
	{
		var cData = cookies[x].split('=', 2);
		var cName = cData[0];
		var cVal = cData[1];
		var cExp = Math.floor(Number(new Date()/1000)+Math.floor(60*60*24*36500));

		if(trim(cName) == '_gc')
		{
			// we might have a custom exp here
			var tmpVal = unescape(cVal).split('&');
			for(i=0;i<tmpVal.length;i++) 
			{
				var thisVal = tmpVal[i].split('=', 2);
				if(thisVal[0] == 'ex') 
				{
					cExp = thisVal[1];
				}
			}

			sendCookie(cName, cVal, cExp);
		}
	}
}

//END OF Code provided by NetRegistry for lead tracking

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

