// JavaScript Document
jQuery(document).ready(function(){
	jQuery("ul.dropdown li:last-child").css({"margin":0, "width": "158px"});
	jQuery("ul.dropdown ul li:last-child").css({"border-bottom":0});
	jQuery("#franchise_navigation ul li:last-child").css({"border-right" : 0});
	jQuery("#franchise_sub ul li:last-child").css({"border-right" : 0});
	jQuery(".on_your_lot img:first-child").css({"margin-right" : 10});
	matchInteriorHeights();
});

function matchInteriorHeights()
{
	// Matches the interior left/rigth divs so the borders match up
	var lt = jQuery("#interior_left");
	var rt = jQuery("#interior_right");
	

	if(rt.height() < lt.height())
	{
		rt.height(lt.height() - 20); // Compensate for the top/bottom padding of Right Column
		jQuery("#interior_left .sideimage:last-child").css({borderBottom : 0});
	}
	else
		lt.height(rt.height());	
}

function checkTheForm()
{
	return false;
}

function get_the_regions(st, index)
{
	if(st == "null")
		return false;
	
	if(index == "index")
		window.location = "?state_id=" + st;
	else
		window.location =  "?page_id=2&state_id=" + st;
}


function get_the_community(area, st)
{
	if(area == "null")
		return false;
	window.location = "?page_id=122&state_id=" + st + "&area_no=" + area;
}

function validateForm(){
 var error = false;
	$("#contact_form .required").each(function(){
	 	$(this).css({"background" : "#fff"});
		if($(this).is('select')){
			if($(this).val() == "null"){
				$(this).css({"background" : "#e5b3bb"});
			error = true;
			}
		}
		else{
			if($(this).val() == ""){
				$(this).css({"background" : "#e5b3bb"});
				error = true;
			}
		}
		
	});
	

if(error === true){
	$("#contact_error").html("Some fields need to be addressed prior to submitting this form.  Please correct all fields highlighted above");
	return false;
}
	return true;	
}


function validateOtherForm(){
 var error = false;
	$("#contact_form_small .required").each(function(){
	 	$(this).css({"background" : "#fff"});
		if($(this).is('select')){
			if($(this).val() == "null"){
				$(this).css({"background" : "#e5b3bb"});
			error = true;
			}
		}
		else{
			if($(this).val() == ""){
				$(this).css({"background" : "#e5b3bb"});
				error = true;
			}
		}
		
	});
	

if(error === true){
	$("#contact_error").html("Some fields need to be addressed prior to submitting this form.  Please correct all fields highlighted above");
	return false;
}
	return true;	
}
