var currentVideoLink;
var currentVideo = 1;
var currenttemp = 0;
var maxVideos;
//closure wrap ensures no conflict with any other potential libraries
(function($){
	$(document).ready(function() {


// Font resizer
		$(".fontResizer li.textLarge").click(function() {
			$("body").addClass("largeFont");
		});
		$(".fontResizer li.textNormal").click(function() {
			$("body").removeClass("largeFont");
		});

// Blogger popup boxes 
		$('.bloggers li').mouseover(function(){
			$('.bloggerInfo').hide();
			$(this).children('div').show();
		});
	
//Voices page video and content changes
		$(".voices #videosWidget .contTinisVideos .itemVideo a").click(function() {
			loadSwfVideo(".voices #videosWidget #video", this, "446", "249");
			var theClone = $(this).siblings(".labelVideo").clone().attr("id","labelVideoMain")
			theClone.attr("style", "display:block");
			$(".voices #videosWidget #labelVideoMain").replaceWith(theClone);
			return false;
		});
		
		$(".voices #videosWidget .contTinisVideos .itemVideo img").click(function() {
			var video = $(this).siblings('a')[0];
			loadSwfVideo(".voices #videosWidget #video", video, "446", "249");
			var theClone = $(this).siblings(".labelVideo").clone().attr("id","labelVideoMain")
			theClone.attr("style", "display:block");
			$(".voices #videosWidget #labelVideoMain").replaceWith(theClone);
			return false;
		});
		
//Darden distinct page video and content changes
		$(".darDisctinct .tinisVideos ul li a").click(function() {
			loadSwfVideo("#contVideosWithRibbon .contBack .contvideo #video", this, "427", "265");
			var theClone = $(this).siblings(".labelVideo").clone().attr("class","captionVideo");
			$(".contBack .captionVideo").replaceWith(theClone);
			return false;
		});
		
		
// Tabbed content
		$(".linkIntBar a:first").addClass("active");
		$(".ConainerConets").children("div").hide();

		$(".ConainerConets").children("div:first").addClass("activePanel").fadeIn("slow");

		$(".linkIntBar li").each(function(i) { $(this).attr("data-tabid", i); });
		$(".ConainerConets").children("div").each(function(i) { $(this).attr("data-panelid", i); });

		$(".linkIntBar a").click(function() {
			if(!$(this).hasClass("active")) {
				var id = $(this).closest("li").attr("data-tabid");

				$(".linkIntBar a.active").removeClass("active");
				$(this).addClass("active");

				
				$(".ConainerConets div.activePanel").removeClass("activePanel").hide();
				$(".ConainerConets div[data-panelid='" + id + "']").addClass("activePanel").fadeIn("slow");
			}
			return false;
		});
		
//Faculty Research carousel



//New Video Carousel
		$('#videosCarrousel span.count').html($('.videoBox').size());
		var videoAmt =	$('.videoBox').size();
		if (videoAmt == '1'){$('.videoCarouselNav').hide();}
			function onAfter(curr,next,opts) {
			var caption = (opts.currSlide + 1);
			$('.counter').html(caption);
			
		}

		$('#videosCarrousel #videoBoxes').cycle({
			timeout: 0,
			next:   '.next', 
			prev:   '.prev',
			after:	onAfter,
			cleartypeNoBg:	true
		});	

// Cufon
		Cufon.replace("h1", { fontFamily: "Adobe Garamond Pro" });
		Cufon.replace("h2.dardenVoices, .homepage h2, .mbaEsec #contColsMain h2, .mba #contColsMain h2, .facultyResearch #contColsMain h2, .execEd #contColsMain h2", { fontFamily: "Adobe Garamond Pro" });
	
	});
})(jQuery)

		function loadSwfVideo(videoContainer, elem, vidWidth, vidHeight) {
			$(videoContainer).empty();
			$("<div/>").attr("id","myytplayer").appendTo(videoContainer);
			var params = { allowScriptAccess: "always", wmode : "transparent" };
			var attrs = { id: "myytplayer" };
			var swfVideoPath = elem.href;
			swfobject.embedSWF(swfVideoPath, "myytplayer", vidWidth, vidHeight, "8", null, null, params, attrs);
			$(elem).parents().parent().children().removeClass("current").children("a").removeClass("current");
			$(elem).addClass("current").parent().addClass("current");			
			//$('#myytplayer').append("<embed src='" + swfVideoPath + "' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='" + vidWidth + "' height='" + vidHeight + "' wmode='transparent'></embed>");
		}

