function is_valid_zipcode(zipcode) {  
    var reg = /^([0-9]{5})$/;
    return reg.test(zipcode); 
}
$(document).ready(function(){
/* Removes or adds default value to text inputs */
$("input.labelinside, textarea.labelinside").each(function(i){
	if ( $(this).val().length == 0 ) {                    
		$(this).val($(this).attr('title'));
		$(this).addClass("default");
	}
});
$("input.labelinside, textarea.labelinside").focus(function(e){
	if ( $(this).val() == $(this).attr('title') ) {
		$(this).val('');
		$(this).removeClass("default");
	}
});
$("input.labelinside, textarea.labelinside").blur(function(e){
	if ( $(this).val() == '' ) {
		$(this).val($(this).attr('title'));
		$(this).addClass("default");
	}
});

});
function FormSwitch(form, zipcode) {
		var siteURL ="";
			siteURL = "https://www.lifeinsurancerates.com/insurance-quotes.php";
	
		siteURL = siteURL + "?zip=" + $(zipcode).val();
		
		$(zipcode).removeClass('error');
	
		if ( !is_valid_zipcode($(zipcode).val()) ) {
			$(zipcode).addClass('error');
			alert("Please enter a valid zip code.");
			return false;
			$(zipcode).focus()
		}else{
			window.open(siteURL,"quotes","top=0,left=0,width="+screen.width+",height="+screen.height+",fullscreen=yes,scrollbars=1");
			//$(form).submit();
			return true;
		}

	return false;
	
}
function ClickForm() {
	var siteURL ="";
		siteURL = "https://www.lifeinsurancerates.com/insurance-quotes.php";
		window.open(siteURL,"quotes","top=0,left=0,width="+screen.width+",height="+screen.height+",fullscreen=yes,scrollbars=1");
	
	return true;

}
