$(document).ready(function() {

	$('.accordionButton').click(function() {
		$(this).prev("div").addClass("blueRight blueDown");
		if ( $(this).prev("div").attr("rel") == 'active' )
		{
			$(this).prev("div").removeClass("blueDown");
			$(this).prev("div").removeAttr("rel")
			$(this).next().slideUp('normal');
		}
		else
		{
			$(this).prev("div").attr("rel", "active");
			$(this).next().slideDown('normal');
		}	
	});
	
	$('#loc_photos').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	
	$("div.accordionContent").hide();
	$("#v_toggleContent").hide();
	
	$('#v_toggle').click(function() {
  		$('#v_toggleContent').slideToggle('slow');
  	});
	
	$("#photos").PikaChoose({show_prev_next:false, show_captions:true, auto_play:true});
	});		

	$(function() {
    	$("#datepicker").datepicker({ showAnim: 'slideDown' });

	$("#various1").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});

	$("#various2").fancybox();

	// bind 'myForm' and provide a simple callback function 
	$('#jobForm').ajaxForm(function(msg) { 
		$("#jobForm").fadeOut();
		$("#successJob").delay(500).fadeIn();
	}); 

});

function submitAppointment( appt ) {
	form_id = appt.id;
	$.ajax({
	   type: "POST",
	   url: "/process/appointment/",
	   data: $("#"+appt.id).serialize(),
	   success: function(msg){
	   		$("#"+appt.id).fadeOut();
			$("#successMessage").delay(500).fadeIn();
	   }
	 });
	return false;
}

function submitContact( contact ) {
	form_id = contact.id;
	$.ajax({
	   type: "POST",
	   url: "/process/contact/",
	   data: $("#"+contact.id).serialize(),
	   success: function(msg){
	   		$("#"+contact.id).fadeOut();
			$("#successContact").delay(500).fadeIn();
	   }
	 });
	return false;
}
