jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	}
});



$(function() {
	/*--- FOCUS MANAGEMENT FOR SEARCH FIELD ---*/
	$('#searchfield').focus(function() {
		if ( $(this).val() === "Search" ) { $(this).val(""); }
	});
	$('#searchfield').blur(function() {
		if ( $(this).val() === "" ) { $(this).val("Search"); }
	});

	/*--- ACCORDION SPECIAL ---*/
	if ($('#accordionspecial').length > 0){
		accSpecial();
	}
	
// 	/*--- HERO BANNER TABBED CONTENT ---*/
// 	if ($('.herobanner').length > 0){
// 		$('.herotabs .tab1').click(function(e){ e.preventDefault(); showHeroContent(1); });
// 		$('.herotabs .tab2').click(function(e){ e.preventDefault(); showHeroContent(2); });
// 		$('.herotabs .tab3').click(function(e){ e.preventDefault(); showHeroContent(3); });
// 		$('.herotabs .tab4').click(function(e){ e.preventDefault(); showHeroContent(4); });
// 		$('.herotabs .tab5').click(function(e){ e.preventDefault(); showHeroContent(5); });
// 	}

	/*--- HERO BANNER TABBED CONTENT ---*/
	if ($('.herobanner').length > 0){
		initHeroBanner();
	}

	/*--- BLUE PANEL TABBED CONTENT ---*/
	if ($('.bluetabs').length > 0){
		$('.bluetabs .tab1').click(function(e){ e.preventDefault(); showBlueContent(1); });
		$('.bluetabs .tab2').click(function(e){ e.preventDefault(); showBlueContent(2); });
		//$('.bluetabs .tab3').click(function(e){ e.preventDefault(); showBlueContent(3); });
	}
	
	/*--- Dual Panel TABBED CONTENT ---*/
	if ($('.dualtabs').length > 0){
		$('.dualtabs .tab1').click(function(e){ e.preventDefault(); showDualTabContent(1); });
		$('.dualtabs .tab2').click(function(e){ e.preventDefault(); showDualTabContent(2); });
	}
	
	/*--- Triple Panel TABBED CONTENT ---*/
	if ($('.tripletabs').length > 0){
		$('.tripletabs .tab1').click(function(e){ e.preventDefault(); showTripleTabContent(1); });
		$('.tripletabs .tab2').click(function(e){ e.preventDefault(); showTripleTabContent(2); });
		$('.tripletabs .tab3').click(function(e){ e.preventDefault(); showTripleTabContent(3); });
	}
	
	/*--- Dual Panel TABBED CONTENT ---*/
	if ($('.quadtabs').length > 0){
		$('.quadtabs .tab1').click(function(e){ e.preventDefault(); showQuadTabContent(1); });
		$('.quadtabs .tab2').click(function(e){ e.preventDefault(); showQuadTabContent(2); });
		$('.quadtabs .tab3').click(function(e){ e.preventDefault(); showQuadTabContent(3); });
		$('.quadtabs .tab4').click(function(e){ e.preventDefault(); showQuadTabContent(4); });
	}
	
	/*--- Quint Panel TABBED CONTENT ---*/
	if ($('.quinttabs').length > 0){
		$('.quinttabs .tab1').click(function(e){ e.preventDefault(); showQuintTabContent(1); });
		$('.quinttabs .tab2').click(function(e){ e.preventDefault(); showQuintTabContent(2); });
		$('.quinttabs .tab3').click(function(e){ e.preventDefault(); showQuintTabContent(3); });
		$('.quinttabs .tab4').click(function(e){ e.preventDefault(); showQuintTabContent(4); });
		$('.quinttabs .tab5').click(function(e){ e.preventDefault(); showQuintTabContent(5); });
	}
	
	/*--- Sext Panel TABBED CONTENT ---*/
	if ($('.sexttabs').length > 0){
		$('.sexttabs .tab1').click(function(e){ e.preventDefault(); showSextTabContent(1); });
		$('.sexttabs .tab2').click(function(e){ e.preventDefault(); showSextTabContent(2); });
		$('.sexttabs .tab3').click(function(e){ e.preventDefault(); showSextTabContent(3); });
		$('.sexttabs .tab4').click(function(e){ e.preventDefault(); showSextTabContent(4); });
		$('.sexttabs .tab5').click(function(e){ e.preventDefault(); showSextTabContent(5); });
		$('.sexttabs .tab6').click(function(e){ e.preventDefault(); showSextTabContent(6); });
	}
	
	/*--- Sext Panel TABBED CONTENT ---*/
	if ($('.septtabs').length > 0){
		$('.septtabs .tab1').click(function(e){ e.preventDefault(); showSeptTabContent(1); });
		$('.septtabs .tab2').click(function(e){ e.preventDefault(); showSeptTabContent(2); });
		$('.septtabs .tab3').click(function(e){ e.preventDefault(); showSeptTabContent(3); });
		$('.septtabs .tab4').click(function(e){ e.preventDefault(); showSeptTabContent(4); });
		$('.septtabs .tab5').click(function(e){ e.preventDefault(); showSeptTabContent(5); });
		$('.septtabs .tab6').click(function(e){ e.preventDefault(); showSeptTabContent(6); });
		$('.septtabs .tab7').click(function(e){ e.preventDefault(); showSeptTabContent(7); });
	}
});


