// JavaScript Document
$(document).ready(function () {

    $("#form1").validate();
    
    jQuery("a[rel]").overlay({effect: 'apple', mask: {color: '#000', loadSpeed: 200, opacity: 0.62}});



    if ($.browser.msie == true && ($.browser.version == '7.0' || $.browser.version == '8.0')) {
        $('#findarepform').css('paddingTop', '12px');
        $('.jspPane li').css('overflow', 'hidden');
        $('.jspPane li').css('height', 'auto');
	if ($.query.get('pageid')!='164') {$('.scroll-pane').jScrollPane();}
    } else {
        //alert($.browser.version);
        $('.scroll-pane').jScrollPane();
    }
    
    
    //remove links for pages that don't have content
    $('.leftnav a').each(function(){
    	if ($(this).attr('href')=='/products/premium/exterior/'){$(this).css('textTransform','uppercase').css('cursor','default')}
    	if ($(this).attr('href')=='/product/interior/'){$(this).css('textTransform','uppercase').css('cursor','default')}
    	if ($(this).attr('href')=='/products/premium/inex/'){$(this).css('textTransform','uppercase').css('cursor','default')}
    	if ($(this).attr('href')=='/products/pro/'){$(this).css('textTransform','uppercase').css('cursor','default')}
    });
    $('.leftnav a, #topnav a').each(function(){
    	if ($(this).attr('href')=='/products/premium/exterior/'){$(this).attr('href','#')}
    	if ($(this).attr('href')=='/product/interior/'){$(this).attr('href','#')}
    	if ($(this).attr('href')=='/products/premium/inex/'){$(this).attr('href','#')}
    	if ($(this).attr('href')=='/products/pro/'){$(this).attr('href','#')}
    });


    if ($("#homeslideshow").length > 0) {
        setTimeout(function () {
            $('#homeslideshow img:first').fadeIn(1500);
            $('#homeslideshow').cycle({ timeout: 7000, pause: 1 });
            //$('#homeslideshow').cycle({timeout:7000, pause:1, pager:'#homeslideshow_nav'});
        }, 1500);

        //[class!='l3'][class!='l6'][class!='l9']
        $("ul.items li a.hoverexpand").mouseover(
			function () {
			    $("ul.items li[class='l3']").add($("ul.items li[class='l6']")).add($("ul.items li[class='l9']")).css("visibility", "hidden");
			    $(".hover_expansion").show();
			    $(".hover_expansion_middle").html($(this).parents("li").children("div.hover_expansion_item").html());
			}
		);

        $("#expansion_dv").mouseout(function (event) {
            var obj;
            if (event.currentTarget)
            { obj = event.relatedTarget; }
            else
            { obj = event.toElement; }

            if ($(obj).parents("#expansion_dv").length == 0) {
                $(".hover_expansion").hide();
                $("ul.items li[class='l3']").add($("ul.items li[class='l6']")).add($("ul.items li[class='l9']")).css("visibility", "visible");
            }

        });


    }
    
    if ($('.con table a').length > 0) {
    	var targetcount = 1;
    	$('.con table a').each(function(){
    		if ($(this).attr('href')){
    		if ($(this).attr('href').indexOf('.pdf')!=-1){
    		$(this).attr('target','_new'+targetcount);
    		targetcount++;
    		}
    		}
    	});
    }





    if ($("#content").length > 0) {
        var maxMainHeight = document.documentElement.clientHeight - 122 - 75 + 16;
        var curMainHeight = $('#main').height();
        if (maxMainHeight > curMainHeight)
        { $('#wrapper').css('overflow', 'hidden'); $('#main').height(maxMainHeight); }

        var oldHeight = $("#content").height();
        var newHeight = $("#main").height() - 32;
        $("#content").height(newHeight);
        $(".detail_bottom").css("margin-top", newHeight - oldHeight);
    }
    
    
    if (document.URL.indexOf('/about_km')==-1 && document.URL!='http://www.kellymoore.com/') {
    	$('a[href$="http://www.kellymoore.com/california-supply-chains-act"]').hide();
    }
    

    if ($("#checklist").length > 0) {
        var box = new Boxy($("#checklist"), { modal: true });
        $("#boxy-wrapper").css({ "position": "absolute", "top": "0", "right": "0" });
    }

    $("#topnav li.top:last").css("background-image", "none");
    $("#topnav a.top_link:last span").css("padding-right", "0");

    var wd = document.documentElement.clientWidth;
    if (wd < 1100) wd = 1100;
    $("#wrapper, #header, #footer").width(wd);

    $(window).resize(function () {
        var wd = document.documentElement.clientWidth;
        if (wd < 1100) wd = 1100;
        $("#wrapper, #header, #footer").width(wd);
    });


    $("#search_fm_btn").click(function () {
        if ($.trim($("#search_fm input[name='keyword']").val()) == '')
        { alert("Please enter a keyword to search."); $("#search_fm input[name='keyword']").focus(); return false; }
        $("#search_fm").submit();
    });



    // locations.asp
    $('#zip').click(function(){$('#city').val('');$('#state').val('');});
    $('#city').click(function(){$('#zip').val('');});
    
    
    $("#fapform").submit(function () {
        if ($.trim($("#fapform input[name='zip']").val()) == '' && $.trim($("#fapform input[name='address2']").val()) == '' && $.trim($("#fapform input[name='city']").val()) == '' && $.trim($("#fapform input[name='state']").val()) == '')
        { alert("Please enter your zip code or your address."); $("#fapform input[name='zip']").focus(); return false; }
        else {
            if ($.trim($("#fapform input[name='zip']").val()) != '') {
                if (!isValidDigit($("#fapform input[name='zip']").val()))
                { alert("Please enter a valid zip code."); $("#fapform input[name='zip']").focus(); return false; }
                if ($("#fapform input[name='zip']").val().length<5){alert("Please enter a valid zip code."); $("#fapform input[name='zip']").focus(); return false; }
            }
            else {
                if ($.trim($("#fapform input[name='city']").val()) == '')
                { alert("Please enter a value for the \"City\" field."); $("#fapform input[name='city']").focus(); return false; }
                if ($.trim($("#fapform input[name='state']").val()) == '')
                { alert("Please enter a value for the \"State\" field."); $("#fapform input[name='state']").focus(); return false; }
            }
        }
    });


    $("#fapform2").submit(function () {
        if ($.trim($("#fapform2 input[name='zip']").val()) == '' && $.trim($("#fapform2 input[name='address2']").val()) == '' && $.trim($("#fapform2 input[name='city']").val()) == '' && $.trim($("#fapform2 input[name='state']").val()) == '')
        { alert("Please enter your zip code or your address."); $("#fapform2 input[name='zip']").focus(); return false; }
        else {
            if ($.trim($("#fapform2 input[name='zip']").val()) != '') {
                if (!isValidDigit($("#fapform2 input[name='zip']").val()))
                { alert("Please enter a valid zip code."); $("#fapform2 input[name='zip']").focus(); return false; }
            }
            else {
                if ($.trim($("#fapform2 input[name='city']").val()) == '')
                { alert("Please enter a value for the \"City\" field."); $("#fapform2 input[name='city']").focus(); return false; }
                if ($.trim($("#fapform2 input[name='state']").val()) == '')
                { alert("Please enter a value for the \"State\" field."); $("#fapform2 input[name='state']").focus(); return false; }
            }
        }
    });


    $("#findarep").submit(function () {
        if ($.trim($("#findarep input[name='zip']").val()) == '')
        { alert("Please enter your zip code."); $("#findarep input[name='zip']").focus(); return false; }
        if (!isValidDigit($("#findarep input[name='zip']").val()) || $("#findarep input[name='zip']").val().length != 5)
        { alert("Please enter a valid zip code."); $("#findarep input[name='zip']").focus(); return false; }
    });





    $("#findarep_contact_fm").submit(function () {
        if ($.trim($("#findarep_contact_fm input[name='Name']").val()) == '')
        { alert("Please enter a value for the \"Name\" field."); $("#findarep_contact_fm input[name='Name']").focus(); return false; }

        if ($.trim($("#findarep_contact_fm input[name='Email']").val()) == '')
        { alert("Please enter a value for the \"Email\" field."); $("#findarep_contact_fm input[name='Email']").focus(); return false; }
        if (!isEmail($("#findarep_contact_fm input[name='Email']").val()))
        { alert("Please enter a valid email address."); $("#findarep_contact_fm input[name='Email']").focus(); return false; }

        if ($.trim($("#findarep_contact_fm textarea[name='Comments']").val()) == '')
        { alert("Please enter a value for the \"Comments\" field."); $("#findarep_contact_fm textarea[name='Comments']").focus(); return false; }
    });

    $("#emailmapinfo_fm").submit(function () {
        if ($.trim($("#emailto").val()) == '')
        { alert("Please enter a recipient."); $("#emailto").focus(); return false; }
        if (!isEmail($("#emailto").val()))
        { alert("Please enter a valid recipient."); $("#emailto").focus(); return false; }

        if ($.trim($("#emailfrom").val()) == '' || !isEmail($("#emailfrom").val()))
        { alert("From email address is not valid."); $("#emailfrom").focus(); return false; }
    });

    bindFaRform();

    if ($.query.get('zip') != '') { $('input:[name="Zip"]').val($.query.get('zip')); }

    $('#country').hide();
    $('#country').val("US");

    $('#rbUS').click(function () {
        $('#country').hide();
        $('#divUS').show();
        $('#country').val("US");
        $('#Address').addClass('required');
        $('#City').addClass('required');
        $('#State').addClass('required');
        $('#Zip').addClass('required');
    });
    $('#rbIntl').click(function () {
        $('#country').show();
        $('#divUS').hide();
        $('#country').val("");
        $('#Address').removeClass('required');
        $('#City').removeClass('required');
        $('#State').removeClass('required');
        $('#Zip').removeClass('required');
    });




	$("#regsubmit").click(function(){
		if (jQuery("input#regFirstName").val()=="")
		{alert("Please enter a value for the \"First Name\" field.");jQuery("input#regFirstName").focus();return false;}
		if (jQuery("input#regFirstName").val().length<2)
		{alert("Please enter at least 2 characters in the \"First Name\" field.");jQuery("input#regFirstName").focus();return false;}
		if (!isValidInput(jQuery("input#regFirstName").val()))
		{alert("Please enter only letter, whitespace and \"-.\" characters in the \"First Name\" field.");jQuery("input#regFirstName").focus();return false;}

		if (jQuery("input#regLastName").val()=="")
		{alert("Please enter a value for the \"Last Name\" field.");jQuery("input#regLastName").focus();return false;}
		if (jQuery("input#regLastName").val().length<2)
		{alert("Please enter at least 2 characters in the \"Last Name\" field.");jQuery("input#regLastName").focus();return false;}
		if (!isValidInput(jQuery("input#regLastName").val()))
		{alert("Please enter only letter, whitespace and \"-.\" characters in the \"Last Name\" field.");jQuery("input#regLastName").focus();return false;}

		if (jQuery("input#regAddress").val()=="")
		{alert("Please enter a value for the \"Address\" field.");jQuery("input#regAddress").focus();return false;}

		if (jQuery("input#regCity").val()=="")
		{alert("Please enter a value for the \"City\" field.");jQuery("input#regCity").focus();return false;}

		if (jQuery("input#regState").val()=="")
		{alert("Please enter a value for the \"State\" field.");jQuery("input#regState").focus();return false;}

		if (jQuery("input#regPostalCode").val()=="")
		{alert("Please enter a value for the \"Zip\" field.");jQuery("input#regPostalCode").focus();return false;}

		if (jQuery("input#regPhone").val()=="")
		{alert("Please enter a value for the \"Phone\" field.");jQuery("input#regPhone").focus();return false;}

		if (jQuery("input#regEmail").val()=="")
		{alert("Please enter a value for the \"Email\" field.");jQuery("input#regEmail").focus();return false;}
		if (!isEmail(jQuery("input#regEmail").val()))
		{alert("Please enter a valid email address");jQuery("input#regEmail").focus();return false;}

		if (jQuery("select#regOccupation").val()=="")
		{alert("Please select a value for the \"Category\" field.");jQuery("select#regOccupation").focus();return false;}
		
		$.get('/ajax.asp?rand='+Math.random(),{Action:'formResults', FirstName:$('#regFirstName').val(),LastName:$('#regLastName').val(),Address:$('#regAddress').val(),City:$('#regCity').val(),State:$('#regState').val(),PostalCode:$('#regPostalCode').val(),Phone:$('#regPhone').val(),Email:$('#regEmail').val(),Occupation:$('#regOccupation').val(),Agree:$('#regAgree:checked').val()},function(data){
			if (data=="1")
			{$('#overlaymsgdv').show();setTimeout(function(){$('#overlaymsgdv').hide();},4000)}
		});

	});
	
	
        if ($('.con').length>1) {
        	$('.con:first').css('minHeight','25px');
        }



	
	if ($("#msdstable").length>0) {
	
		$.tablesorter.addParser({ 
		// set a unique id 
		id: 'sku', 
		is: function(s) { 
		    // return false so this parser is not auto detected 
		    return false; 
		}, 
		format: function(s) { 
		    // format your data for normalization 
		    //return s.toLowerCase().replace(/good/,2).replace(/medium/,1).replace(/bad/,0); 
		    //var posDash = s.indexOf('-');
		    //console.log(s.substring(0,posDash)+' | '+s);
		    //return s.substring(0,posDash);
		    //console.log(s.replace('-','.')+' | '+s);
		    
		    return s.replace('-','.');

		}, 
		// set type, either numeric or text 
		type: 'numeric' 
		}); 
		
		$("#msdstable").tablesorter({ 
	        sortList: [[0,0]],
	        headers: { 
	            0: {sorter: 'sku'},
	            2: { 
	                sorter: false 
	            }, 
	            3: { 
	                sorter: false 
	            }, 
	            4: { 
	                sorter: false 
	            } 
	        } 
        	});
        	
		$('#rightcol').hide();
		$('#content,.top,.middle,.bottom').css('background','none');
        }


	
	// for Interior Paints page
	if ($("#slidebox").length > 0)
	{
		$("#slidebox").scrollable({
			prev:"a.prev",
			next:"a.next",
			onSeek:function(event,i){
				var strText;
				strText = $('#slidebox .items img').eq(i).attr('alt');
				$('#slidebox .infodv').text(strText);
				//console.log(strText);
				switch(strText)
				{
				case 'Living Room':
					$('a.recommendedlink').attr('href','/homeowner/interior/living_room/');
					break;
				case 'Dining Room':
					$('a.recommendedlink').attr('href','/homeowner/interior/dining_room/');
					break;
				case 'Kitchen':
					$('a.recommendedLink').attr('href','/homeowner/interior/kitchen/');
					break;
				case 'Bedroom':
					$('a.recommendedLink').attr('href','/homeowner/interior/bedroom/');
					break;
				case 'Bathroom':
					$('a.recommendedLink').attr('href','/homeowner/interior/bathroom/');
					break;
				case 'Wood':
					$('a.recommendedLink').attr('href','/homeowner/exterior/wood/');
					break;
				case 'Stucco':
					$('a.recommendedLink').attr('href','/homeowner/exterior/stucco/');
					break;
				case 'Metal':
					$('a.recommendedLink').attr('href','/homeowner/exterior/metal/');
					break;
				case 'Door':
					$('a.recommendedLink').attr('href','/homeowner/exterior/door_trim/');
					break;
				case 'Porch':
					$('a.recommendedLink').attr('href','/homeowner/exterior/porch/');
					break;
				}			
				
				var width, height, imagepath;
				width = $('#interiorpaint_imgs img').eq(i).attr('width');
				height = $('#interiorpaint_imgs img').eq(i).attr('height');
				imagepath = $('#interiorpaint_imgs img').eq(i).attr('src');
				
				$('#bgresize').html('<img src="'+imagepath+'" width="'+width+'" height="'+height+'" alt="" />');
				//$("#bgresize").ezBgResize();
			}
		});
	}
	
	// for detail-bottom.asp
	if ($("#scrollable").length > 0)
	{
		$("#scrollable").scrollable({prev:".prev", next:".next"});
		
		$("a.prev").hide()
		if ($("#scrollable .itemdv").length < 3) $("a.next").hide();
		
		$("a.prev").click(function(){
			var curIndex = parseInt($("#scrollableindex").val()) - 1;
			var maxIndex = parseInt($("#scrollable .itemdv").length) - 2;
			
			if (curIndex < 0) curIndex = 0;
			
			$("#scrollableindex").val(curIndex);
			
			if (curIndex == 0) $("a.prev").hide();
			if (curIndex < maxIndex) $("a.next").show();
		});
		
		$("a.next").click(function(){
			var curIndex = parseInt($("#scrollableindex").val()) + 1;
			var maxIndex = parseInt($("#scrollable .itemdv").length) - 2;
			
			$("#scrollableindex").val(curIndex);
			
			if (curIndex > maxIndex) curIndex = maxIndex;
			if (curIndex == maxIndex) $("a.next").hide();
			if (curIndex > 0) $("a.prev").show();
		});
	}
	
	
	if ($('#colorcarousel').length > 0)
	{
		$('#colorcarousel').jcarousel({scroll:1});
		
		$('#colorcarousel a').click(function(){
			var imgWidth = $("#bgresize").width();
			
			var total = $('#colorcarousel li').length;
			var oldIndex = $('#colorcarousel li a').index($('#colorcarousel li a.cur'));
			var newIndex = $('#colorcarousel li a').index(this);
			
			if(oldIndex != newIndex)// && newIndex > 1 && newIndex < total - 2
			{
				if(newIndex >= oldIndex)
				{$('.jcarousel-next').trigger('click');}
				else
				{$('.jcarousel-prev').trigger('click');}
			}
			
			
			var arr = new Array();
			arr = $(this).attr('title').split('-----');
			var para1 = arr[0];
			var para2 = arr[1];
			var para3 = arr[2];
			if(typeof para3 == 'undefined') para3 = '';
			
			var para4 = $(this).children('img').attr('alt');
			$('#color_info').text(para1);
			$('#color_print').attr('href','/print.asp?para1='+para1+'&para2='+para2+'&para3='+para3+'&para4='+para4);
			
			
			//$('#main').css('background-image','url(/images/'+$(this).children('img').attr('alt')+')');
			$("#bgresize").html('<img width="'+imgWidth+'" src="http://kellymoore.s3.amazonaws.com/userfiles/image/'+$(this).children('img').attr('alt')+'" alt="" />');
			
			$('#colorcarousel li a').removeClass("cur");
			$(this).addClass("cur");
			$('#colorcarousel img').width('38px');
			$('#colorcarousel img').height('57px');
			$(this).children('img').width('44px');
			$(this).children('img').height('66px');
			$(this).blur();
		});
	}
	
	// request more information pop up
	if ($('#contactusdv').length > 0)
	{
		$("#contactusdv_link").click(function(){
			var box = new Boxy($("#contactusdv"), {modal: true});
			$("td.title-bar,td.boxy-inner").css("background","none");
			$("td.top-left,td.top-right,td.bottom-right,td.bottom-left,td.top,td.bottom,td.left,td.right").css({"background":"none","visibility":"hidden"});
		});
	}

	// FaR pop up
	if ($('#fardv').length > 0)
	{
		$("#far_link").click(function(){
			var box = new Boxy($("#fardv"), {modal: true});
			$("td.title-bar,td.boxy-inner").css("background","none");
			$("td.top-left,td.top-right,td.bottom-right,td.bottom-left,td.top,td.bottom,td.left,td.right").css({"background":"none","visibility":"hidden"});
			bindFaRform();
		});
	}


	$("#sweepslink").click(function(){
		var box = new Boxy($("#sweepsrulesdv"), {modal: true});
		$('#sweepsrulesdv *').css('color','white');
		//$("*").removeClass();
		//$("td.title-bar,td.boxy-inner").css("background","none");
		//$("td.top-left,td.top-right,td.bottom-right,td.bottom-left,td.top,td.bottom,td.left,td.right").css({"background":"none","visibility":"hidden"});
	});

	// tell a friend
	if ($('#tellafriend').length > 0)
	{
		$("#tellafriend_link").click(function(){
			var box = new Boxy($("#tellafriend"), {modal: true});
			//$("*").removeClass();
			$("td.title-bar,td.boxy-inner").css("background","none");
			$("td.top-left,td.top-right,td.bottom-right,td.bottom-left,td.top,td.bottom,td.left,td.right").css({"background":"none","visibility":"hidden"});
		});
		
		$("#emailto").change(function(){
			$("#tellafriend_fm input:submit").removeAttr("disabled");
			$("#success_info, #failure_info").hide();
		});
		
		$("#tellafriend_fm input:submit").click(function(){
			if($.trim($("#emailto").val())=='')
			{alert("Please enter a recipient.");$("#emailto").focus();return false;}
			if (!isEmail($("#emailto").val()))
			{alert("Please enter a valid recipient.");$("#emailto").focus();return false;}
			
			if($.trim($("#emailfrom").val())=='')
			{alert("Please enter your email address.");$("#emailfrom").focus();return false;}
			if (!isEmail($("#emailfrom").val()))
			{alert("Your email address is not valid, please change.");$("#emailfrom").focus();return false;}
			
			if($.trim($("#emailfullname").val())=='')
			{alert("Please enter your name.");$("#emailfullname").focus();return false;}
			//if($.trim($("#emailmessage").val())=='')
			//{alert("Please enter your message.");$("#emailmessage").focus();return false;}
			
			$.post("/tell-a-friend.asp?rand="+Math.random(), {emailto:$.trim($("#emailto").val()), emailfrom:$.trim($("#emailfrom").val()), emailfullname:$.trim($("#emailfullname").val()), emailmessage:$.trim($("#emailmessage").val())}, function(result){if(result=="1"){$("#failure_info").hide();$("#success_info").show();$("#tellafriend_fm input:submit").attr("disabled","disabled");}else{$("#success_info").hide();$("#failure_info").show();}});
			return false;
		});
	}
	
	
	// validation
	$("#contactus_fm,#contactus_fm2,#colorform_fm,#intlcontact_fm,#dealercontact_fm").validate();
	
	if ($('#bgresize').length!=0) {
		$("#bgresize").ezBgResize();
	}
	
});



