/***************************************** Background Images *****************************************/

$(window).bind("load", function() {

	if($.browser.version!="6.0") {
		$('.bg-wrapper').prepend('<img src="'+TEMPLATE_URL+'/images/home-bg-1.jpg" width="1600" height="855"><img src="'+TEMPLATE_URL+'/images/home-bg-2.jpg" width="1600" height="855"><img src="'+TEMPLATE_URL+'/images/home-bg-3.jpg" width="1600" height="855">');
	
		
		if(screen.width>1600){
			
			var screenWidth = screen.width;
			var screenHeight = screen.height;
			var marginFix = screen.width / 2;
			
			$('.bg-wrapper img, .bg-wrapper-residential img, .bg-wrapper-commercial img,').attr("width", screenWidth);
			$('.bg-wrapper, .bg-wrapper-residential, .bg-wrapper-commercial').css("margin", "0 auto 0 -"+marginFix+"px");
			
			$('.bg-wrapper img, .bg-wrapper-residential img, .bg-wrapper-commercial img').attr("height", screenHeight);
			
		}
		
		$('.bg-wrapper').cycle({
			fx: 'fade', // ex: fade, scrollUp, shuffle
			timeout: 0,
			delay: -1000,
			speed: 400,
			random: 1
		});
		
		
		if(location.pathname.indexOf('/residential') != -1) {
			
			$('.bg-wrapper-residential').css('display', 'block');
			$('.bg-wrapper-commercial').css('display', 'none');
			$('.bg-wrapper').css('display', 'none');
		
			$('.bg-wrapper-residential').cycle({
				fx: 'fade', // ex: fade, scrollUp, shuffle
				timeout: 0,
				delay: -1000,
				speed: 400,
				random: 1
			});
		
		}
		
		if(location.pathname.indexOf('/commercial') != -1) {
			
			$('.bg-wrapper-commercial').css('display', 'block');
			$('.bg-wrapper-residential').css('display', 'none');
			$('.bg-wrapper').css('display', 'none');
		
			$('.bg-wrapper-commercial').cycle({
				fx: 'fade', // ex: fade, scrollUp, shuffle
				timeout: 0,
				delay: -1000,
				speed: 400,
				random: 1
			});
		
		}
		
		// Clear the images for a more optimized experience
		$('.bg-wrapper img:hidden, .bg-wrapper-residential img:hidden, .bg-wrapper-commercial img:hidden, .bg-wrapper:hidden, .bg-wrapper-residential:hidden, .bg-wrapper-commercial:hidden').remove();
	}
	
});

/************************************** Preload Images ******************************************/
$(document).ready(function(){
	
	(function($j) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
		  var cacheImage = document.createElement('img');
		  cacheImage.src = arguments[i];
		  cache.push(cacheImage);
		}
	  }
	})($)
	
	$.preLoadImages(""+TEMPLATE_URL+"/images/capitalcredit-li-bg.png",
					 ""+TEMPLATE_URL+"/images/home-form-bg.png");
});

/***************************************** onfocus onblur events *****************************************/
$(document).ready(function() {
	$.fn.search = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
	$(':input:not(input[type=checkbox])').search();
});

/***************************************** Left Side Navigation *****************************************/
$(document).ready(function() {
	$('.menu ul :last-child').css('border', '0');
});

/***************************************** Archive Button (News Page) *****************************************/
$(document).ready(function() {
	$('.block-news-bottom').click(function() {
		window.location = $(this).attr('url');
	});
});

/***************************************** Layered Navigation *****************************************/
$(document).ready(function() {
	if(!$('.lay-nav .menu ul li').length) {
		$('.block-community-top, .block-community-bottom, .block-community').hide();
	}
});

/***************************************** Zoomer (History Timeline) *****************************************/
$(document).ready(function(){
	if($('#timeline').length) {
		new Zoomer('#timeline');
	}
});

