// JavaScript Document

var J = jQuery.noConflict();

J(function() {
		
	if (J("#main_content").height() < 268) {
		J("#main_content").height(268);	   
	}
	
	if (J("#main_content").height() < J("#left_content").height()) {
		J("#main_content").height(J("#left_content").height());
	}	
		
		
});		   

function submitForm() {		
	var formdata = J("#contact").serialize();
	J.post("scripts/form_process.html", formdata,
	function(data){
		feedback = data.split('|');  
		if (feedback[0] == "error") {
		//J('#error').fadeOut(100, function () {
			J('#error').empty();	
			J('#error').html(feedback[1]);
			//J('#error').fadeIn();
		//});
		} else {
			J('#error').empty();	
			J('#formContainer').empty();
			J(".left_col").height(J(".right_col").height())
			J('#formContainer').fadeOut(0);
			J('#formContainer').append('<p id ="error">Thank you. We will be in touch shortly</p>');
			J('#formContainer').fadeIn("slow");
		}
	});
	return false;
}

function mainmenu(){
	J("#factsheets ul").css({display: "none"});
	J("#factsheets li").hover(function(){			   
		J(this).find('ul:first').css({visibility: "visible", display: "none"}).slideDown();
		J(this).find('ul li a').css({opacity:1});
	},function(){
		J(this).find('ul:first').css({visibility: "hidden", display: "none"});
		J(this).find('ul li').css({opacity:1});
	});
	
	/*J("#nav li").hover(function(){
		if (J(this).attr("class") != "nav_on") {						
			J(this).css({background: "#F78E1E"});
			J(this).find('a:first').css({color: "#FFFFFF"});
		}	
	},function(){
		if (J(this).attr("class") != "nav_on") {
			J(this).css({background: ""});
			J(this).find('a:first').css({color: ""});
		}
	});*/
	
}
		
		

J(document).ready(function() {
   
   J('.header_imgs').cycle('fade');
   
   if (J("#main_content").height() < 268) {
		J("#main_content").height(268);	   
	}
	
	if (J("#main_content").height() < J("#left_content").height()) {
		J("#main_content").height(J("#left_content").height());
	}
   
   mainmenu();
   
});
