$(document).ready(function(){
	String.prototype.left = function(n) {
		return this.substring(0, n);
	}
	
	$('head').append('<link rel="stylesheet" type="text/css" href="/css/print.css" media="print" />');

	$('.backToTop a').click(function() {
		var targetOffset = $('body').offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 1000);	
		return false;
	});
	
	$('.partnerLogos a').click(function() {
		ind=$(".partnerLogos a").index(this);
		$.each($('.partnerLogos a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.partnerInfo div'), function(index) {
		  if(ind == index){
			  $(this).slideDown();
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		return false;
	});
	
	$('.featureList a').click(function() {
		ind=$(".featureList a").index(this);
		$.each($('.featureList a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.featureDetails div'), function(index) {
			if(ind == index){
				$(this).slideDown();
			}
			else{
				$(this).slideUp();
			}
		});
		return false;
	});
	
	$('.appList a').click(function() {
		ind=$(".appList a").index(this);
		$.each($('.appList a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.appDetails div.clearfix'), function(index) {
			if(ind == index){
				$(this).slideDown();
			}
			else{
				$(this).slideUp();
			}
		});
		return false;
	});
	
	$('.mobileAppList a').click(function() {
		ind=$(".mobileAppList a").index(this);
		$.each($('.mobileAppList a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.mobileAppDetails div.appData'), function(index) {
			if(ind == index){
				$(this).css({ "visibility": 'visible', "height": 300 + "px" });
			}
			else{
				$(this).css({ "visibility": 'hidden', "height": 0 + "px", "overflow": 'hidden' });
			}
		});
		return false;
	});
	
	$('.addEmailID').click(function() {
		$('.formTable .frndEmlID').fadeIn();
		$(this).closest('li').fadeOut();
	});
	
	$.each($('.feedburnerFeedBlock li p.date'), function(index) {
		$($(this).closest('li').find('span.headline a')).html('<b>'+$($(this).closest('li').find('span.headline a')).text()+'</b>');
		$($(this).closest('li').find('span.headline a')).append($(this).text());
		$(this).css('display','none');
	});
	
	$('.tabLinks a').click(function() {
		ind=$(".tabLinks a").index(this);
		$.each($('.tabLinks a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.tabData > div'), function(index) {
		  if(ind == index){
			  $(this).slideDown();
			  $(this).find('div').css('display','block')
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		return false;
	});
	
	$('.services a').click(function() {
		ind=$(".services a").index(this);
		$.each($('.services a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.thumbs div.slideshow'), function(index) {
		  if(ind == index){
			  $(this).find('ul').css('left','0');
			  $(this).slideDown();
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		
		$.each($('.servDetails div'), function(index) {
		  if(ind == index){
			  $(this).slideDown();
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		
		return false;
	});
	
	$('.ulAcc a.header').mouseover(function() {
		if(!jQuery(this).hasClass('current')){
			$.each($('.ulAcc a'), function(index) {
			  $(this).removeClass('current');
			});
			jQuery(this).addClass('current');
	
			$.each($('.ulAcc p'), function(index) {		  
				$(this).slideUp('fast');
			});
			jQuery(this).closest('li').find('p').slideDown('fast');
		}
		return false;
	});
	
	$('.pplList a').click(function() {
		ind=$(".pplList a").index(this);
		$.each($('.pplList a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');

		$.each($('.pplDetails li'), function(index) {
		  if(ind == index){
			  $(this).slideDown();
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		return false;
	});
	
	$('.openingList a.postName').click(function() {
		if($(this).parent().attr('class')=='post'){
			ind=$(".openingList a.postName").index(this);
			$.each($('.openingList a.postName'), function(index) {
			  $(this).removeClass('current');
			});
			if(jQuery(this).closest('li').find('div.postInfo').css('display')=='block'){
				jQuery(this).closest('li').find('div.postInfo').slideUp();
			}
			else{
				jQuery(this).addClass('current');
	
				$.each($('.openingList > li'), function(index) {
				  if(ind == index){
					  $(this).find('.postInfo').slideDown();
				  }
				  else{
					   $(this).find('.postInfo').slideUp();
				  }
				});
			}
		}
		return false;
	});
	
	$('.openingList a.postNameDsbl').click(function() {
		return false;
	});
	
	/* Catalog Logos */
	$('.catalogLogos a').hover(
	  function () {
		var src = $(this).find('img').attr("src").match(/[^\.]+/) + "-over.png";
		$(this).find('img').attr("src", src);
	  }, 
	  function () {
		var src = $(this).find('img').attr("src").replace("-over", "");
		$(this).find('img').attr("src", src);
	  }
	);
	
	$('.timeLine area').mousemove(function(e) {
		$('.timeLine div').each(function(index) {
			$(this).hide();
		});
		var i, x = [], y = [];
		var c = $(this).attr('coords').split(',');
		for (i=0; i < c.length; i++){
		 x.push( c[i++] );
		 y.push( c[i] );
		}
		var t = y.sort(num)[0];
		var l = x.sort(num)[0];
		var pos = $('.wrapper').offset();
		var pos2 = $('#'+$(this).attr('id')+'Data').offset();
		$('#'+$(this).attr('id')+'Data').css( { "left": (e.pageX-pos.left-15) + "px", "top": (e.pageY+35) + "px", "margin-top": -18 + "px", "margin-left": 0 + "px" } );
		if(($(window).height()+$(window).scrollTop())<(e.pageY+$('#'+$(this).attr('id')+'Data').height())){
			$('#'+$(this).attr('id')+'Data').attr('class','timeLineInfoUp');
			$('#'+$(this).attr('id')+'Data').css({"margin-top": '-'+($('#'+$(this).attr('id')+'Data').height()+50)+'px',"margin-left": '-190px'});
		}
		else{	
			$('#'+$(this).attr('id')+'Data').attr('class','timeLineInfo');
		}
		$('#'+$(this).attr('id')+'Data').show();
		function num(a, b){ return (a-b); }
	});
	$('.timeLine area').click(function(e) {
		return false;
	});
	
	$('.igCustomLrn div.clearfix a').mousemove(function(e) {
		ind=$(".igCustomLrn div.clearfix a").index(this);
		$.each($('.igCustomLrn div.clearfix a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');
		
		$.each($('.igCustomLrn div.typeInfo'), function(index) {
		  if(ind == index){
			  var pos = jQuery(this).offset();
			  var pos2 = $('.wrapper').offset();
			  if(($(this).width()+pos.left)>(pos2.left+$('.wrapper').width())){
				  $(this).css({"background-position":'right top', "margin-left":'-315px'});
			  }
			  $(this).css('left',e.pageX-pos2.left);
			  $(this).show();
		  }
		  else{
			   $(this).hide();
		  }
		});
	});
	$('.igCatalog .links a').mousemove(function(e) {
		ind=$(".igCatalog .links a").index(this);
		$.each($('.igCatalog .links a'), function(index) {
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');
		
		$.each($('.igCatalog div.typeInfo'), function(index) {
		  if(ind == index){
			  var pos = jQuery(this).offset();
			  var pos2 = $('.wrapper').offset();
			  if(($(this).width()+pos.left)>(pos2.left+$('.wrapper').width())){
				  $(this).css({"background-position":'right top', "margin-left":'-315px'});
			  }
			  $(this).css({'left':e.pageX-pos2.left, 'top':e.pageY-pos2.top});
			  $(this).show();
		  }
		  else{
			   $(this).hide();
		  }
		});
	});
	$('.igCustomLrn div.clearfix a, .igCatalog .links a').click(function(e) {
		return false;
	});
	$('#lmsPrice a').click(function(e) {
		$('.lmsPrice span').text($(this).text());
		$.each($('#lmsPrice a'), function(index){
		  $(this).removeClass('current');
		});
		jQuery(this).addClass('current');
		
		$('.pricingData, .addonModule').css('display','none');
		$('#'+jQuery(this).text()).css('display','block');
		$('#ao'+jQuery(this).text()).css('display','block');
		$('.currencyVal').text(jQuery(this).text());
		$('#lmsPrice').hide();
		return false;
	});
	
	$('.igCustomLrn .first').css('left','300px');
	$('.igCatalog .first').css({left:'280px',top:'525px'});
	
	$('.pgLrnMgmtSys .keyHighlights li:odd, .pgSolOverview .keyHighlights li:odd, .pplList a:odd, .pgRpdAthr .keyHighlights li:odd').css("margin-right", "0");
	$('.dataTable tr:even td').css('background-color','#f7f7f7');
	$('.dataTable tr:even td.special').css('background','url("/images/bg-datatable-rows.png") repeat-x #F4FCE9');
	$('.contentInner .formTable li:odd, .pgSocialLinks .links > li:odd').css('background-color','#f4f4f4');
	$('.pgLrnMgmtSysCmp .formTable li:odd, .campaignU2G .formTable li:odd').css('background-color','#f8f8f8');
	$('.openingList .formTable li:odd').css("background-color", "#fff");
	
	/* UpsideLMS new GUI */
	$('.lmsInfoTabs a').hover(
	  function () {
		  if($(this).hasClass('current')==false && $(this).hasClass('videoLMS')==false){
			$(this).css('background-position','left -45px');
			$(this).find('span').css({backgroundPosition:'right -45px', color:'#fff'});
			$(this).find('span').animate({height:'30px', paddingTop:'12px'},200);
		  }
		  else if($(this).hasClass('current')==false && $(this).hasClass('videoLMS')){
			 $(this).css('background-position','left -135px');
			 $(this).find('span').css({backgroundPosition:'right -45px', color:'#fff'});
			 $(this).find('span').animate({height:'30px', paddingTop:'12px'},200);
		  }
	  }, 
	  function () {
		  if($(this).hasClass('current')==false && $(this).hasClass('videoLMS')==false){
			$(this).css('background-position','left top');
			$(this).find('span').css({backgroundPosition:'right top', color:'#666'});
			$(this).find('span').animate({height:'26px', paddingTop:'8px'},200);
		  }
		  else if($(this).hasClass('current')==false && $(this).hasClass('videoLMS')){
			 $(this).css('background-position','left -90px');
			 $(this).find('span').css({backgroundPosition:'right -90px', color:'#fff'});
			 $(this).find('span').animate({height:'26px', paddingTop:'8px'},200);
		  }
	  }
	);
	$('.lmsInfoTabs a').click(function() {
		//ind=$(".lmsInfoTabs a").length-$(".lmsInfoTabs a").index(this)-1;
		ind=$(".lmsInfoTabs a").index(this);
		$.each($('.lmsInfoTabs a'), function(index) {
			$(this).removeClass('current');
			if(ind!=index && $(this).hasClass('videoLMS')==false){
			  	$(this).css('background-position','left top');
			  	$(this).find('span').css({backgroundPosition:'right top', color:'#666'});
				$(this).find('span').animate({height:'26px', paddingTop:'8px'},200);
			}
			else if(ind!=index && $(this).hasClass('videoLMS')){
			  	$(this).css('background-position','left -90px');
				$(this).find('span').css({backgroundPosition:'right -90px', color:'#fff'});
				$(this).find('span').animate({height:'26px', paddingTop:'8px'},200);
			}
			else if(ind==index && $(this).hasClass('videoLMS')){
				$(this).css('background-position','left -135px;');
			  	$(this).find('span').css({backgroundPosition:'right -45px', color:'#fff'});
				$(this).find('span').animate({height:'30px', paddingTop:'12px'},200);
			}
		});
		jQuery(this).addClass('current');

		$.each($('.lmsInfoTabData div'), function(index) {
		  if(ind == index){
			  $(this).slideDown();
		  }
		  else{
			   $(this).slideUp();
		  }
		});
		return false;
	});
	$('.pgLrnMgmtSys').each(function(index) {
		ind=proID;
		$('.lmsInfoTabs a:eq('+ind+')').addClass('current');
		$('.lmsInfoTabData div:eq('+proID+')').css('display','block');
		if(proID>0){
			var targetOffset = $('.lmsInfoTabs').offset().top - 50;
			$('html,body').animate({scrollTop: targetOffset}, 1000);	
		}
		chkYT();
	});
	
	//Page Loads-----
	
	$('form#pplProfiles a').click(function() {
		$('form#pplProfiles').submit();
		return false;
	});
	$('.lnkBackCS').click(function() {
		$('#frmCaseStudies').submit();
		return false;
	});
	$('.bookAppt').each(function(index) {
		$('.formTable li:odd').css('background-color','#f8f8f8');
	});
	$('.pgCaseStudies').each(function(index) {
		$('.tabData div:first').css('display','block');
	});
	$('.pgLeadership').each(function(index) {
		if(typeof proID != 'undefined'){
			$('.pplList a').eq(proID).trigger('click');
		}
	});
	$('.pgCaseStudies').each(function(index) {
		if(typeof proID != 'undefined'){
			$('.tabLinks a').eq(proID).trigger('click');
		}
	});
	$('.pgShowcaseCustom, .pgShowcaseLMS').each(function(index) {
		var targetOffset = $('.page').offset().top;
		//alert(targetOffset)
		$('html,body').animate({scrollTop: targetOffset-20}, 1000);	
		return false;
	});
	
	/*$('.pgInnovation').each(function(index) {
		$('.mobAppsLinks li:last-child').css('marginRight','0');
	});*/
	
	$('.pgClients, .pgTestimonials').each(function(index) {
		jQuery(this).find('.lkClients').addClass('parentLinkOpen');
		jQuery(this).find('.lkTestimonials').css('display','block');
	});
	$('.pgPartners .lkPartners, .pgPartnerProg .lkPartnerProg, .pgBePartner .lkBePartner, .pgThankU .lkBePartner').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkPartners').addClass('parentLinkOpen');
	});
	$('.pgAwards .lkAwards').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').slideDown();
		jQuery(this).addClass('parentLinkOpen');
	});
	$('.pgLifeUpl .lkLifeUpl, .pgEmpTst .lkEmpTst').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkCareers').addClass('parentLinkOpen');
	});
	$('.pgAwards07 .lkAwards07, .pgAwards08 .lkAwards08, .pgAwards09 .lkAwards09, .pgAwards10 .lkAwards10').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkAwards').addClass('parentLinkOpen');
	});
	$('.pgLrnMgmtSys .lkLrnMgmtSys, .pgLmsPricing .lkLmsPricing, .pgLmsSupport .lkLmsSupport, .pgLmsFeatures .lkLmsFeatures, .pgLmsAllServ .lkLmsAllServ, .pgLmsEntVer .lkLmsEntVer, .pgLmsCustLrnPorts .lkLmsCustLrnPorts, .pgLmsAdmServ .lkLmsAdmServ, .pgLmsAdmServPck .lkLmsAdmServPck').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkLrnMgmtSys').addClass('parentLinkOpen');
	});
	$('.pgUpside2Go .lkUpside2Go, .pgU2GFeatures .lkU2GFeatures, .pgU2GPricing .lkU2GPricing, .pgU2GSupport .lkU2GSupport').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkUpside2Go').addClass('parentLinkOpen');
	});
	$('.pgNews .lkNews, .pgNews09 .lkNews09, .pgNews10 .lkNews10, .pgNews11 .lkNews11, .pgNews08 .lkNews08, .pgNews07 .lkNews07').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkNews').addClass('parentLinkOpen');
	});
	$('.pgNewsletters .lkNewsletters, .pgNewsLtr11 .lkNewsLtr11, .pgNewsLtr12 .lkNewsLtr12').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkNewsletters').addClass('parentLinkOpen');
	});
	$('.pgCustELrn .lkCustELrn, .pgELrnCourses .lkELrnCourses, .pgSimsScns .lkSimsScns, .pgGameLrn .lkGameLrn, .pgTransLocl .lkTransLocl, .pgRpdAthr .lkRpdAthr').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkCustELrn').addClass('parentLinkOpen');
	});
	$('.pgMobLrn .lkMobLrn, .pgWhyMobLrn .lkWhyMobLrn, .pgMobLrnDsg .lkMobLrnDsg, .pgMobApps .lkMobApps').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkMobLrn').addClass('parentLinkOpen');
	});
	$('.pgCatCourses .lkCatCourses, .pgItSkills .lkItSkills, .pgSoftBsnMgmt .lkSoftBsnMgmt, .pgBsnMgmtLdr .lkBsnMgmtLdr, .pgHltSafe .lkHltSafe, .pgBankFnc .lkBankFnc, .pgOtherLang .lkOtherLang, .pgCertCrs .lkCertCrs, .pgMobileCrs .lkMobileCrs').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkCatCourses').addClass('parentLinkOpen');
	});
	$('.pgCareers .lkCareers, .pgJobOpenings .lkJobOpenings, .pgEmpTst .lkEmpTst').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkCareers').addClass('parentLinkOpen');
	});
	$('.pgLrnDesign .lkLrnDesign, .pgLrnDesignPhsp .lkLrnDesignPhsp').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkLrnDesign').addClass('parentLinkOpen');
	});
	/*$('.pgNewsletters .lkNewsletters, .pgNewsletterArch .lkNewsletterArch').each(function(index) {
		jQuery(this).closest('span').find('.subSubLink').css('display','block');
		$('.lkNewsletters').addClass('parentLinkOpen');
	});*/
	
	$('.pgMobLrn, .pgUpside2Go').each(function(index) {
		$('.services a:first-child').trigger('click');
	});
	$('.pgHome').each(function(index) {
		$('.rightBar .rgtBarMod:last').css('margin-bottom','0');	
	});
	
	/* Social RSS Reader */
	$('.pgSocialLinks').each(function(index) {
		$('#twitter').rssfeed('http://twitter.com/statuses/user_timeline/74946653.rss');
		$('#slideShare').rssfeed('http://www.slideshare.net/rss/user/UpsideLearning');
		$('#youTube').rssfeed('http://gdata.youtube.com/feeds/api/users/upsidelearning/uploads');
		$('#twitter li li').each(function(index) {
			alert($(this).text());
		});
	});
	$('#TwitterCounter a').click(function(e) {
		window.location.href = "http://twitter.com/upsidelearning";
		return false;
	});
	
	/* Emp Testimonials */
	$('.readAll').click(function(e) {
		$(this).hide();
		$('.pgEmpTst #profiles li').css('display','block');
		return false;
	});
	$('.empList a').hover(
	  function () {
		$(this).find('img.clr').css('display','block');
		$(this).find('img.bw').css('display','none');
	  }, 
	  function () {
		$(this).find('img.clr').css('display','none');
		$(this).find('img.bw').css('display','block');
	  }
	);
	$('.empList a').click(function(e) {
		ind=$(".empList a").index(this);
		$('.empSays').css('display','block');
		$.each($('.empSays .testimonial'), function(index) {
		  if(ind == index){
			$(this).slideDown();
		  }
		  else{
			$(this).css('display','none');
		  }
		});
		$('.empList').animate({marginTop:"-310px"}, 500);
		return false;
	});
	$('.testimonial .txtRight a').click(function(e) {
		$('.empList').animate({marginTop:"0"}, 500);
		$('.empSays .testimonial').css('display','none');
		$('.empSays').slideUp();
		return false;
	});
	
	//Slideshows-----
	
	if($('.pgHome').find('#sotester').attr('id')=='sotester'){
		
	}
	else{
		$('.pgHome').each(function(index) {
			//$("div.bannerHome").carousel( { autoSlide: true, autoSlideInterval: 5000 } );
			$('#coda-slider-1').codaSlider({
			   autoSlide: true,
			   autoSlideInterval: 8000,
			   dynamicArrows: false
		   });
		});
	}
	
	$('.pgLrnMgmtSys, .pgLmsOvr, .pgLmsFeatures, .pgLmsPricing, .pgLmsSupport, .pgLmsEntVer, .pgLmsAllServ, .pgLmsCustLrnPorts, .pgThankU, .pgLmsAdmServ, .pgLmsAdmServPck').each(function(index) {
		$("div.quickFacts").carousel( { autoSlide: true, autoSlideInterval: 5000, pagination: true } );
		$("div.showCase").carousel( { loop: true } );
		$("div.slideshow").carousel( { autoSlide: true, autoSlideInterval: 5000
, effect: "fade", animSpeed: "slow" } );
	});
	
	$('.pgNewsDetails').each(function(index) {
		$("div.quickFacts").carousel( { autoSlide: true, autoSlideInterval: 5000, pagination: true } );
	});
	
	$('.pgOverview, .pgInstDsr').each(function(index) {
		var div = $('div.sc_menu'),
			 ul = $('ul.sc_menu'),
			 // unordered list's left margin
			 ulPadding = 15;

			//Get menu width
			var divWidth = div.width();
		
			//Remove scrollbars
			div.css({overflow: 'hidden'});
		
			//Find last image container
			var lastLi = ul.find('li:last-child');
		
			//When user move mouse over menu
			div.mousemove(function(e){
		
			  //As images are loaded ul width increases,
			  //so we recalculate it each time
			  var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
		
			  var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
			  div.scrollLeft(left);
			});
			
			div.mouseout(function(e){
			  div.scrollLeft(0);
			});
	});
	
	$('.pgCustELrn, .pgELrnCourses, .pgSimsScns, .pgGameLrn, .pgTransLocl, .pgRpdAthr').each(function(index) {
		$("div.slideshow").carousel( { autoSlide: true, autoSlideInterval: 7000
, effect: "fade", animSpeed: "slow" } );
		$("div.showCase").carousel( { loop: true } );
	});
	
	$('.pgFacilities').each(function(index) {
		$("div.quickFacts").carousel( { autoSlide: true, autoSlideInterval: 7000
, effect: "fade", animSpeed: "slow", pagination: true } );
	});
	
	$('.pgSolOverview').each(function(index) {
		$("div.slideshow").carousel( { autoSlide: true, autoSlideInterval: 7000
, effect: "fade", animSpeed: "slow" } );
	});
	
	$('.pgMobLrn, .pgUpside2Go, .pgWhyMobLrn, .pgMobLrnDsg, .pgMobApps, .pgCatCourses, .pgItSkills, .pgSoftBsnMgmt, .pgBsnMgmtLdr, .pgBankFnc, .pgHltSafe, .pgOtherLang, .pgCertCrs, .pgMobileCrs, .pgU2GFeatures, .pgU2GPricing, .pgU2GSupport').each(function(index) {
		$("div.slideshow").carousel( { autoSlide: true, autoSlideInterval: 5000 } );
	});
	
	$('.pgMobApps').each(function(index) {
		$(".appScrs").carousel( { loop: true } );
	});
	
	/* Portfolio */
	//$('.portfolio span').rotateRight(10);
	$('.pgPortfolioCustom').each(function(index) {
		// Get a reference to the element.
		var elem = document.getElementById('myCanvas');
		
		// Always check for properties and methods, to make sure your code doesn't break 
		// in other browsers.
		if (elem && elem.getContext) {
		  // Get the 2d context.
		  // Remember: you can only initialize one context per element.
		  var context = elem.getContext('2d');
		  if (context) {
			// You are done! Now you can draw your first rectangle.
			// You only need to provide the (x,y) coordinates, followed by the width and 
			// height dimensions.
			context.fillRect(0, 0, 150, 100);
		  }
		}

	});
	
	/* Popup */