$(document).ready(function(){
	if ($('#warranty_fm').length > 0)
	{
		Date.format = 'mm/dd/yyyy';
		
		$('#warranty_fm').validate();
		
		$('#StartDate').datePicker({autoFocusNextInput: true, startDate:'01/01/2000'});
		$('#EndDate').datePicker({autoFocusNextInput: true, startDate:'01/01/2000'});
		
		$('#AppliedBy').change(function(){
			var appliedBy = $('#AppliedBy').val();
			
			if (appliedBy == 'Property Owner')
			{
				$('#PropertyOwner').show();
				$('#PropertyOwner input:text[name!="OwnerEmail"]').attr('class','required');
				
				$('#PaintingContractor').hide();
				$('#PaintingContractor input:text[name!="ContractorEmail"]').removeAttr('class');
			}
			else if (appliedBy == 'Painting Contractor')
			{
				$('#PaintingContractor').show();
				$('#PaintingContractor input:text[name!="ContractorEmail"]').attr('class','required');
				
				$('#PropertyOwner').hide();
				$('#PropertyOwner input:text[name!="OwnerEmail"]').removeAttr('class');
				//$('#PaintingContractor input:text[name!="ContractorEmail"]').attr('class','required');
				//$('#PaintingContractor,#PropertyOwner').show();
			}
			else if (appliedBy == 'Painting Contractor,Property Owner')
			{
				$('#PropertyOwner input:text[name!="OwnerEmail"]').attr('class','required');
				$('#PaintingContractor input:text[name!="ContractorEmail"]').attr('class','required');
				$('#PaintingContractor,#PropertyOwner').show();
			}
			else
			{}
			
			$('#ContractorEmail, #OwnerEmail').attr('class','email');
		});
		
		$('#ForWarrantyOption').change(function(){
			var addressForWarranty, cityForWarranty, stateForWarranty, zipForWarranty;
			var option = $('#ForWarrantyOption').val();
			
			if (option == 'PaintingContractor')
			{
				addressForWarranty = $('#ContractorAddress').val();
				cityForWarranty = $('#ContractorCity').val();
				stateForWarranty = $('#ContractorState').val();
				zipForWarranty = $('#ContractorZip').val();
			}
			else if (option == 'PropertyOwner')
			{
				addressForWarranty = $('#OwnerAddress').val();
				cityForWarranty = $('#OwnerCity').val();
				stateForWarranty = $('#OwnerState').val();
				zipForWarranty = $('#OwnerZip').val();
			}
			else if (option == 'Other')
			{
				addressForWarranty = '';
				cityForWarranty = '';
				stateForWarranty = '';
				zipForWarranty = '';
			}
			
			$('#AddressForWarranty').val(addressForWarranty);
			$('#CityForWarranty').val(cityForWarranty);
			$('#StateForWarranty').val(stateForWarranty);
			$('#ZipForWarranty').val(zipForWarranty);
		});
	}
});




function bindFaRform(){
	//alert('validate!');
	$('#far').validate();
	$('#expertise').change(function(){
		if ($('#expertise').val()=='Other' && $('input#expertise').length==0) {
			$('#expertisecon').append('<input type="text" value="" name="expertise" id="expertise" class="text required">');
		}else{
			$('input#expertise').remove();
		}
	});
	
}
