/*!
 * 
 * What I do. And what I've done. | summer.gcmingati.net
 * Version: 2.0.1 (25-FEBRUARY-2010)
 * Copyright © 2010, Gian Carlo Mingati. All rights reserved.
 * 
 */

$(function(){ 
$("#reel li a img").addClass("reflect");
var step = 925; 
var itemFW = 185;
var $subnav = $("#reel ul");
subListItems = $subnav.find("li").size();
var $thumbz = $("li img");
var r_enabled = true;
var l_enabled = true;
var pos = 0;
$thumbz.hover(function(){ 
  $(this).css({cursor: "pointer"}) 
},function(){ 
  return false; 
});
$subnav.css({'width' : subListItems*itemFW});
$("<div id='left'><a href='#' class='lessthumbz' title='less'><img src='http://summer.gcmingati.net/images/less.gif' \/><\/a><\/div><div id='right'><a href='#' class='morethumbz' title='more'><img src='http://summer.gcmingati.net/images/more.gif' \/><\/a><\/div>").appendTo("#reel");
$("a.morethumbz").bind("click", function(){
		if (r_enabled) (subListItems-pos > 10 || subListItems%10 == 0)? pos += 5 : pos += subListItems % 5;
		r_enabled = false;
		$subnav.filter("ul:not(:animated)").animate({ marginLeft: -(itemFW)*pos}, 1100, "easeInOutExpo", function(){
			uiLockUnlock()						
		});					
		return false;
});
$("a.lessthumbz").bind("click", function(){	
		if (l_enabled && pos!=0) (subListItems-pos > 5 || subListItems%5 == 0)? pos -= 5 : pos -= subListItems % 5;
		l_enabled = false;
		$subnav.filter("ul:not(:animated)").animate({ marginLeft: -(itemFW)*pos}, 1100, "easeInOutExpo", function(){
			uiLockUnlock()
		});	
		return false;
});
function uiLockUnlock()
{								
	//+
	(pos == subListItems-5) ? r_enabled = false : r_enabled = true;
	(pos == subListItems-5) ? $("a.morethumbz").fadeOut('fast') : $("a.morethumbz").fadeIn('fast');
	//-
	(pos == 0) ? l_enabled = false : l_enabled = true;
	(pos == 0) ? $("a.lessthumbz").fadeOut('fast') : $("a.lessthumbz").fadeIn('fast');
}
uiLockUnlock();
$('#cnct').amail('||','|','hackthis');
Shadowbox.init();
});
$(window).bind("load", function() { 
	$('img.reflect').reflect({height: 0.3, opacity: 0.3}); 
});
jQuery.extend( jQuery.easing,
{
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	}
});