/**
 * @author Mikhail A Kozlov 
 * www.315design.com
 */
$(document).ready(function(){
	$(".leaseOptions a.more").live("click",function(){
		$($(this).attr('href')).slideToggle();
		return false;
	})
	$("input:radio","#doNewAddress").live("click",function(){
		if(parseInt($(this).val()) > 0){
			$("#newAddress").slideUp();
		}else{
			$("#newAddress").slideDown();
		}
	});
	$("#hideThis").live("click",function(){
		$(this).parent().parent().slideToggle(200);
		return false;
	});
	$("#orderForm").submit(function(){
		$(this).find("input:submit").parent().html('<img src="/images/loading.gif" alt="Loading..." /><br />Loading...');
	});
	$("#updateEmail").live("click",function(){
		if($("#clients_email").val().length > 5){
			$.getJSON("/_postup.php",$("#updateForm input").serializeArray(),function(d){
				if(parseInt(d.res) == 1){
					gloablError(d.res,d.msg);
					$("#updateForm").slideUp(200);
				}else{
					gloablError(d.res,d.msg);
				}
			});
		}else{
			gloablError(0,"Erorr! Looks like e-mail address is too short!");
		}
	});
});