(function($){ 		  
	$.fn.popupWindow = function(instanceSettings){
		
		return this.each(function(){
		
		$(this).click(function(){
		
		$.fn.popupWindow.defaultSettings = {
			centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
			centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
			height:500, // sets the height in pixels of the window.
			left:0, // left position when the window appears.
			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
			resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			width:500, // sets the width in pixels of the window.
			windowName:null, // name of window set from the name attribute of the element that invokes the click
			windowURL:null, // url used for the popup
			top:0, // top position when the window appears.
			toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
		};
		
		settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
		
		var windowFeatures =    'height=' + settings.height +
								',width=' + settings.width +
								',toolbar=' + settings.toolbar +
								',scrollbars=' + settings.scrollbars +
								',status=' + settings.status + 
								',resizable=' + settings.resizable +
								',location=' + settings.location +
								',menuBar=' + settings.menubar;

				settings.windowName = this.name || settings.windowName;
				settings.windowURL = this.href || settings.windowURL;
				var centeredY,centeredX;
			
				if(settings.centerBrowser){
						
					if ($.browser.msie) {//hacked together for IE browsers
						centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
						centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
					}else{
						centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
						centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
					}
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else if(settings.centerScreen){
					centeredY = (screen.height - settings.height)/2;
					centeredX = (screen.width - settings.width)/2;
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else{
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();	
				}
				return false;
			});
			
		});	
	};
})(jQuery);
	
	$('.showcase').popupWindow({ 
		height:620, 
		width:825,
		centerBrowser:1,
		location:0,
		resizable:0
	});
	$('.quickTour').popupWindow({ 
		height:510, 
		width:980,
		centerBrowser:1,
		location:0,
		resizable:0
	});
	$('.compare').popupWindow({ 
		height:630, 
		width:910,
		centerBrowser:1,
		location:0,
		resizable:0
	});
	
});

