//Supporters page Hovers

jQuery(document).ready(function($) {

// Hover for homepage client-banner project list
var fancyHover = {
	init: function() {
		var project = $('#client-banner li');
			
		project.hover(
			function () { 
				$(this).children('.hover').removeClass('offscreen'); 
				$(this).children('.project-info').css( 'background-color' , '#44423e' );
			}, 
			function () { 
				$(this).children('.hover').addClass('offscreen');
				$(this).children('.project-info').css( 'background-color' , '#272623' );
			}
		);
		
	}
};
fancyHover.init();

// Hover for homepage client-banner project list
var hoverAnim = {
	init: function() {
		var project = $('#client-banner li');
		var projectTxt = project.children('.hover');
		var projectInfo = project.children('.project-info');
		var originalBG = "#272623"; 
		var fadeColor = "#44423e";
		
		project.children('.hover').css({left: '0px'})
 		project.children().children('.hover-bg').fadeTo(1, 0.0)
		project.children().children('.hover-content').css({left: '-250px'})
 			
		project.hover(
			function () {
				$(this).children().children('.hover-content').css({left: '-250px'});
				$(this).children().children('.hover-bg').stop().fadeTo(600, 1.0);
				$(this).children().children('.hover-content').stop().animate({left: '0px'} , { queue: false, duration: 450, easing: 'easeOutQuint' });
				$(this).children('.project-info').stop().animate({backgroundColor:fadeColor}, 750);
			}, 
			function () {
				$(this).children().children('.hover-bg').stop().fadeTo(800 , 0.0);
				$(this).children().children('.hover-content').stop().animate({left: '250px'} , { queue: false, duration: 300, easing: 'easeOutQuint' });
				$(this).children('.project-info').stop().animate({backgroundColor:originalBG},850);
			}
		);
		
	}
};
hoverAnim.init();
});

//Counter Starts
function countdown(yr,m,d){
theyear=yr;themonth=m;theday=d
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[m-1]+" "+d+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday==0&&dhour==0&&dmin==0&&dsec==1){
document.forms.count.count2.value=current;
//if(dsec==0){
//alert("done");
return
}
else

document.getElementById('mycounter').innerHTML= "<div class='timer'><p>" +dday+ "</p>days</div> <div class='colon'><p>:</p></div> <div class='timer'><p>"+dhour+" </p>hours</div> <div class='colon'><p>:</p></div> <div class='timer'><p>"+dmin+"</p> minutes</div> <div class='colon'><p>:</p></div> <div class='timer'><p>"+dsec+" </p>seconds </div>";
setTimeout("countdown(theyear,themonth,theday)",1000);
}
//enter the count down date using the format year/month/day



//Map Tabs Starts
jQuery(document).ready(function(){
	
	jQuery(".tab:not(:first)").hide();

	//to fix u know who
	jQuery(".tab:first").show();
	
	jQuery(".htabs a").click(function(){
		stringref = jQuery(this).attr("href").split('#')[1];

		jQuery('.tab:not(#'+stringref+')').hide();

		if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0") {
			jQuery('.tab#' + stringref).show();
		}
		else 
			jQuery('.tab#' + stringref).fadeIn();
		
		return false;
	});
	
});

//Link Nudge Starts

$(document).ready(function() {
$('a.nudge').hover(function() { //mouse in
$(this).animate({ paddingLeft: '25px' },300);
}, function() { //mouse out
$(this).animate({ paddingLeft: 15 }, 400);
});
});

