
$(function () {
	$('.bubble_info').each(function () {
		// options
		var distance = 0;
		var time = 250;
		var hideDelay = 500;

		var hideDelayTimer = null;

		// tracker
		var beingShown = false;
		var shown = false;

		var trigger = $('.trigger', this);
		var popup = $('.bubble_popup', this).css('opacity', 0);

		// set the mouseover and mouseout on both element
		$([trigger.get(0), popup.get(0)]).mouseover(function () {
			// stops the hide event if we move from the trigger to the popup element
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
		}).mouseout(function () {
			// reset the timer if we get fired again - avoids double animations
			if (hideDelayTimer) clearTimeout(hideDelayTimer);

			// store the timer so that it can be cleared in the mouseover if required
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				popup.animate({
					top: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					// once the animate is complete, set the tracker variables
					shown = false;
					// hide the popup entirely after the effect (opacity alone doesn't do the job)
					popup.css('display', 'none');
				});
			}, hideDelay);
		}).click(function () {
			// don't trigger the animation again if we're being shown, or already visible
			if (beingShown || shown) {
				return;
			} else {
				beingShown = true;

				// reset position of popup box
				popup.css({
					top: 42,
					display: 'block' // brings the popup back in to view
				})

				// (we're using chaining on the popup) now animate it's opacity and position
				.animate({
					top: '-=' + distance + 'px',
					opacity: 1
				}, time, 'swing', function() {
					// once the animation is complete, set the tracker variables
					beingShown = false;
					shown = true;
				});
			}
		});
	});
});

$(function () {
	var current_image = -1;
	var media_list_timeout;
	
	media_list_auto_rotate()

	$('.media_list li').mouseover(function () {
		if (media_list_timeout) {
			clearTimeout(media_list_timeout);
		}

		media_list_change_image($(".media_list li").index(this));
	});

	$('.media_list li').mouseout(function () {
		media_list_timeout = setTimeout(media_list_auto_rotate, 5000);
	});

	function media_list_auto_rotate() {
		if(current_image >= ($(".media_list li").length - 1)) { 
			current_image = 0; 
		} else { current_image = current_image + 1; }

		media_list_change_image(current_image);
		media_list_timeout = setTimeout(media_list_auto_rotate, 5000);
	}

	function media_list_change_image(image_id) {
		current_image = image_id;

		$('.media_list li').attr("class", "");
		$('.media_list li:eq('+current_image+')').attr("class", "selected");
		$('#main_image').attr("src", $('.media_list li:eq('+current_image+') img').attr("src"));
		$('#related_media_link').attr("href", $('.media_list li:eq('+current_image+') a').attr("href"));

		$('#featured_title').html($('.media_list li:eq('+current_image+') h2').html());
		$('#featured_desc').html($('.media_list li:eq('+current_image+') p').html());

	}
});

var progress_bar_width = 700;

$(function() {
	$(".global_slider_1").each(function() {
		slider_width_value = $(this).css("width");
		group_progress = parseInt($(".progress_amt").eq($(".global_slider_1").index(this)).html());
		slider_width = parseInt(slider_width_value.substr(0,(slider_width_value.length-2)));
		slider_position = Math.round(0 - progress_bar_width + (slider_width * (group_progress/100)));
		$(this).css("background-position", slider_position+"px 0px");
	});
	$(".global_slider_2").each(function() {
		slider_width_value = $(this).css("width");
		group_progress = parseInt($(".progress_amt").eq($(".global_slider_2").index(this)).html());
		slider_width = parseInt(slider_width_value.substr(0,(slider_width_value.length-2)));
		slider_position = Math.round(0 - progress_bar_width + (slider_width * (group_progress/100)));
		$(this).css("background-position", slider_position+"px 0px");
	});
	$(".global_slider_3").each(function() {
		slider_width_value = $(this).css("width");
		group_progress = parseInt($(".progress_amt").eq($(".global_slider_3").index(this)).html());
		slider_width = parseInt(slider_width_value.substr(0,(slider_width_value.length-2)));
		slider_position = Math.round(0 - progress_bar_width + (slider_width * (group_progress/100)));
		$(this).css("background-position", slider_position+"px 0px");
	});
});

