  $(document).ready(function(){	
	

	
	//var getWidth = $("#tweetbar").width()-40;
	//$("ul.twitter").width(800);

	//$("li.twitter-item").width(800);
	$(window).bind("resize", resizeWindow);
	function resizeWindow( e ) {
	$("ul.twitter").css("top", "0");
	};
	var getCreditsHeight = $("#project_credits").outerHeight()-45;
	var getDescriptionHeight = $("#project_description").outerHeight()-50;

    if ( getCreditsHeight > getDescriptionHeight ) {
    	$("div#project_description").height(getCreditsHeight);
    } else {
		$("div#project_credits").height(getDescriptionHeight);
    };

	var getCreditsHeight2 = $("#page_credits").outerHeight()-40;
	var getDescriptionHeight2 = $("#page_description").outerHeight()-40;

    if ( getCreditsHeight2 > getDescriptionHeight2 ) {
    	$("div#page_description").height(getCreditsHeight2);
    } else {
		$("div#page_credits").height(getDescriptionHeight2);
    };
	var getWidth2 = $("div#page_credits").height();
	$("div.row1").height(getWidth2);

    
	$('.twitter').cycle({
    fx:      'scrollLeft', 
    speed:    300, 
    timeout:  6000 
	});
	
	$(".twitter").fadeOut(0).delay(3000).fadeIn(1000);	
	
	$('.twitter-item a').text('').append(function() { return this.previousSibling });
	$('.twitter-item a').attr("target","_blank");

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    $(".cat_rollout").bind('touchstart', function(){
        $("this").removeClass().addClass(".cat_rollout_ip");
    });
	
	$(".menu li a").bind('touchend', function(){
        $("this").removeClass().addClass(".cat_rollout");
    });
};
	$(".scroll-pane").jScrollPane();

    $(".vpLeft:first").removeClass().addClass("vpLeft_Selected");
    $(".vpLeftText:first").removeClass().addClass("vpLeftText_Selected");
    $(".vpRightImg:first").removeClass().addClass("vpRightImg_Selected");
	$(".vpArrow:first").removeClass().addClass("vpArrow_Selected");
	
  	$("#panel_right").height( $("#panel_center").height() );
	$("#panel_left").height( $("#panel_center").height() );

var i = 1;
$(".thumb_container").each(function()
{
    var isEvenRow = Math.ceil(i / 4) % 2 == 0; // 4 is number of columns
    var isCellAlternate = i % 2 == isEvenRow ? 0 : 1;

    if ( isCellAlternate ) {
        $(this).addClass("dark");
    } else {
        $(this).addClass("light");
    }
    i++;
}); 


		
var oven = ($('.thumb_container').length); 
	
	function isEven(oven) {

	if (oven>5 ) {
		$(".footersub:odd").css("background-color", "#fafafa");
		$(".footersub:even").css("background-color", "#f0f0f0");
	}else if (oven<5 && oven>0){
		$(".footersub:odd").css("background-color", "#f0f0f0");
		$(".footersub:even").css("background-color", "#fafafa");
	}else if (oven==0){
		$(".footersub:odd").css("background-color", "#fafafa");
		$(".footersub:even").css("background-color", "#f0f0f0");
	}else if (oven==5){
		$(".footersub:odd").css("background-color", "#fafafa");
		$(".footersub:even").css("background-color", "#f0f0f0");
	}};

isEven(oven);
 
	$("#credits").mouseover(function() {
		$("#jqCredits").animate({top: "20px", opacity: 0}, { duration: 100, queue: false });
		$("#jqCredits2").animate({top: "1px", opacity: 100}, { duration: 100, queue: false });
	}).mouseout(function() {
		$("#jqCredits").animate({top: "1px", opacity: 100}, { duration: 100, queue: false });
		$("#jqCredits2").animate({top: "-20px", opacity: 0}, { duration: 100, queue: false });
	})

	$('.vpMedia').hover(function() {
		$(this).find(".vpLeft").removeClass().addClass("vpLeft_Hover");
		$(this).find(".vpLeftText").removeClass().addClass("vpLeftText_Hover");
		$(this).find(".vpRightImg").removeClass().addClass("vpRightImg_Hover");
		},
		function() { //mouseout
		$(this).find(".vpLeft_Hover").removeClass().addClass("vpLeft");
		$(this).find(".vpLeftText_Hover").removeClass().addClass("vpLeftText");
		$(this).find(".vpRightImg_Hover").removeClass().addClass("vpRightImg");
	});
		
	$('.vpMedia').click(function() {
	
  		$(".vpLeft_Selected").removeClass().addClass("vpLeft");
  		$(".vpLeftText_Selected").removeClass().addClass("vpLeftText");
  		$(".vpRightImg_Selected").removeClass().addClass("vpRightImg");
		$(".vpArrow_Selected").removeClass().addClass("vpArrow");

   		$(this).find(".vpLeft_Hover").removeClass().addClass("vpLeft_Selected");
   		$(this).find(".vpLeftText_Hover").removeClass().addClass("vpLeftText_Selected");
		$(this).find(".vpArrow_Hover").removeClass().addClass("vpArrow_Selected");
		$(this).find(".vpArrow").removeClass().addClass("vpArrow_Selected");
		$(this).find(".vpRightImg_Hover").removeClass().addClass("vpRightImg_Selected");

	});
	$(".jScrollPaneDrag").hover(function(){$(this).stop().animate({backgroundColor: "#666"}, 'fast');},
				   function(){$(this).stop().animate({backgroundColor: "#999"}, 'fast');}
				  );

	$("a").hover(function(){$(this).stop().animate({color: "#00cc00"}, 'fast');},
				 function(){$(this).stop().animate({color: "#939393"}, 'fast');}
				);

	
	$("#footer").find("a").unbind('mouseenter mouseleave').hover(function(){$(this).stop().animate({color: "#333"}, 'fast');},
				 function(){$(this).stop().animate({color: "#939393"}, 'fast');}
				);


	
  });  
  
  $(window).resize(function() {
	var getWidth = $("#tweetbar").width()-37;
	$("ul.twitter").width(getWidth);
	$("li.twitter-item").width(getWidth);

	
	});


