jQuery.noConflict();

// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
	// Remove Prefilled Text
	jQuery(".preFillField").blur(function(){
		if(jQuery(this).val() == ""){
			jQuery(this).val(jQuery(this).attr('title'));
			jQuery(this).removeClass("preFillData");
		}
	}).focus(function(){
		if(jQuery(this).val() == jQuery(this).attr('title')){
			jQuery(this).val("");
			jQuery(this).addClass('preFillData');
		}
	});

	// Simple Form - Sunscreen Percent Fadein/out
	jQuery("#checkSunscreen").click(function(){
		if(jQuery("#checkSunscreen").is(":checked")){
			jQuery("#simpleSunscreenWrapper").fadeIn();
		}else{
			jQuery("#simpleSunscreenWrapper").fadeOut();
		}
	});

	// Simple Form - light fixtures
	jQuery("#checkLightFixture").click(function(){
		if(jQuery("#checkLightFixture").is(":checked")){
			jQuery("#simpleNumLightFixtures").fadeIn();
		}else{
			jQuery("#simpleNumLightFixtures").fadeOut();
		}
	});


	// French Panes slide
	jQuery("#infusion_custom_Frenchies").change(function(){
		if(jQuery(this).val() == "Yes"){
			jQuery("#hasFrenchPanes").fadeIn();
		}else{
			jQuery("#hasFrenchPanes").fadeOut();
		}
	});

	// screens section
	jQuery("#screenCleanCheck").click(function(){
		if(jQuery("#screenCleanCheck").is(":checked")){
			jQuery("#screenWrapper").fadeIn();
		}else{
			jQuery("#screenWrapper").fadeOut();
		}
	});


	//Powerwash section sliders
	jQuery("#pwHouseWash").click(function(){
		if(jQuery("#pwHouseWash").is(":checked")){
			jQuery("#pwHouseWashHidden").fadeIn();
		}else{
			jQuery("#pwHouseWashHidden").fadeOut();
		}
	});

	jQuery("#pwDriveway").click(function(){
		if(jQuery("#pwDriveway").is(":checked")){
			jQuery("#pwDrivewayHidden").fadeIn();
		}else{
			jQuery("#pwDrivewayHidden").fadeOut();
		}
	});

	jQuery("#pwOther").click(function(){
		if(jQuery("#pwOther").is(":checked")){
			jQuery("#pwOtherHidden").fadeIn();
		}else{
			jQuery("#pwOtherHidden").fadeOut();
		}
	});


	//hardwater Slide (exact form)
	jQuery("#Custom-HardWater").change(function(){
		if(jQuery(this).val() == "Yes"){
			jQuery("#hasHardWater").fadeIn();
		}else{
			jQuery("#hasHardWater").fadeOut();
		}
	});

	// Open the correct form type (simple or exact bid)
	jQuery("#fcExactBid").click(function(){
		jQuery("#simpleFormWrapper").hide();
//		jQuery("#exactFormSections, #exactFormWrapper").fadeIn('slow');
		jQuery("#exactFormSections, #exactFormWrapper").show();
		jQuery("#formType").val("exact");
		jQuery("#exactFormWrapper :input").attr('disabled', false);
		jQuery("#simpleFormWrapper :input").attr('disabled', true);

	});

	jQuery("#fcSimpleBid").click(function(){
		jQuery("#exactFormSections, #exactFormWrapper").hide();
//		jQuery("#simpleFormWrapper").fadeIn();
		jQuery("#simpleFormWrapper").show();
		jQuery("#formType").val("simple");
		jQuery("#simpleFormWrapper :input").attr('disabled', false);
		jQuery("#exactFormWrapper :input").attr('disabled', true);
	});

	// End open correct type

	// Make Sure that if boxes are checked the areas stay open if page is refreshed


	if(jQuery("#formType").val() == "simple"){
		jQuery("#simpleFormWrapper").show();
	}
	if(jQuery("#formType").val() == "exact"){
		jQuery("#exactFormSections, #exactFormWrapper").show();


		if(jQuery("#checkWindowCleaning").is(":checked")){
			jQuery("#sectionWindowCleaning").show();
		}

		if(jQuery("#checkPowerWashing").is(":checked")){
			jQuery("#sectionPowerWashing").show();
		}

		if(jQuery("#checkWindowTinting").is(":checked")){
			jQuery("#sectionWindowTinting").show();
		}

		if(jQuery("#checkOther").is(":checked")){
			jQuery("#sectionOther").show();
		}
		
	}
	// End stay open


	//  If leadsource is friend - show who referred
	jQuery("#Contact0LeadSourceId").change(function(){
		if(jQuery(this).val() == 8){
			jQuery("#whoReferred").fadeIn('slow').after("<br />");
//			jQuery("#whoReferred").show();
		}else{
			jQuery("#whoReferred").fadeOut('slow');
		}
	});
	

	// When they select the type of service, show section
	jQuery(".serviceOption").click(function(){
		if(jQuery(this).is(":checked")){
			jQuery("#section"+jQuery(this).attr("alt")).fadeIn(800);
		}else{
			jQuery("#section"+jQuery(this).attr("alt")).fadeOut();
		}
	});




});

