// JavaScript Document



$(function(){
	
	$("#gallery ul li div span").wrap("<span class='strikethrough' />");
	
	$("#gallery ul li a.read-me").prettyPhoto();
	$("#footer .container ul li:first").css("border-left","none");
	$("#email").focusin(function(){ $(this).val(""); });
	$("#gallery ul li").hover(function(){ $(this).find("img").stop(true,true).animate({left:-300},500); },function(){$(this).find("img").stop(true,true).animate({left:0},500); });
	
	$("#timer").timer({year:2010, month:12 , days:23 , hours:2 , minutes : 1});
	
	});
	
	
(function($) {
		  
$.fn.timer = function(options){
	var defaults = {onDone:function(){  },year:0,month:0,days:0,hours:0,minutes:0,seconds:0};
	var options = $.extend(defaults, options);
	var root = $(this).find("span");
	
	
	var targetTime = new Date();
	targetTime.setDate(options.days);
	targetTime.setMonth(options.month-1);
	targetTime.setFullYear(options.year);
	targetTime.setHours(options.hours);
	targetTime.setMinutes(options.minutes);
	targetTime.setSeconds(options.seconds); 
	
	var nowTime = new Date(),diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000),
	seconds = diffSecs % 60,
	 minutes = Math.floor(diffSecs/60)%60,
	 hours = Math.floor(diffSecs/60/60)%24,
	 day = Math.floor(diffSecs/60/60/24);
	
  root.eq(0).html(day);
  root.eq(1).html(hours);
  root.eq(2).html(minutes);
  
	function init(){
	var timer = setInterval(function(){
        
		if(hours<0)
		{
			root.eq(0).html(days--);
			hours = 23;
		}
		
		if(minutes<0)
		{
			root.eq(1).html(hours--);
			minutes = 59;
		}
		
		if(seconds<0)
		{
			root.eq(2).html(minutes--);
			seconds = 59;
		}
		
		seconds--;
		},1000);
		
	}
	
	
	$(window).load(function(){ setTimeout(function(){  init(); },1000); });
	
} 
})(jQuery);
