function isNumeric(val){return(parseFloat(val,10)==(val*1));}
function check_zip()
{
try{
var ref=document.getElementById('postal_code');
if(document.getElementById('country').value=='1')
{
ref.value=ref.value.toUpperCase();
if(ref.value.length==2 && !isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==4 && !isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==6 && !isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==1 && isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==3 && isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==5 && isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)))
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length>6)
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==6)
ref.style.backgroundColor='#ffffff';
else
ref.style.backgroundColor='#ffbe93';
}
else if(document.getElementById('country').value=="2")
{
if(!isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)) || ref.value.length>5)
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==5)
ref.style.backgroundColor='#ffffff';
else
ref.style.backgroundColor='#ffbe93';
}
else
{
}
}catch(ee){}
}
function check_postal(ref)
{
if(!isNumeric(ref.value.substr(ref.value.length-1,ref.value.length)) || ref.value.length>5)
ref.value=ref.value.substr(0,ref.value.length-1);
if(ref.value.length==5)
ref.style.backgroundColor='#ffffff';
else
ref.style.backgroundColor='#ffbe93';
}
function validate_company(ref){
if(ref.value.match(/0){ref.style.backgroundColor='#ffffff';}else{ref.style.backgroundColor='#ffbe93';}
}
// source: http://en.wikipedia.org/wiki/U.S._state
us_states=new Array();
us_states=[
['AL', 'Alabama']
,['AK', 'Alaska']
,['AZ', 'Arizona']
,['AR', 'Arkansas']
,['CA', 'California']
,['CO', 'Colorado']
,['CT', 'Connecticut']
,['DE', 'Delaware']
,['FL', 'Florida']
,['GA', 'Georgia']
,['HI', 'Hawaii']
,['ID', 'Idaho']
,['IL', 'Illinois']
,['IN', 'Indiana']
,['IA', 'Iowa']
,['KS', 'Kansas']
,['KY', 'Kentucky']
,['LA', 'Louisiana']
,['ME', 'Maine']
,['MD', 'Maryland']
,['MA', 'Massachusetts']
,['MI', 'Michigan']
,['MN', 'Minnesota']
,['MS', 'Mississippi']
,['MO', 'Missouri']
,['MT', 'Montana']
,['NE', 'Nebraska']
,['NV', 'Nevada']
,['NH', 'New Hampshire']
,['NJ', 'New Jersey']
,['NM', 'New Mexico']
,['NY', 'New York']
,['NC', 'North Carolina']
,['ND', 'North Dakota']
,['OH', 'Ohio']
,['OK', 'Oklahoma']
,['OR', 'Oregon']
,['PA', 'Pennsylvania']
,['PR', 'Puerto Rico']
,['RI', 'Rhode Island']
,['SC', 'South Carolina']
,['SD', 'South Dakota']
,['TN', 'Tennessee']
,['TX', 'Texas']
,['UT', 'Utah']
,['VT', 'Vermont']
,['VA', 'Virginia']
,['WA', 'Washington']
,['WV', 'West Virginia']
,['WI', 'Wisconsin']
,['WY', 'Wyoming']
];
can_provinces=new Array();
can_provinces=[
['AB','Alberta']
,['BC','British Columbia']
,['MC','Manitoba']
,['GNB','New Brunswick']
,['NF','New Foundland and Labrador']
,['NT','Northwest Territories']
,['NS','Nova Scotia']
,['NU','Nunavut']
,['ON','Ontario']
,['PE','Prince Edward Island']
,['QC','Quebec']
,['SK','Saskatchewan']
,['YK','Yukon']
];
function get_states2(country,state_obj,selected,reset_zip)
{
try{
var sel="";
state_obj.innerHTML=sel;
if(country.value!="")
country.style.backgroundColor='#ffffff';
else
country.style.backgroundColor='#ffffff';
if(reset_zip==1)
{
document.getElementById('postal_code').value='';
}
}catch(ee){}
}
function get_states(country,state_obj,selected,reset_zip)
{
try{
var sel="";
state_obj.innerHTML=sel;
if(country.value!="")
country.style.backgroundColor='#ffffff';
else
country.style.backgroundColor='#ffbe93';
if(reset_zip==1)
{
document.getElementById('postal_code').value='';
}
}catch(ee){}
}
function setup_states()
{
try{
get_states(document.getElementById('country'),document.getElementById('state_td'),'',0);
}catch(ee){}
}
function setup_states2_nohl(sel)
{
try{
get_states2(document.getElementById('country'),document.getElementById('state_td'),sel,0);
}catch(ee){}
}
function setup_states2(sel)
{
try{
get_states(document.getElementById('country'),document.getElementById('state_td'),sel,0);
}catch(ee){}
}
var num=90;
function redirect()
{
try
{
num -= 1;
if(num==0)
window.location="index.php";
//document.getElementById('message').innerHTML="You will be redirected to the Home page in "+num+" seconds...";
//document.getElementById('index_link').focus();
setTimeout('redirect()',1000);
}
catch(ee)
{
}
}