function initHeroBanner(){
		$('.herotabs a').click(function(e){ 
			$('.herotabs a').removeClass('active');
			e.preventDefault(); 
			showHeroContent($(this).attr("class").split('tab')[1]);
			$(this).addClass('active');
		});
}
function showHeroContent(cntID){
	$('.heroslides a').css("display","none");
	$('.heroslides .hero'+cntID).css("display","block");
}

// function showHeroContent(cntID){
// 	$('.herotabs .tab1').removeClass('active');
// 	$('.herotabs .tab2').removeClass('active');
// 	$('.herotabs .tab3').removeClass('active');
// 	$('.herotabs .tab4').removeClass('active');
// 	$('.herotabs .tab5').removeClass('active');
// 	var tmpTab = '.herotabs .tab'+cntID;
// 	$(tmpTab).addClass('active');

// 	$('.heroslides .hero1').css("display","none");
// 	$('.heroslides .hero2').css("display","none");
// 	$('.heroslides .hero3').css("display","none");
// 	$('.heroslides .hero4').css("display","none");
// 	$('.heroslides .hero5').css("display","none");
// 	var tmpContent = '.heroslides .hero'+cntID;
// 	$(tmpContent).css("display","block");
// }

function showBlueContent(cntID){
	$('.bluetabs .tab1').removeClass('active');
	$('.bluetabs .tab2').removeClass('active');
	//$('.bluetabs .tab3').removeClass('active');
	var tmpTab = '.bluetabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	//$('.tabbedcontent3').css("display","none");
	var tmpContent = '.panelblue .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}


/*--- ACCORDION SPECIAL ---*/
function accSpecial() {
	$('.acccntcontainer').hide(); 
	$('#accordionspecial .accpart:first .acctrigger').addClass('active');
	$('#accordionspecial .accpart:first .acccntcontainer').show();
	$('#accordionspecial .accpart .acctrigger').click(function(e){
		if( $(this).next().is(':hidden') ) {

// 			if ($.browser.msie && $.browser.version.substr(0,1)<8) {
// 				$('.acctrigger').removeClass('active').next().hide();
// 				$(this).toggleClass('active').next().show();
// 			} else {
				$('.acctrigger').removeClass('active').next().slideUp(400,'easeOutExpo'); 
				$(this).toggleClass('active').next().slideDown(400,'easeInExpo');
// 			}

		}
		e.preventDefault();
	});
	initAccBiogs();
}

function initAccBiogs() {
	var firstPhoto = $('.mngmtpics a:first');
	var firstId = firstPhoto.attr("href").split('#biog')[1];
	var firstBiogId = '#biog'+firstId;

	$('.mngmtbiogs .leftc a, .mngmtpics a').click(function(e){
		e.preventDefault();
		
		showAccBiog($(this).attr("href").split('#biog')[1]);
	});
	showAccBiog(firstId);
}

function showAccBiog(biogIdNr) {
	$('.rightc .biogdata').each(function(){
		$(this).css("display","none");
	});
	$('.mngmtpics a, .mngmtbiogs .leftc a').each(function(){
		$(this).removeClass('active');
	});
	var biogId = '#biog'+biogIdNr;
	$('.mngmtbiogs .leftc a, .mngmtpics a').each(function(){
		if ($(this).attr("href") === biogId ) {
			$(this).addClass('active');
		}
	});
	$(biogId).css("display","block"); 
}

function showDualTabContent(cntID){
	$('.dualtabs .tab1').removeClass('active');
	$('.dualtabs .tab2').removeClass('active');
	var tmpTab = '.dualtabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	var tmpContent = '.dualpanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}
function showTripleTabContent(cntID){
	$('.tripletabs .tab1').removeClass('active');
	$('.tripletabs .tab2').removeClass('active');
	$('.tripletabs .tab3').removeClass('active');
	var tmpTab = '.dualtabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	$('.tabbedcontent3').css("display","none");
	var tmpContent = '.triplepanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}
function showQuadTabContent(cntID){
	$('.quadtabs .tab1').removeClass('active');
	$('.quadtabs .tab2').removeClass('active');
	$('.quadtabs .tab3').removeClass('active');
	$('.quadtabs .tab4').removeClass('active');
	var tmpTab = '.quadtabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	$('.tabbedcontent3').css("display","none");
	$('.tabbedcontent4').css("display","none");
	var tmpContent = '.quadpanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}
function showQuintTabContent(cntID){
	$('.quinttabs .tab1').removeClass('active');
	$('.quinttabs .tab2').removeClass('active');
	$('.quinttabs .tab3').removeClass('active');
	$('.quinttabs .tab4').removeClass('active');
	$('.quinttabs .tab5').removeClass('active');
	var tmpTab = '.quinttabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	$('.tabbedcontent3').css("display","none");
	$('.tabbedcontent4').css("display","none");
	$('.tabbedcontent5').css("display","none");
	var tmpContent = '.quintpanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}

function showSextTabContent(cntID){
	$('.sexttabs .tab1').removeClass('active');
	$('.sexttabs .tab2').removeClass('active');
	$('.sexttabs .tab3').removeClass('active');
	$('.sexttabs .tab4').removeClass('active');
	$('.sexttabs .tab5').removeClass('active');
	$('.sexttabs .tab6').removeClass('active');
	var tmpTab = '.sexttabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	$('.tabbedcontent3').css("display","none");
	$('.tabbedcontent4').css("display","none");
	$('.tabbedcontent5').css("display","none");
	$('.tabbedcontent6').css("display","none");
	var tmpContent = '.sextpanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}

function showSeptTabContent(cntID){
	$('.septtabs .tab1').removeClass('active');
	$('.septtabs .tab2').removeClass('active');
	$('.septtabs .tab3').removeClass('active');
	$('.septtabs .tab4').removeClass('active');
	$('.septtabs .tab5').removeClass('active');
	$('.septtabs .tab6').removeClass('active');
	$('.septtabs .tab7').removeClass('active');
	var tmpTab = '.septtabs .tab'+cntID;
	$(tmpTab).addClass('active');

	$('.tabbedcontent1').css("display","none");
	$('.tabbedcontent2').css("display","none");
	$('.tabbedcontent3').css("display","none");
	$('.tabbedcontent4').css("display","none");
	$('.tabbedcontent5').css("display","none");
	$('.tabbedcontent6').css("display","none");
	$('.tabbedcontent7').css("display","none");
	var tmpContent = '.septpanel .tabbedcontent'+cntID;
	$(tmpContent).css("display","block");
}