$(function() {
	$(".font_smaller").click(function() {
		alert($(".article").css("font-size"));
	});
	$(".font_bigger").click(function() {
		alert("big");
	});
});

$(document).ready(function(){
	$(".changer").click(function(){
		var $mainText = $('.resizeable');
		var currentSize = $mainText.css('font-size');
		var num = parseFloat(currentSize, 10);
		var unit = currentSize.slice(-2);
		if (this.id == 'font_bigger'){
			num = num * 1.25;
		} else if (this.id == 'font_smaller'){
			num = num / 1.25;
		}
		$mainText.css('font-size', num + unit);
		return false;
	});
});

$(function () {
	var widgets_visible = 5;
	var widget_width = 188;
	var margin_width = 2;
	var offset = widget_width + (2 * margin_width);
	
	$(".animate_left").click(function() {
		var pos = $(".tool_widgets .flc img").css("left");
		var position = pos.substr(0,(pos.length-2));
		var new_position = parseInt(position) + offset;
		if (position < 0) {
			$(".tool_widgets .flc img").animate({
				left: new_position
			}, "slow")
		}
		if ($(this).css("display") == 'inline' && new_position == 0) {
			$(this).css("display", "none")
		}
		if ($(".animate_right").css("display") == 'none' && position < 0) {
			$(".animate_right").css("display", "inline")
			$(this).css("marginRight", "0px")
		}
	});
	
	$(".animate_right").click(function() {
		var pos = $(".tool_widgets .flc img").css("left");
		var position = pos.substr(0,(pos.length-2));
		var new_position = parseInt(position) - offset;
		var max_right = 0 - (($(".tool_widgets .flc img").length - widgets_visible) * offset);
		if (position > max_right) {
			$(".tool_widgets .flc img").animate({
				left: new_position
			}, "slow")
		}
		if ($(this).css("display") == 'inline' && new_position == max_right) {
			$(this).css("display", "none")
			$(".animate_left").css("marginRight", "25px")
		}
		if ($(".animate_left").css("display") == 'none' && position > max_right) {
			$(".animate_left").css("display", "inline")
		}
	});
});


$(function () {
	var widgets_visible = 5;
	var widget_width = 115;
	var margin_width = 0;
	var offset = widget_width + (2 * margin_width);
	
	$(".animate_left_v").click(function() {
		var pos = $(".video_window .videos").css("left");
		var position = pos.substr(0,(pos.length-2));
		var new_position = parseInt(position) + offset;
		if (position < 0) {
			$(".video_window .videos").animate({
				left: new_position
			}, "slow")
		}
		if ($(this).css("visibility") == 'visible' && new_position == 0) {
			$(this).css("visibility", "hidden")
		}
		if ($(".animate_right_v").css("display") == 'none' && position < 0) {
			$(".animate_right_v").css("display", "inline")
		}
	});
	
	$(".animate_right_v").click(function() {
		var pos = $(".video_window .videos").css("left");
		var position = pos.substr(0,(pos.length-2));
		var new_position = parseInt(position) - offset;
		var max_right = 0 - (($(".video_window .videos .video").length - widgets_visible) * offset);
		if (position > max_right) {
			$(".video_window .videos").animate({
				left: new_position
			}, "slow")
		}
		if ($(this).css("display") == 'inline' && new_position == max_right) {
			$(this).css("display", "none")
		}
		if ($(".animate_left_v").css("visibility") == 'hidden' && position > max_right) {
			$(".animate_left_v").css("visibility", "visible")
		}
	});
});

$(function() {
	$(".togglemodule").click(function() {
		var module = $(this).attr('id');
		if (module != undefined)
		{
			module = module.split('-');
			$.get("/prof/ajax/modules", { id: module[1] } );
		}
		var body = $(this).parent().parent().parent().parent().children("div:nth-child(2)");
		var state = body.attr('class');
		if (state.indexOf('moduleopen') > -1) {
			$(this).attr('src', '/images/temp/flex_arrow_shut.gif');
			body.attr('class', 'moduleclosed');
		} else {
			$(this).attr('src', '/images/temp/flex_arrow_open.gif');
			body.attr('class', 'moduleopen');
		}
	});
});