/***************************************** Capital Credits *****************************************/
$(document).ready(function(){
	
	//What
	$('.capital-credits-block-links li.what-btn').stop(true, true).hover(
	function() {
		$(this).addClass('hover');
		$(this).prev().addClass('remove-border');
	},
	function() {
		$(this).removeClass('hover');
		$(this).prev().removeClass('remove-border');
	});
	
	$('.capital-credits-block-links li.what-btn').click(function() {
		$('.capital-credits-block-content').hide();
		$('.capital-credits-info div').hide();
		$('.capital-credits-info div.what').fadeIn('fast');
		$('.capital-credits-block-content.what-title').fadeIn('fast');
	});
	
	//Why
	$('.capital-credits-block-links li.why-btn').stop(true, true).hover(
	function() {
		$(this).addClass('hover');
		$(this).prev().addClass('remove-border');
	},
	function() {
		$(this).removeClass('hover');
		$(this).prev().removeClass('remove-border');
	});
	
	$('.capital-credits-block-links li.why-btn').click(function() {
		$('.capital-credits-block-content').hide();
		$('.capital-credits-info div').hide();
		$('.capital-credits-info div.why').fadeIn('fast');
		$('.capital-credits-block-content.why-title').fadeIn('fast');
	});
	
	//How
	$('.capital-credits-block-links li.how-btn').stop(true, true).hover(
	function() {
		$(this).addClass('hover');
		$(this).prev().addClass('remove-border');
	},
	function() {
		$(this).removeClass('hover');
		$(this).prev().removeClass('remove-border');
	});
	
	$('.capital-credits-block-links li.how-btn').click(function() {
		$('.capital-credits-block-content').hide();
		$('.capital-credits-info div').hide();
		$('.capital-credits-info div.how').fadeIn('fast');
		$('.capital-credits-block-content.how-title').fadeIn('fast');
	});
	
	//Who
	$('.capital-credits-block-links li.who-btn').stop(true, true).hover(
	function() {
		$(this).addClass('hover');
		$(this).prev().addClass('remove-border');
	},
	function() {
		$(this).removeClass('hover');
		$(this).prev().removeClass('remove-border');
	});
	
	$('.capital-credits-block-links li.who-btn').click(function() {
		$('.capital-credits-block-content').hide();
		$('.capital-credits-info div').hide();
		$('.capital-credits-info div.who').fadeIn('fast');
		$('.capital-credits-block-content.who-title').fadeIn('fast');
	});
	
	//Where
	$('.capital-credits-block-links li.where-btn').stop(true, true).hover(
	function() {
		$(this).addClass('hover');
		$(this).prev().addClass('remove-border');
	},
	function() {
		$(this).removeClass('hover');
		$(this).prev().removeClass('remove-border');
	});
	
	$('.capital-credits-block-links li.where-btn').click(function() {
		$('.capital-credits-block-content').hide();
		$('.capital-credits-info div').hide();
		$('.capital-credits-info div.where').fadeIn('fast');
		$('.capital-credits-block-content.where-title').fadeIn('fast');
	});
});

