function check_zip(){
	Element.update('ziperror',"<img src='/images/indicator.gif' /><span style=\"color: #333\"> validating...</span>");
	var params = 'format=ajax&zip='+ $('zipcode').value;
	new Ajax.Request('/x/validZip.ajax.php',{
				parameters: params, onSuccess: notifyUser, onFailure: isValidZip
			});
}
function notifyUser(resp){
	var result = resp.responseText;
	if(result == "success"){
		Element.update('ziperror','');
		return;
	}else {
		Element.update('ziperror',result);
		reset();
	}
}

function isValidZip(){
	if (/[0-9]{5}/.test($('zipcode').value) && $('zipcode').value.length <= 5){
		Element.update('ziperror','');
		return;
	}else {
		Element.update('ziperror',"Not a valid zip code...");
		reset();
	}
	
}

function reset(){
	$('zipcode').value = "";
}

function showterms(page) {
	if(page) termswin = window.open(page, 'terms', "height=300,width=500,scrollbars=1");
	else termswin = window.open('/terms.html', 'terms', "height=300,width=500,scrollbars=1");
}

	  

var pic1 = new Image(25,25);
pic1.src = "/images/cmark.JPG";

function rpassFocus()
{
	document.getElementById('pmatch').style.visibility = 'visible';
	if(document.newRegistr1.PasswordHash.value == document.newRegistr1.rPasswordHash.value)
	{
		document.newRegistr1.submit.disabled = false;
	}
	else
	{
		document.newRegistr1.submit.disabled = "disabled";
	}

}
function rpassCh(value)
{
	if(document.newRegistr1.PasswordHash.value == value)
	{
		document.newRegistr1.submit.disabled = false;
		document.pmatch.src = "/images/cmark.JPG";
	}
	else
	{
		document.pmatch.src = "/images/xmark.JPG";
		document.newRegistr1.submit.disabled = "disabled";

	}
}

function rpassBlur()
{
	if(document.newRegistr1.PasswordHash.value == document.newRegistr1.rPasswordHash.value)
	{
		document.newRegistr1.submit.disabled = false;
		document.pmatch.src = "/images/cmark.JPG";
	}
	else
	{
		document.newRegistr1.submit.disabled = "disabled";
		document.pmatch.src = "/images/xmark.JPG";
	}
}