// JScript File

function ShowMiddleTab(container_id, self)
{
  $(self).parent().parent().find("li").removeClass("current");
  $(self).parent().addClass("current");

  $("#"+container_id).parent().find(".center_box2").hide();
  $("#"+container_id).show();
}

function ShowMiddleTab2(container_id, self)
{
  $(self).parent().parent().find("li").removeClass("current");
  $(self).parent().addClass("current");

  $("#"+container_id).parent().find(".TabContainer_2").hide();
  $("#"+container_id).show();
}

ShowTab = function(container_id, self)
{
  $(self).parent().parent().find("li").removeClass("current");
  $(self).parent().addClass("current");

  $("#"+container_id).parent().find(".TabContainer").hide();
  $("#"+container_id).show();
}















eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(j($){$.Q.c=j(6){i 1=$.1D({o:\'1C\',X:0,W:0,d:g,G:.9,F:g,S:\'C://B.A/1B\',T:g,14:g,U:{1A:2,1z:\'15\',H:\'1y\',f:\'q\',L:\'K J(C://B.A/1x) I\'},13:{u:\'18\',L:\'K J(C://B.A/1w) 17-I a k\'},11:{u:\'18\',L:\'K J(C://B.A/1v) 17-I 1u k\'},10:{1t:\'#1s\',1r:\'16\',1q:\'16\',1p:\'15\',1o:\'1n\',1m:\'k\'}},6);z 8.1l(j(){3($(\'4\',8).1k(\'c\')){3(p 6==\'D\'){3(6==\'1j\'){$(8).7(\'.c\').E();z g}O 3(6!=\'d\')$(8).7(\'.c .m\').b(6);$(8).7(\'.c\').d();z g}$(8).7(\'.c\').d();z g}5=$(8);i b=1i;3(1.14){b=5.b();5.1h().d()}$(\'<4 v="c"><4 v="a"><\\/4><4 v="m"><\\/4><4 v="12"><\\/4><\\/4>\').1g(5);i l=$(\'.c\',5);l.7(\'.a\').h(1.13);l.7(\'.12\').h(1.11);l.7(\'.m\').h(1.10);i r=5.f();3(1.f)r=1.f;i y=(1.o.t(/n/)?0:(1.o.t(/s/)?5.u():Z.Y(5.u()/2)));i x=(1.o.t(/w/)?0:(1.o.t(/e/)?5.H():Z.Y(5.H()/2)));3(5.h(\'f\')!=\'q\'){x+=r.k;y+=r.a}3(p 6==\'D\')l.7(\'.m\').b(6);3(b)l.7(\'.m\').b(b);l.h({G:1.G,f:\'q\',k:x+1.X+\'V\',a:y+1.W+\'V\'}).h(1.U);3(1.F||1.T){3(1.F){$(\'.a\',l).1f(\'<4 1e="f:q;a:1d;1c:1b"><R 1a="\'+1.S+\'"><\\/4>\');$(\'.a R\',l).N(j(){l.E()})}3(p M.Q.P!=\'19\')l.P()}O l.N(j(){$(8).E()});3(1.d||p 6==\'D\')l.d()})}})(M);',62,102,'|opts||if|div|obj|options|find|this||top|html|aqLayer|show||position|false|css|var|function|left||mid||attach|typeof|absolute|pos||match|height|class||||return|com|tinyurl|http|string|fadeOut|closeBtn|opacity|width|repeat|url|transparent|background|jQuery|click|else|draggable|fn|img|closeImg|noClose|layerCss|px|offsetY|offsetX|round|Math|midCss|botCss|bot|topCss|clone|none|2px|no|5px|undefined|src|4px|right|1px|style|append|appendTo|empty|null|hide|hasClass|each|textAlign|both|clear|float|margin|padding|222|color|bottom|64fsox|5ztvk6|5gnxdk|230px|display|zIndex|6ba6nl|nw|extend'.split('|')))
