$(document).ready(function(){
	/* xhtml valid target=_blank alternative */
	$('.popup').click(function(){
		window.open($(this).attr('href'));
		return false;
	});
	
	/*
	$("img.portfolio_image").lazyload({
		placeholder : "/assets/2010/img/imgloader.gif", 
		effect : "fadeIn",
		threshold: 300
	}); 
	*/
	
	/* contact form */
	$('#Form').submit(function(){
		$('#Error').hide();
		$('#Success').hide();
		
		
		var dataString = $('#Form').serializeArray();
		
		$.post('/ci/index.php/contact/submit_form/json', dataString, function(data){
			if (data.error == 'true')
			{
				$('#Error').empty();
				$('#Error').fadeIn('slow');
				$('#Error').append(data.content);
			}
			else
			{
				$('#Success').empty();
				$('#Success').fadeIn('slow');
				$('#Success').append(data.content);
				$('#Form ').each(function(){
					this.reset();
				});
			}
		}, 'json');
		
		return false;
	});
	
	/* lightbox */
	$('.lightbox').lightBox();
	

	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Vertical Sliding
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
	});
	
	$('a.sendmessage_overlay').overlay();
	
	$('.social_bookmarks').slideUp();
	$('.social_bookmarks').parent().append('<a href="#" class="sb_share_link">[Share]</a>');
	$('.sb_share_link').click(function(){
		$(this).parent().find('.social_bookmarks').toggle('slideDown');
		return false;
	});

});