function Domain(){this.validexts=new Array('.ac.nz','.asn.au','.biz','.cc','.cn','.co.na','.co.nz','.co.uk','.com','.com.au','.com.cn','.geek.nz','.gen.nz','.govt.nz','.id.au','.info','.iwi.nz','.jp','.maori.nz','.mobi','.net','.net.au','.net.cn','.net.nz','.org','.org.au','.org.cn','.org.nz','.org.uk','.school.nz','.tv','.us','.ws');this.timeout_id=0;this.tmploader=0;this.define=function(ext){if(this.timeout_id!=0)window.clearTimeout(this.timeout_id);if(this.tmploader!=0)window.clearTimeout(this.tmploader);extf=function(){this.timeout_id=0;var url='/domain/define/'+ext+'/ajaxcall';extfo=function(){t=new Tooltip('splash');t.showTooltip();}
new Ajax.Updater('splash',url,{evalScripts:true,method:'get',onComplete:extfo});};this.timeout_id=window.setTimeout(extf,200);}
this.canceldefine=function(){if(this.timeout_id!=0)window.clearTimeout(this.timeout_id);if(!$('splash').visible()){this.timeout_id==0;return;}
extf=function(){this.timeout_id=0;if($('splash').visible()){new Effect.Shrink('splash');}};this.timeout_id=window.setTimeout(extf,350);}
this.checkDomain=function(){var domain=this.domain;var exts=this.validexts;var result=validateDomain(domain,exts)
if(result!='validated'){var error='';for(var i=0;i<result.length;i++){error=error+result[i]+'\n';}
alert(error);}}
this.validateDomain=function(domain,exts){var error=new Array();var dotIndex=domain.indexOf('.');var name=domain.substring(0,dotIndex);var ext=domain.substring(dotIndex,domain.length);if(dotIndex<2){error[error.length]='Your Web Address is to short';}
if(dotIndex>63){error[error.length]='Your Web Address is to long';}
if(exts.indexOf(ext)==-1){error[error.length]='Your Web Address extension is not valid or not support by Freeparking';}
for(var j=0;j<name.length;j++){var nameChar=name.charAt(j);var nameCharCode=nameChar.charCodeAt(0);if((nameCharCode>47&&nameCharCode<59)||(nameCharCode>64&&nameCharCode<91)||(nameCharCode>96&&nameCharCode<123)||nameCharCode==45||nameCharCode==46)
{if(j==0&&nameCharCode==45){error[error.length]='A Web Adress can not begin with a hyphen (\"-\")';}
if((j==name.length-1)&&nameCharCode==45){error[error.length]='A Web Adress can not end with a hyphen (\"-\")';}}else{error[error.length]='A Web Address can not have special characters, it must consist of alphanumeric characters (A-Z, a-z & 0-9) and hyphens (\"-\")';}}
if(error.length==0){return'validated';}else{return error;}}}