function iniHome(){
	theRotator();	
}

function runSS(){
	$('.pgHome').each(function(index) {
		$("div.bannerHome").carousel( { autoSlide: true, autoSlideInterval: 5000 } );
	});	
}

function loadU2gPp(){
	//window.open("http://www.nxtbook.com/nxtbooks/b2bmediaco/elearning_20110708/#/10");
	//alert($('#flashpp').attr('href'));
	//$("a[@href^='http']").attr('target','_blank');
	//$('#flashpp').trigger('click');
	$('.elMag').trigger('click');
}

function regASTD(){
	window.open("http://registration3.experient-inc.com/showATD124/Default.aspx");	
}

function regLT(){
	window.open("http://www.learningtechnologies.co.uk/register-now/");	
}

function showVDO(){
	$('#frmLmsVideo').submit();
}

function showSlideShow(){
	var so = new SWFObject("/swf/main.swf", "sotester", "980", "300", "9");
	so.addParam("allowscriptaccess", "always");
	so.addParam("wmode", "transparent");
	so.write("flashBanner");	
}

function loadWolPp(){
	//alert($('.wolPp').attr('href'));
	window.open("http://www.learnevents.com/register-now.php");
	//$('.wolPp').trigger('click');
}

function setBnrPosition(){
	var pos = $('#flashBanner').offset();
	$(window).scrollTop(0);
	$('.highContent').animate({top:pos.top},500,function(){
		$('.highContent, .semiBlack').fadeOut(200);
		var so = new SWFObject("/swf/main.swf", "sotester", "980", "300", "9");
		so.addParam("wmode", "transparent");
		so.write("flashBanner");
		$('.bannerHome').css('visibility','visible');
	});
}

