// JavaScript Document
$(document).ready(function(){
	// png Fix
	$('body').supersleight();
	

	$('.gallery').css('height',$('.winner-talk-c').height()-70);
	
	$('.galleryhome').css('height',$('.winner-talk-c').height()-70);
	
	$('.gallery').autoscroll();
	$('.galleryhome').autoscroll();
	
/* Scroll Script: Changed 12042010 */	
	var $win = $(window);

             $win.scroll(function () {
				
				if( (($win.scrollTop() ) > $('.profiletext').offset().top) & ( ($win.scrollTop() < ($('.profiletext').offset().top +  $('.profiletext').height() - $('.shareboxes').height() )) ) ) {
					$('.shareboxes').removeClass("displayBlock");
					$('.shareboxes').css("top","0px");
					$('.shareboxes').addClass("fixedDiv");
				} else if ($win.scrollTop() < $('.profiletext').offset().top) {
					$('.shareboxes').removeClass("fixedDiv");
				} 
				
				if ( ($win.scrollTop() > ($('.profiletext').offset().top +  $('.profiletext').height() - $('.shareboxes').height())) ){		
				
					var $topFix =  $('.profiletext').offset().top + $('.profiletext').height() - $('.shareboxes').height() ;
					$('.shareboxes').removeClass("fixedDiv");
					$('.shareboxes').addClass("displayBlock");					
					$('.shareboxes').css("top",$topFix);
					
				}
             });
			 
/* Scroll Script End */	

		
	$("ul.gallery li").hover(function() { //On hover...
		
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		
		//Set a background image(thumbOver) on the &lt;a&gt; tag 
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Fade the image to 0 
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		}); 
	} , function() { //on hover out...
		//Fade the image to 1 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	
		$("ul.galleryhome li").hover(function() { //On hover...
		
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		
		//Set a background image(thumbOver) on the &lt;a&gt; tag 
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Fade the image to 0 
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		}); 
	} , function() { //on hover out...
		//Fade the image to 1 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	
	$("#winTable").tablesorter( {sortList: [[1,0]]} ); 
	
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});


	
	
	/*
	$(function(){
    $('.banner-img img:gt(0)').hide();
    setInterval(function(){
      $('.banner-img :first-child').fadeOut()
         .next('img').fadeIn()
         .end().appendTo('.banner-img');}, 
      3000);
});

*/

})