/***************************************** Residential - Get Service *****************************************/
$(document).ready(function(){
	$('.get-service .service :checkbox').click(function() {
		$('.get-service .service :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service .commercial-service :checkbox').click(function() {
		$('.get-service .commercial-service :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service .business-type :checkbox').click(function() {
		$('.get-service .business-type :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service .joint-membership :checkbox').click(function() {
		$('.get-service .joint-membership :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	
	$('.get-service .participate :checkbox').click(function() {
		$('.get-service .participate :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service .owner :checkbox').click(function() {
		$('.get-service .owner :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.billing-check :checkbox').click(function() {
		$('.billing-check :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
});

/***************************************** Commercial - Get Service *****************************************/
$(document).ready(function(){
	$('.get-service-commercial .service :checkbox').click(function() {
		$('.get-service-commercial .service :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service-commercial .commercial-service :checkbox').click(function() {
		$('.get-service-commercial .commercial-service :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service-commercial .business-type :checkbox').click(function() {
		$('.get-service-commercial .business-type :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service-commercial .joint-membership :checkbox').click(function() {
		$('.get-service-commercial .joint-membership :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	
	$('.get-service-commercial .participate :checkbox').click(function() {
		$('.get-service-commercial .participate :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.get-service-commercial .owner :checkbox').click(function() {
		$('.get-service-commercial .owner :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
	$('.billing-check :checkbox').click(function() {
		$('.billing-check :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
	
});

/***************************************** Residential - Budget Billing *****************************************/
$(document).ready(function(){
	$('.budgetbilling-module :checkbox').click(function() {
		$('.budgetbilling-module :checkbox').attr('checked', false);
		$(this).attr('checked', true);
	});
});

/***************************************** Home Login *****************************************/
function changeToLogin() {
	if($('.form-image:visible')) {
		$('.form-image').hide();
		$('.form-wrap').fadeIn();
	}
}

$(document).ready(function(){
	$('#password').focus(function () {
		$('.form-content label').hide();
	});
});

/***************************************** Residential - Get Service (Validate) *****************************************/
$(document).ready(function(){
	
	$('.get-service input[name=owner[]]').click(function() {

		if($('#owner-no').is(':checked')) {
			$('.owner-address').fadeIn('fast');
		} else {
			$('.owner-address').fadeOut('fast');
		}
		
	});
	
	$('.get-service input[name=billing[]]').click(function() {

		if($('#billing-no').is(':checked')) {
			$('.billing-address').fadeIn('fast');
		} else {
			$('.billing-address').fadeOut('fast');
		}
		
	});
	
	$('.get-service input[name=joint[]]').click(function() {

		if($('#joint-yes').is(':checked')) {
			$('.spouse-info').fadeIn('fast');
		} else {
			$('.spouse-info').fadeOut('fast');
		}
		
	});
	
	$('.get-service').submit(function(e) {
		
		e.preventDefault();
		
		$('.notification').html('');
								
		var begin_service_date = $('.get-service input[name=begin_service_date]').val();
		var service_type = $('.get-service input[name=service_type[]]:checked').val();
		var full_name = $('.get-service input[name=full_name]').val();
		var social_security = $('.get-service input[name=social_security]').val();
		var service_address = $('.get-service input[name=service_address]').val();
		var service_city = $('.get-service input[name=service_city]').val();
		var service_state = $('.get-service input[name=service_state]').val();
		var service_zip = $('.get-service input[name=service_zip]').val();
		
		if($('#billing-yes').is(':checked')) {
			
			
		} else if($('#billing-no').is(':checked')) {
			var billing_address = $('.get-service input[name=billing_address]').val();
			var billing_city = $('.get-service input[name=billing_city]').val();
			var billing_state = $('.get-service input[name=billing_state]').val();
			var billing_zip = $('.get-service input[name=billing_zip]').val();
			
			if(billing_address == 'Billing Address') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing Address.</p>');
			}
			
			if(billing_city == 'City') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing City.</p>');
			}
			
			if(billing_state == 'State') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing State.</p>');
			}
			
			if(billing_zip == 'Zip') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing Zip.</p>');
			}
			
		}
		
		var home_phone = $('.get-service input[name=home_phone]').val();
		var cell_phone = $('.get-service input[name=cell_phone]').val();
		var email = $('.get-service input[name=email]').val();
		var best_number = $('#best-number').val();
		var previous_address = $('.get-service input[name=previous_address]').val();
		var previous_city = $('.get-service input[name=previous_city]').val();
		var previous_state = $('.get-service input[name=previous_state]').val();
		var previous_zip = $('.get-service input[name=previous_zip]').val();
		var previous_utility = $('.get-service input[name=previous_utility]').val();
		/*
		var employer = $('.get-service input[name=employer]').val();
		var employer_phone = $('.get-service input[name=employer_phone]').val();
		var employer_address = $('.get-service input[name=employer_address]').val();
		var employer_city = $('.get-service input[name=employer_city]').val();
		var employer_state = $('.get-service input[name=employer_state]').val();
		var employer_zip = $('.get-service input[name=employer_zip]').val();
		*/
		if($('#joint-yes').is(':checked')) {
			if($('.get-service input[name=spouse_name]').val() != 'Spouse Name') {
				var spouse_name = $('.get-service input[name=spouse_name]').val();
				var spouse_social_security = $('.get-service input[name=spouse_social_security]').val();
				var spouse_phone_number = $('.get-service input[name=spouse_phone_number]').val();
				/*
				var spouse_employer = $('.get-service input[name=spouse_employer]').val();
				var spouse_employer_phone = $('.get-service input[name=spouse_employer_phone]').val();
				var spouse_employer_address = $('.get-service input[name=spouse_employer_address]').val();
				var spouse_employer_city = $('.get-service input[name=spouse_employer_city]').val();
				var spouse_employer_state = $('.get-service input[name=spouse_employer_state]').val();
				var spouse_employer_zip = $('.get-service input[name=spouse_employer_zip]').val();
				*/
			}
		}
		
		var joint = $('.get-service input[name=joint[]]:checked').val();
		var participate = $('.get-service input[name=participate[]]:checked').val();
		var owner = $('.get-service input[name=owner[]]:checked').val();
		
		if($('#owner-no').is(':checked')) {
			
			var owner_name = $('.get-service input[name=owner_name]').val();
			var lease_length = $('.get-service input[name=lease_length]').val();
			var owner_address = $('.get-service input[name=owner_address]').val();
			var owner_city = $('.get-service input[name=owner_city]').val();
			var owner_state = $('.get-service input[name=owner_state]').val();
			var owner_zip = $('.get-service input[name=owner_zip]').val();
			
			if(owner_name == 'Owner') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner.</p>');
			}
			
			if(lease_length == 'Length of Lease (Months)') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the lease length.</p>');
			}
			
			if(owner_address == 'Owner Address') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner address.</p>');
			}
			
			if(owner_city == 'City') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner city.</p>');
			}
			
			if(owner_state == 'State') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner state.</p>');
			}
			
			if(owner_zip == 'Zip') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner state.</p>');
			}
			
		}
				
		if(begin_service_date == 'Date to Begin Service MM/DD/YYYY') {
			$('.notification').fadeIn('fast').append('<p>Date of service must be filled out.</p>');
		}
		
		if(service_type == null) {
			$('.notification').fadeIn('fast').append('<p>Need to fill out service type (Electric, Gas, Both).</p>');
		}
		
		if(full_name == 'Full Name') {
			$('.notification').fadeIn('fast').append('<p>Need to fill in your full name.</p>');
		}
		
		if(social_security == 'Social Security # (last 4 digits)' || social_security.length > 4) {
			$('.notification').fadeIn('fast').append('<p>Need to provide the last 4 digits of your social security number.</p>');
		}
		
		if(service_address == 'Service Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service Address.</p>');
		}
		
		if(service_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service City.</p>');
		}
		
		if(service_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service State.</p>');
		}
		
		if(service_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service Zip.</p>');
		}
				
		if(home_phone == 'Home Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your home phone.</p>');
		}
		
		if(cell_phone == 'Cell Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your cell phone.</p>');
		}
		
		if(best_number == 'Best number to contact you') {
			$('.notification').fadeIn('fast').append('<p>Need to provide a phone number to be reached.</p>');
		}
		
		if(email == 'Email') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your email.</p>');
		}
		
		if(previous_address == 'Previous Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous address.</p>');
		}
		
		if(previous_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous city.</p>');
		}
		
		if(previous_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous state.</p>');
		}
		
		if(previous_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous zip.</p>');
		}
		
		if(previous_utility == 'Previous Electric Utility') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous zip.</p>');
		}
		
		/*
		if(employer == 'Employer') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your current employer.</p>');
		}
		
		if(employer_phone == 'Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer phone number.</p>');
		}
		
		if(employer_address == 'Employer Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer address.</p>');
		}
		
		if(employer_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer city.</p>');
		}
		
		if(employer_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer state.</p>');
		}
		
		if(employer_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer zip.</p>');
		}
		*/
		
		if($('#joint-yes').is(':checked')) {
			
			if(spouse_name == 'Spouse Name') {
				$('.notification').fadeIn('fast').append('<p>Need to provide a Spouse Name.</p>');
			}
			
			if(spouse_phone_number == 'Spouse Phone Number') {
				$('.notification').fadeIn('fast').append('<p>Need to provide a your Spouse\'s Phone Number/p>');
			}
			
			if(spouse_social_security == 'Spouse Social Security # (last 4 digits)' || spouse_social_security.length > 4) {
				$('.notification').fadeIn('fast').append('<p>Need to provide a your Spouse\'s last four digits of her Social Security number.</p>');
			}
			
		}
		
		if(!$('.get-service input[name=primary_yes]').is(':checked')) {
			$('.notification').fadeIn('fast').append('<p>Need to agree with terms of agreement.</p>');
		}
		
		if(!$('.notification p').length) {
			
			var fields = 'begin_service_date='+begin_service_date+'&'+
			'service_type='+service_type+'&'+
			'full_name='+full_name+'&'+
			'social_security='+social_security+'&'+
			'service_address='+service_address+'&'+
			'service_city='+service_city+'&'+
			'service_state='+service_state+'&'+
			'service_zip='+service_zip+'&'+
			'billing_address='+billing_address+'&'+
			'billing_city='+billing_city+'&'+
			'billing_state='+billing_state+'&'+
			'billing_zip='+billing_zip+'&'+
			'home_phone='+home_phone+'&'+
			'cell_phone='+cell_phone+'&'+
			'email='+email+'&'+
			'best_number='+best_number+'&'+
			'previous_address='+previous_address+'&'+
			'previous_city='+previous_city+'&'+
			'previous_state='+previous_state+'&'+
			'previous_zip='+previous_zip+'&'+
			'previous_utility='+previous_utility+'&'+
			/*
			'employer='+employer+'&'+
			'employer_phone='+employer_phone+'&'+
			'employer_address='+employer_address+'&'+
			'employer_city='+employer_city+'&'+
			'employer_state='+employer_state+'&'+
			'employer_zip='+employer_zip+'&'+
			*/
			'spouse_name='+spouse_name+'&'+
			'spouse_social_security='+spouse_social_security+'&'+
			'spouse_phone_number='+spouse_phone_number+'&'+
			/*
			'spouse_employer='+spouse_employer+'&'+
			'spouse_employer_phone='+spouse_employer_phone+'&'+
			'spouse_employer_address='+spouse_employer_address+'&'+
			'spouse_employer_city='+spouse_employer_city+'&'+
			'spouse_employer_state='+spouse_employer_state+'&'+
			'spouse_employer_zip='+spouse_employer_zip+'&'+
			*/
			'joint='+joint+'&'+
			'participate='+participate+'&'+
			'owner='+owner+'&'+
			'owner_name='+owner_name+'&'+
			'lease_length='+lease_length+'&'+
			'owner_address='+owner_address+'&'+
			'owner_city='+owner_city+'&'+
			'owner_state='+owner_state+'&'+
			'owner_zip='+owner_zip;
			
			$.ajax({
				  type: 'POST',
				  url: BASE_URL+'get-service',
				  data: fields,
				  success: function(data) {
					$('.notification').fadeIn('fast').html('<p style="color: #315236 !important">Thank you for submitting our get service form!</p>');
				  }
			});
		}
	
	});	
	
		
	
});

/***************************************** Commercial - Get Service (Validate) *****************************************/
$(document).ready(function(){
	
	$('.get-service-commercial input[name=owner[]]').click(function() {

		if($('#owner-no').is(':checked')) {
			$('.owner-address').fadeIn('fast');
		} else {
			$('.owner-address').fadeOut('fast');
		}
		
	});
	
	$('.get-service-commercial input[name=billing[]]').click(function() {

		if($('#billing-no').is(':checked')) {
			$('.billing-address').fadeIn('fast');
		} else {
			$('.billing-address').fadeOut('fast');
		}
		
	});
		
	$('.get-service-commercial').submit(function(e) {
		
		e.preventDefault();
		
		$('.notification').html('');
								
		var begin_service_date = $('.get-service-commercial input[name=begin_service_date]').val();
		var service_type = $('.get-service-commercial input[name=service_type[]]:checked').val();
		var business_name = $('.get-service-commercial input[name=business_name]').val();
		var business_contact = $('.get-service-commercial input[name=business_contact]').val();
		var business_type = $('.get-service-commercial input[name=business_type[]]:checked').val();
		var tax_id = $('.get-service-commercial input[name=tax_id]').val();
		var social_security = $('.get-service-commercial input[name=social_security]').val();
		var service_address = $('.get-service-commercial input[name=service_address]').val();
		var service_city = $('.get-service-commercial input[name=service_city]').val();
		var service_state = $('.get-service-commercial input[name=service_state]').val();
		var service_zip = $('.get-service-commercial input[name=service_zip]').val();
		
		if($('#billing-yes').is(':checked')) {
			
			
		} else if($('#billing-no').is(':checked')) {
			
			var billing_address = $('.get-service-commercial input[name=billing_address]').val();
			var billing_city = $('.get-service-commercial input[name=billing_city]').val();
			var billing_state = $('.get-service-commercial input[name=billing_state]').val();
			var billing_zip = $('.get-service-commercial input[name=billing_zip]').val();
			
			if(billing_address == 'Billing Address') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing Address.</p>');
			}
			
			if(billing_city == 'City') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing City.</p>');
			}
			
			if(billing_state == 'State') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing State.</p>');
			}
			
			if(billing_zip == 'Zip') {
				$('.notification').fadeIn('fast').append('<p>Need to provide the Billing Zip.</p>');
			}
			
		}
		
		var home_phone = $('.get-service-commercial input[name=home_phone]').val();
		var cell_phone = $('.get-service-commercial input[name=cell_phone]').val();
		var email = $('.get-service-commercial input[name=email]').val();
		var best_number = $('#best-number').val();
		var previous_address = $('.get-service-commercial input[name=previous_address]').val();
		var previous_city = $('.get-service-commercial input[name=previous_city]').val();
		var previous_state = $('.get-service-commercial input[name=previous_state]').val();
		var previous_zip = $('.get-service-commercial input[name=previous_zip]').val();
		var previous_utility = $('.get-service-commercial input[name=previous_utility]').val();
		/*
		var employer = $('.get-service-commercial input[name=employer]').val();
		var employer_phone = $('.get-service-commercial input[name=employer_phone]').val();
		var employer_address = $('.get-service-commercial input[name=employer_address]').val();
		var employer_city = $('.get-service-commercial input[name=employer_city]').val();
		var employer_state = $('.get-service-commercial input[name=employer_state]').val();
		var employer_zip = $('.get-service-commercial input[name=employer_zip]').val();
		
		if($('.get-service-commercial input[name=spouse_name]').val() != 'Spouse\'s Full Name') {
			var spouse_name = $('.get-service-commercial input[name=spouse_name]').val();
			var spouse_social_security = $('.get-service-commercial input[name=spouse_social_security]').val();
			
			var spouse_employer = $('.get-service-commercial input[name=spouse_employer]').val();
			var spouse_employer_phone = $('.get-service-commercial input[name=spouse_employer_phone]').val();
			var spouse_employer_address = $('.get-service-commercial input[name=spouse_employer_address]').val();
			var spouse_employer_city = $('.get-service-commercial input[name=spouse_employer_city]').val();
			var spouse_employer_state = $('.get-service-commercial input[name=spouse_employer_state]').val();
			var spouse_employer_zip = $('.get-service-commercial input[name=spouse_employer_zip]').val();
			
		}
		*/
		var joint = $('.get-service-commercial input[name=joint[]]:checked').val();
		var participate = $('.get-service-commercial input[name=participate[]]:checked').val();
		var owner = $('.get-service-commercial input[name=owner[]]:checked').val();
		
		if($('#owner-no').is(':checked')) {
			
			var owner_name = $('.get-service-commercial input[name=owner_name]').val();
			var lease_length = $('.get-service-commercial input[name=lease_length]').val();
			var owner_address = $('.get-service-commercial input[name=owner_address]').val();
			var owner_city = $('.get-service-commercial input[name=owner_city]').val();
			var owner_state = $('.get-service-commercial input[name=owner_state]').val();
			var owner_zip = $('.get-service-commercial input[name=owner_zip]').val();
			
			if(owner_name == 'Owner') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner.</p>');
			}
			
			if(lease_length == 'Length of Lease (Months)') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the lease length.</p>');
			}
			
			if(owner_address == 'Owner Address') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner address.</p>');
			}
			
			if(owner_city == 'City') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner city.</p>');
			}
			
			if(owner_state == 'State') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner state.</p>');
			}
			
			if(owner_zip == 'Zip') {
				$('.notification').fadeIn('fast').append('<p>Need to fill out the owner state.</p>');
			}
			
		}
				
		if(begin_service_date == 'Date to Begin Service MM/DD/YYYY') {
			$('.notification').fadeIn('fast').append('<p>Date of service must be filled out.</p>');
		}
		
		if(service_type == null) {
			$('.notification').fadeIn('fast').append('<p>Need to fill out service type (Electric, Gas, Both).</p>');
		}
		
		if(business_name == 'business Name') {
			$('.notification').fadeIn('fast').append('<p>Need to fill in your business name.</p>');
		}
		
		if(business_contact == 'business Contact') {
			$('.notification').fadeIn('fast').append('<p>Need to fill in your business contact.</p>');
		}
		
		if(business_type == null) {
			$('.notification').fadeIn('fast').append('<p>Need to select your business type.</p>');
		}
		
		if(social_security == 'Social Security # (last 4 digits)' || social_security.length > 4) {
			$('.notification').fadeIn('fast').append('<p>Need to provide the last 4 digits of your social security number.</p>');
		}
		
		if(service_address == 'Service Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service Address.</p>');
		}
		
		if(service_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service City.</p>');
		}
		
		if(service_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service State.</p>');
		}
		
		if(service_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide the Service Zip.</p>');
		}
				
		if(home_phone == 'Home Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your home phone.</p>');
		}
		
		if(cell_phone == 'Cell Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your cell phone.</p>');
		}
		
		if(best_number == 'Best number to contact you') {
			$('.notification').fadeIn('fast').append('<p>Need to provide a phone number to be reached.</p>');
		}
		
		if(email == 'Email') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your email.</p>');
		}
		
		if(previous_address == 'Previous Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous address.</p>');
		}
		
		if(previous_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous city.</p>');
		}
		
		if(previous_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous state.</p>');
		}
		
		if(previous_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous zip.</p>');
		}
		
		if(previous_utility == 'Previous Electric Utility') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your previous zip.</p>');
		}
		
		if(tax_id == 'Tax ID') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your tax id.</p>');
		}
		
		/*
		if(employer == 'Employer') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your current employer.</p>');
		}
		
		if(employer_phone == 'Phone') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer phone number.</p>');
		}
		
		if(employer_address == 'Employer Address') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer address.</p>');
		}
		
		if(employer_city == 'City') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer city.</p>');
		}
		
		if(employer_state == 'State') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer state.</p>');
		}
		
		if(employer_zip == 'Zip') {
			$('.notification').fadeIn('fast').append('<p>Need to provide your employer zip.</p>');
		}
		*/
				
		if(!$('.get-service-commercial input[name=primary_yes]').is(':checked')) {
			$('.notification').fadeIn('fast').append('<p>Need to agree with terms of agreement.</p>');
		}
		
		if(!$('.notification p').length) {
			
			var fields = 'begin_service_date='+begin_service_date+'&'+
			'service_type='+service_type+'&'+
			'business_name='+business_name+'&'+
			'business_contact='+business_contact+'&'+
			'business_type='+business_type+'&'+
			'social_security='+social_security+'&'+
			'service_address='+service_address+'&'+
			'service_city='+service_city+'&'+
			'service_state='+service_state+'&'+
			'service_zip='+service_zip+'&'+
			'billing_address='+billing_address+'&'+
			'billing_city='+billing_city+'&'+
			'billing_state='+billing_state+'&'+
			'billing_zip='+billing_zip+'&'+
			'home_phone='+home_phone+'&'+
			'cell_phone='+cell_phone+'&'+
			'email='+email+'&'+
			'best_number='+best_number+'&'+
			'previous_address='+previous_address+'&'+
			'previous_city='+previous_city+'&'+
			'previous_state='+previous_state+'&'+
			'previous_zip='+previous_zip+'&'+
			'previous_utility='+previous_utility+'&'+
			/*
			'employer='+employer+'&'+
			'employer_phone='+employer_phone+'&'+
			'employer_address='+employer_address+'&'+
			'employer_city='+employer_city+'&'+
			'employer_state='+employer_state+'&'+
			'employer_zip='+employer_zip+'&'+
			'spouse_name='+spouse_name+'&'+
			'spouse_social_security='+spouse_social_security+'&'+
			'spouse_employer='+spouse_employer+'&'+
			'spouse_employer_phone='+spouse_employer_phone+'&'+
			'spouse_employer_address='+spouse_employer_address+'&'+
			'spouse_employer_city='+spouse_employer_city+'&'+
			'spouse_employer_state='+spouse_employer_state+'&'+
			'spouse_employer_zip='+spouse_employer_zip+'&'+
			'joint='+joint+'&'+
			'participate='+participate+'&'+
			*/
			'tax_id='+tax_id+'&'+
			'owner='+owner+'&'+
			'owner_name='+owner_name+'&'+
			'lease_length='+lease_length+'&'+
			'owner_address='+owner_address+'&'+
			'owner_city='+owner_city+'&'+
			'owner_state='+owner_state+'&'+
			'owner_zip='+owner_zip;
			
			$.ajax({
				  type: 'POST',
				  url: BASE_URL+'commercial/get-service',
				  data: fields,
				  success: function(data) {
					$('.notification').fadeIn('fast').html('<p style="color: #315236 !important">Thank you for submitting our get service form!</p>');
				  }
			});
		}
	
	});	
	
		
	
});