function chkYT(){
	var image = new Image();
	/*image.onload = function(){
		alert('yes');
	};*/
	image.onerror = function(){
		$('#flashBanner').html('<img src="/images/bnrs/no-youtube-upsidelms.jpg" />');
	};
	image.src = "http://youtube.com/favicon.ico";	
}



//------------Drop Down Menu Start-------------
var timeout	= 1;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	//alert($('.'+id).parent().html());
	mcancelclosetime();
	// close old layer
	if(ddmenuitem) ddmenuitem.style.display = 'none';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	var pos = $('.'+id).offset();
	var pos2 = $('.wrapper').offset();
	if($('#'+id).closest('div').parent().hasClass('prtDropDowns')){
		$(ddmenuitem).css( { "left": (pos.left-pos2.left+10) + "px", "top":pos.top + 23 + "px" } );
	}
	else{
		$(ddmenuitem).css( { "left": (pos.left-pos2.left) + "px", "top":pos.top + 30 + "px" } );
	}
	
	ddmenuitem.style.display = 'block';
	jQuery.each($('.mainNav a.subMenu'), function() {
		$(this).removeClass("current");
	});
	$('.'+id).addClass('current');
}
// close showed layer
function mclose()
{
	jQuery.each($('.mainNav a.subMenu, .prtFilters a'), function() {
		$(this).removeClass("current");
	});
	if(ddmenuitem) ddmenuitem.style.display = 'none';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
//document.onclick = mclose; 
//------------Drop Down Menu End---------------

//------------Image Rotator Start--------------
// By Dylan Wagstaff, http://www.alohatechsupport.net
function theRotator() {
	//Set the opacity of all images to 0
	$('div#rotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div#rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',6000);
	
}

/* Upside2Go Video */
function u2gvdo(){
	var so = new SWFObject("http://www.youtube.com/v/duGdkp_jJTw?fs=1&amp;hl=en_US&amp;rel=0&amp;autoplay=1", "sotester", "570", "452", "9", "#F7F7F7");
	so.addParam("allowfullscreen", "true");
	so.addParam("wmode", "transparent");
	so.write("flashBanner");	
}

function rotate() {	
	//Get the first image
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};
//------------Image Rotator End----------------

/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "/images/loadingAnimation.gif";

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))
