// npoulos.info 2010

// redefine cycle's updateActivePagerLink function 
$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
    $(pager).find('li').removeClass('current') 
        .filter('li:eq('+currSlideIndex+')').addClass('current'); 
}; 

$(document).ready(function () {
 
 	$.post("php/latest.php", function(data) {
		$("#home #content-right-title").after(data);	   	
	  });	
	
	$('#hero-screens').cycle({ 
		fx: 'scrollLeft',
		sync: 1,
		timeout: 7000, 
		pager:  '#hero-portfolio-boxes', 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<li></li>'; 
		} 
	});
	
	$('#content-slide').cycle({ 
		timeout: 0, 
		speed:   300, 
		fx: 'scrollLeft',
		sync: 1,
		startingSlide: 0 
	});
	
	$("a.send-message").click(function() { $("#frm_contact").submit() });
	$("a.return-home").click(function() { window.location="index.php" });
	$("a.fix-errors").click(function() { history.back(); });
	
	$("li.facebook").click(function() { window.open("http://www.facebook.com/nicholas.poulos","facebook") });
	$("li.twitter").click(function() { window.open("http://www.twitter.com/nickpoulos","twitter") });	
	$("li.linkedin").click(function() { window.open("http://www.linkedin.com/in/nickpoulosny","linkedin") });

 $('.portfolio-box, .portfolio-box-right').hover(function(){  
	$(".portfolio-box-slide", this).stop().animate({top:'90px'},{queue:false,duration:160});  
     }, function() {  
         $(".portfolio-box-slide", this).stop().animate({top:'194px'},{queue:false,duration:160});  
     });  
 
 
 	$('#portfolio-button-websites').click(function() { 
		$('#content-slide').cycle(0); 
		return false; 
	}); 	
	
	$('#portfolio-button-identities').click(function() { 
		$('#content-slide').cycle(1); 
		return false; 
	}); 
	
	$('#portfolio-button-print').click(function() { 
		$('#content-slide').cycle(2); 
		return false; 
	}); 

});
