
function getDomainErrors(domain){var errors=new Array();if(domain.search(/([^a-zA-Z0-9\-]+)/)!=-1){errors.push('Domain names may only contain letters, numbers and hyphens with no spaces.');}
if(domain.search(/(^-(.*)|(.*)-$)/)!=-1){errors.push('Domain names may not start or end with a hyphen.');}
if(domain.charAt(2)=='-'&&domain.charAt(3)=='-'){errors.push('Domain names may not have hyphens as the 3rd and 4th characters.');}
if(domain.length<2||domain.length>63){errors.push('Domain names must be between 2 and 63 characters in length.');}
return errors;}
function cleanDomain(domain){return domain.replace(/(http:\/\/|www\.|\.com)/gi,'');}
function gotoStep(num){for(i=1;i<=4;i++){if(i==num){disp="block";bclass="selected";}
else{disp="none";bclass="unselected";}
$j("#step"+i).css("display",disp);$j("#button-step"+i).attr({className:bclass});if(i<4){$j("#arrow"+i).css("display",disp);}}
location.href="#step"+num;return;}
function moveDown(){location.href="#step1-2";return;}
function showDomainFields(val){val=='yes'?notval='no':notval='yes';$j("."+val+"-domain").show();$j("."+notval+"-domain").hide();return;}
function buyDomain(tld){var domain=$j("#enom-domain").val().replace(/(http:\/\/|www\.|\.com)/gi,'');var list=$j("#enom-domain-list");var counter=$j("#enom-count");var count=counter.val();var clear=$j("#enom-clear");$j("#enom-register").val(1);domain+="."+tld;if(list.children().length==0){count=0;}
count++;counter.val(count);var name=document.createElement("div");var html=domain+' &ndash; $10.00';name.innerHTML=html;list.append(name);var input=document.createElement("input");input.type="hidden";input.name="enom_"+count;input.id="enom-"+count;input.value=domain;list.append(input);if(count>0){$j("#enom-clear").css("display","block");}
$j("[@id^=enom-add]").attr({disabled:true});$j("#enom-main").val(count);return;}
function mainDomain(i){$j("#enom-main").val(i);$j("#enom-text-"+i).html('<span class="green b">Main Domain</span>');for(j=1;j<=$j("#enom-count").val();j++){if(j!=i){$j("#enom-text-"+j).html('<a href="javascript:mainDomain('+j+')">set as main domain</a>');}}
return;}
function clearDomains(){$j("#enom-domain").focus();$j("#enom-submit").attr({disabled:false});$j("[@id^=enom-status]").html("");$j("[@id^=enom-add]").attr({disabled:true});$j("#enom-domain-list").empty();$j("#enom-clear").css("display","none");$j("#enom-count").val(0);$j("#enom-main").val(0);return;}
function useContact(){if($j("#use_contact").attr("checked")){$j("#cc_fname").val($j("#fname").val());$j("#cc_lname").val($j("#lname").val());$j("#cc_address").val($j("#address").val());$j("#cc_address2").val($j("#address2").val());$j("#cc_city").val($j("#city").val());document.getElementById("cc_state").options.selectedIndex=document.getElementById("state").options.selectedIndex;$j("#cc_zip").val($j("#zip").val());}
else{$j("#cc_name").val("");$j("#cc_address").val("");$j("#cc_address2").val("");$j("#cc_city").val("");document.getElementById("cc_state").options.selectedIndex=0;$j("#cc_zip").val("");}
return;}
function submitRegister(){var errors=new Array();var step=0;if(isEmpty($j("#fname").val())){errors.push("Enter your first name");}
if(isEmpty($j("#lname").val())){errors.push("Enter your last name");}
if(isEmpty($j("#email").val())){errors.push("Enter a valid email address");}
if(isEmpty($j("#address").val())){errors.push("Enter your address");}
if(isEmpty($j("#city").val())){errors.push("Enter your city");}
if(isEmpty($j("#state/OPTION:selected").val())){errors.push("Select your state");}
if(isEmpty($j("#zip").val())){errors.push("Enter your zip");}
if(isEmpty($j("#password").val())){errors.push("Enter a password");}
if(isEmpty($j("#password_conf").val())){errors.push("Confirm your password");}
if($j("#password").val()!=$j("#password_conf").val()){errors.push("Your passwords do not match");}
if(isEmpty($j("#boatname").val())){errors.push("Enter your boat's name");}
if(errors.length){step=1;}
if($j("#have-domain-yes").attr("checked")){$j("#domain").val($j("#domain").val().replace(/(http:\/\/|www\.)/gi,''));if(isEmpty($j("#domain").val())){errors.push("Enter your domain name");}}
else{if($j("#enom-count").val()<1){errors.push("You must purchase at least 1 domain");}
if($j("#enom-main").val()<1){errors.push("You must select a main domain");}
if(isEmpty($j("#cc_fname").val())){errors.push("Enter billing first name");}
if(isEmpty($j("#cc_lname").val())){errors.push("Enter billing last name");}
if(isEmpty($j("#cc_address").val())){errors.push("Enter your billing address");}
if(isEmpty($j("#cc_city").val())){errors.push("Enter your billing city");}
if(isEmpty($j("#cc_state/OPTION:selected").val())){errors.push("Select your billing state");}
if(isEmpty($j("#cc_zip").val())){errors.push("Enter your billing zip");}
if(isEmpty($j("#cc_id/OPTION:selected").val())){errors.push("Select a credit card type");}
if(isEmpty($j("#cc_number").val())){errors.push("Enter a valid credit card number");}
if(isEmpty($j("#cc_expiration_month/OPTION:selected").val())){errors.push("Select an expiration month");}
if(isEmpty($j("#cc_expiration_year/OPTION:selected").val())){errors.push("Select an expiration year");}
if(isEmpty($j("#cc_cvv").val())){errors.push("Enter a valid CVV");}
if(errors.length&&!step){step=4;}}
if(errors.length){var e="Please correct the following errors in your submission:\n\n";for(i=0;i<errors.length;i++){e+=errors[i]+"\n";}
alert(e);gotoStep(step);}
else{$j("#theform").submit();}}
function showPreview(id){var url='/preview?id='+id;window.open(url,null,'height=580,width=860,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no');return;}
