$(document).ready(function(){
	//Pictures on index page
	$('#slideshow').cycle({ timeout: 6500, speed: 2500 });
	
	//Nav CSS adjustments
	$('#nav li:last').css({ 'border-right' : 'none' });
	$('#nav li:last').css({ 'padding-right' : 0 });
	$('#nav li:first').css({ 'padding-left' : 0 });
	
	//Stock Ticker inclusions
	var loadUrl = "http://conifer.net/common/scripts/php/ticker.php";
	//$('#ticker').load(loadUrl + "#sfe-mktsumm");
	
	//Sidebar on about page
	$('.resource_heading').hover(function(){
		$(this).css({ 'background-color' : '#333333', 'color' : '#E1DECC' });
	}, function(){
		$(this).css({ 'background-color' : '#C1C7C8', 'color' : '#333333' });
	});
	
	//Contact form design elements
	$('.contact_form input').focus(function(){
		$(this).css({ 'background-color' : '#F6F6F6' });
		
	});
	$('.contact_form input').blur(function(){
		$(this).css({ 'background-color' : '#FFFFFF' });
	});
	$('.contact_form textarea').focus(function(){
		$(this).css({ 'background-color' : '#F6F6F6' });
	});
	$('.contact_form textarea').blur(function(){
		$(this).css({ 'background-color' : '#FFFFFF' });
	});
	$('.contact_form_submit').blur(function(){
		$(this).css({ 'background-color' : '#F0F0F0' })
	});
	
	//Employee listing adjustments and design elements
	//$('#employees li:last').css({ 'border-bottom' : '1px solid #333333' });
	//$('#employees li').hover(function(){
	//	$(this).css({ 'background-color' : '#F6F6F6' });
	//}, function(){ $(this).css({ 'background-color' : '#FFFFFF' }); });
	
	//Validate Contact form
	$('.contact_form').validate({
		//invalidHandler: function(form, validator) {
		// 	var errors = validator.numberOfInvalids();
		//	if (errors){ $('.contact_form_submit').hide(); }
		//},
		messages: {
			name: "Your name must be longer than that!",
			email: "Please enter a valid email address.",
			subject: "Subject must be longer.",
			message: "Is that all you have to say?"
		}
	});
	//Restrict use of numbers for certain fields
	$('.name').alpha();
	
	//Set variables for contact form and submit info via AJAX on Submit button click
	$('.contact_form_submit').click(function(){
		////////if ($(".contact_form:contains('error')")) {
		///////	return false;
		///////}
			var name = $('.name').val();
			var email = $('.email').val();
			var subject = $('.subject').val();
			var message = $('.message').val();
			$.ajax({
				type: "GET",
				url: "common/scripts/php/ajaxSubmit.php",
				data: "name=" + name + "&email=" + email + "&subject=" + subject + "&message=" + message,
				success: function(){
					$('.contact_form').hide();
					$('#content').append("<h3 class='thanks'>Thank you for sending us an email.  We will be in touch shortly.</h3>");
				}
			});
			
			return false;
	});
	
});
