$(document).ready(function(){
	
	/*$('#btnsubmit').click(function() {
		$(this).replaceWith("<div class='processing'>processing...</div>");
		document.getElementById('registerForm').submit();
	});*/
	
	$('#password-clear').show();
	$('#password-password').hide();
	
	$('#password-clear input').focus(function() {
		$('#password-clear').hide();
		$('#password-password').show();
		$('#password-password input').focus();
	});
	$('#password-password input').blur(function() {
		if($('#password-password input').val() == '') {
			$('#password-clear').show();
			$('#password-password').hide();
		}
	});
	
   $('.txtbox').corners();
   
   $('#nav .active')
   		.mouseover(function() { 
            var src = $(this).attr("src").match(/[^\.]+/) + "_b.png";
            $(this).attr("src", src);
        })
        .mouseout(function() {
            var src = $(this).attr("src").replace("_b", "");
            $(this).attr("src", src);
        });
	});
 
	
	


 function clearText(object) {
	 if (object.value==object.defaultValue) {
		object.value = "";
		object.style.color = "#000000";
	 } else if (object.value=="") {
		object.value = object.defaultValue;
		object.style.color = "#e79f05"; 
	 }
	 
 }


function loadAJAX(url, divId) {
	if (!url) {
		document.getElementById(divId).innerHTML="";
		return;	
	}
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function(){
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById(divId).innerHTML=xmlhttp.responseText;
		
		}
	  }
	//var params;
	//$('form input').each(function(){
		//params+= this.name+"="+this.value+"&";
	//});
	
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

/*function validateRegister() {
	
	var error='';
	if (!document.forms['registerForm'].first_name.value || !document.forms['registerForm'].last_name.value || !document.forms['registerForm'].email.value || !document.forms['registerForm'].city.value || !document.forms['registerForm'].last_name.state || !document.forms['registerForm'].last_name.zip) {
		error='Please provide all required fields. ';
	}
	
	if (document.forms['registerForm'].email.value) {
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
 		var address = document.forms['registerForm'].email.value;
		if (reg.test(address) == false) {
			error+='Please enter a valid email address';
		}
	}
	if (!error) {
		document.forms['registerForm'].submit();
	} else {
		alert(error);	
	}
}
*/
