/* little ads */
$(function() {
	$('ul.hover_block li').hover(function(){
		$(this).find('img').hide('750');
	}, function(){
		$(this).find('img').show('1750');
	});
});
/* end little ads */	

/* portfolio lightbox */	
$(function() {
	$('a.lightbox').lightBox(); // Select all links with lightbox class
});
/* end portfolio lightbox */

/* contact me */
$(function() {
	$("#contactLink").click(function(){
		if ($("#contact-form").is(":hidden")){
			$("#contact-form").slideDown("slow");
		}
		else{
			$("#contact-form").slideUp("slow");
		}
	});
	
	$form = $("#contact-form form");

	$form.submit(function(e){
		e.preventDefault();
		$e = $(this);

		// this is working, but we want to do the ajax version below soon
		$.post("/page/send", { name: $("#name").val(), message: $("#message").val(), email: $("#email").val() } );

		$.ajax({
			url: $form.attr("action"), 
			data: $form.serialize(),
			success: function(data,status) {
				console.log(data);

				$("#messageSent").show("slow");
				setTimeout('$("#messageSent").hide();$("#contact-form").slideUp("slow")', 2000);

			},
			error: function(data,status) {
				console.log(status);
			}
		});			
	});

});
/* end contact me */

function loadAjaxSubmit(form_id,email)
{
	var name = $("#name").val();
	var address = $("#email").val();
	var message = $("#message").val();
	$.ajax({
	  type: "POST",
	   url: "<?php echo base_url()?>page/send",
	   data: "name="+name+"&email="+address+"&message="+message,

	  success: function(data) {
		$('#mes').css("display","block").html(data);
							setTimeout('$("#messageSent").hide();$("#contact-form").slideUp("slow")', 2000);
	  }
	});
}

$(function() {
	// shows the slickbox DIV on clicking the link with an ID of "slick-show"
	$('a#slick-show').click(function() {
		$('#slickbox').show('slow');
		return false;
	});
});

$(function() {
	$('#slick-slidetoggle').click(function() {
		$('#slickbox').slideToggle('slow', function() {

			// once it is clicked it will post to big_box_toggle and the method sets a session var
			$.post("/index.php?page/big_box_toggle");
			
		});
	});
});
