$(document).ready(function(){

	$('#featured_image').cycle({ 
		prev:   '#prev_slide', 
		next:   '#next_slide',
		delay:  0, 
		timeout: 5000,
    	speed:  1000, 
	});

	$('.gallery_sections').image_opacity();
	$('.social_bookmarks li a').image_opacity();
	
	$('#contact_images li').hover(function(){
		$('img', this).stop().animate({opacity:0.6},300);
		$('div', this).fadeIn();
	},function(){
		$('img', this).stop().animate({opacity:1},300);
		$('div', this).fadeOut();
	});
	
	$('.logo').logo_hover();
	
	$('.errorlist').hide();
	$('.errorlist').fadeIn(1000);
	
	$('#next_slide').slide_next_hover();
	$('#prev_slide').slide_prev_hover();
		

	// We only want these styles applied when javascript is enabled
	$('div.navigation').css({'width' : '340px', 'float' : 'left'});
	$('div.content').css('display', 'block');
		
	$('#id_event_type').bind('change',function(){
		$('#portrait_form').hide();
		var select_value = $(this).val()
		if (select_value == 'Portrait'){
			$('#wedding_form').fadeOut();
			$('#portrait_form').fadeIn();
			// $('#message_form').fadeIn();
		} else if (select_value == 'Wedding'){
			$('#portrait_form').fadeOut();
			$('#wedding_form').fadeIn();
			// $('#message_form').fadeIn();
		}
	});
	
	if ($('#id_event_type').val() == 'Wedding'){
		$('#portrait_form').fadeOut();
		$('#wedding_form').fadeIn();
	} else if ($('#id_event_type').val() == 'Portrait'){
		$('#wedding_form').fadeOut();
		$('#portrait_form').fadeIn();
	}
	
	$('#id_wedding_date').datepicker();
	
	$('textarea').tinymce({
		script_url : 'http://static.katefineart.webfactional.com/tiny_mce/tiny_mce.js',
		theme : "advanced",
		theme_advanced_buttons1 : "bold,italic,underline, strikethrough",
		theme_advanced_buttons2: "",
		theme_advanced_buttons3: "",
		theme_advanced_buttons4: "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
	});
	
});


jQuery.fn.image_opacity = function(){
	$(this).hover(function(){
		$(this).stop().animate({opacity:0.6},300);
	},function(){
		$(this).stop().animate({opacity:1},300);
	});
}

jQuery.fn.logo_hover = function(){
	$(this).hover(function(){
               $('.logo_normal').fadeOut();
               $('.logo_hover').fadeIn();
	},function(){
               $('.logo_hover').fadeOut();
               $('.logo_normal').fadeIn();
	});
}

jQuery.fn.slide_next_hover = function(){
	$(this).hover(function(){
		$(this).addClass('next_slide_hover');
	},function(){
		$(this).removeClass('next_slide_hover');
	});
}

jQuery.fn.slide_prev_hover = function(){
	$(this).hover(function(){
		$(this).addClass('prev_slide_hover');
	},function(){
		$(this).removeClass('prev_slide_hover');
	});
}

