function validateExternalID(form)
{
        if ( form.owner_external_id.value == "")
        {
                alert("LANG_ex_must_enteren");
                form.owner_external_id.select();
                return false;
        }
}



var clicks = 0;

function countClicks()
{
	if (document.forms[0].pageid.value == "terms") 
	{
		if (document.forms[0].owner_countrySelect.value == '')
    	{
        	document.forms[0].owner_countrySelect.value = "US";
   		}
	} 

	if (document.forms[0].pageid.value == "confirm") 
	{
		if (clicks == 0) 
		{
			clicks++;
			document.forms[0].submitter.value="Processing...";
			return(true);
		} 
		else 
		{
			alert("Only click the confirm button once, please.");
			return(false);
		}
	} 
		return(true);
}


function thisDomainInstead(pageid,dname,lang)
{
    document.Form.dname.value = dname;
    document.Form.languageSelect.value = lang;
    document.Form.pageid.value = pageid;

    document.Form.submit();
}

function thisTldInstead(tld)
{
    i = 0;
    while(document.Form.tldSelect.options[i].value != null)
    {
        if (document.Form.tldSelect.options[i].value == tld)
        {
            document.Form.tldSelect.options[i].selected = true;
            break;
        }
        i++;
    }
}




function changeLanguage(lang){
    document.Form.languageSelect.value = lang;
    document.Form.changeme.value = 'yes';
    document.Form.submit();
        return;
}

function registerDomainInstead(pageid,dname,lang)
{
    document.Form.action = 'https://hosting.serrahost.com/cgi-bin/wairs/signup.cgi';
    document.Form.pageid.value = "index";
    document.Form.submit();
}

function regtransferDomainInstead(pageid,dname,lang)
{
    document.Form.action = 'https://hosting.serrahost.com/cgi-bin/wairs/signup.cgi';
    document.Form.pageid.value = "index";
    document.Form.submit();
}

function popup(url)
{
    window.open(url,"apopup",
     "height=400,width=500,scrollbars=yes,status=yes,modal=yes,toolbar=yes");
}

function maketop()
{
    if (self.location != top.location) {
        top.location = self.location;
    }
}

function setAction(url)
{
    document.Form.changeme.value = "yes";
    document.Form.pageid.value = url;
    document.Form.submit();
    return;
}

function loadInfoAdmin()
{
    if (document.forms[0].makesameAdmin.checked) {
        with (document.forms[0]) {
            admin_first_name.value = owner_first_name.value;
            admin_last_name.value = owner_last_name.value;
            admin_org_name.value = owner_org_name.value;
            admin_address1.value = owner_address1.value;
            admin_address2.value = owner_address2.value;
            admin_city.value = owner_city.value;
            admin_state.value = owner_state.value;
            admin_countrySelect.value = owner_countrySelect.value;
            admin_postal_code.value = owner_postal_code.value;
            admin_phone.value = owner_phone.value;
            admin_fax.value = owner_fax.value;
            admin_email.value = owner_email.value;
        }
    } else {
        with (document.forms[0]) {
            admin_first_name.value = "";
            admin_last_name.value = "";
            admin_org_name.value = "";
            admin_address1.value = "";
            admin_address2.value = "";
            admin_city.value = "";
            admin_state.value = "";
            admin_countrySelect.value = "US";
            admin_postal_code.value = "";
            admin_phone.value = "";
            admin_fax.value = "";
            admin_email.value = "";
        }
    }
}

function loadInfoBilling()
{
    if (document.forms[0].makesameBilling.checked) {
        with (document.forms[0]) {
            billing_first_name.value = owner_first_name.value;
            billing_last_name.value = owner_last_name.value;
            billing_org_name.value = owner_org_name.value;
            billing_address1.value = owner_address1.value;
            billing_address2.value = owner_address2.value;
            billing_city.value = owner_city.value;
            billing_state.value = owner_state.value;
            billing_countrySelect.value = owner_countrySelect.value;
            billing_postal_code.value = owner_postal_code.value;
            billing_phone.value = owner_phone.value;
            billing_fax.value = owner_fax.value;
            billing_email.value = owner_email.value;
        }
    } else {
        with (document.forms[0]) {
            billing_first_name.value = "";
            billing_last_name.value = "";
            billing_org_name.value = "";
            billing_address1.value = "";
            billing_address2.value = "";
            billing_city.value = "";
            billing_state.value = "";
            billing_countrySelect.value = "US";
            billing_postal_code.value = "";
            billing_phone.value = "";
            billing_fax.value = "";
            billing_email.value = "";
        }
    }
}