/* Author: 

*/
$('document').ready(function () {
	
	// Summary
	$('div.summary').summary();

	// Placeholder
	$('input[placeholder!=""]').placeholder();

	// Target blank
	$("a[href^='http:']").not("[href*='" + window.location.host + "']").attr('target','_blank');

	// Fancybox
	$("a[href*='.jpg']").fancybox({
		titlePosition: 'inside'
	});
	$(".content-slideshow a").fancybox({
		titlePosition: 'inside'
	});	
	$('a.fancybox').fancybox();
	$('a[href="#embed-fancybox"]').each(function() {
		var vid_id = $(this).attr('rel');
		
		$(this).fancybox({
			'onStart': function() {
				$('#embed-fancybox').attr('src', 'http://player.vimeo.com/video/'+vid_id);
			}
		});
	});

	$('a[href="#embed-video"]').click(function() {
		var vid_id = $(this).attr('rel');
		
		$('#embed-video').attr('src', 'http://player.vimeo.com/video/'+vid_id);
		$('#grid li').removeClass('current');
		$(this).parent().addClass('current');
		
		return false;
	});
		
	// Design Print
	$('#design-print #grid a').each(function() {
		$(this).unbind('click');
		$(this).click(function () {
			$('#design-image').attr('src', $(this).attr('href'));
			$(this).stop();
			return false;
		});
	});
			

	// Outline Form inputs
	$('form input').focus(function() { $(this).parent().addClass('outline'); })
	$('form input').blur(function() { $(this).parent().removeClass('outline'); })
});

$(window).load(function () {

	// Cycle
	$("#slideshow").cycle({
		fx: 'scrollHorz',
		timeout: 5000,
		slideExpr: 'li',
		next: '.next',
		prev: '.prev',
		pager: '#slideshow-nav ul', 
    pagerAnchorBuilder: function(idx, slide) { 
      // return selector string for existing anchor 
      return '#slideshow-nav ul li:eq(' + idx + ') a'; 
    }    
	});
	
	$('.scroll-pane').jScrollPane({
			verticalDragMinHeight: 47,
			verticalDragMaxHeight: 47,
	});

});
