// JavaScript Document
function mainBannerCycle() {
	$(".dfgPromoImageHolder").cycle({
		fx: "fade",
		speed: 1000,
		timeout: 5000,
		pause: 1
	});
}

function servicesSubmenuAccordion(chosenService) {
	$("#submenu").accordion({active:chosenService});
	//$("#submenu").accordion({active:false});
    $("#submenu").accordion( "option", "collapsible", true );
    $("#submenu").accordion( "option", "autoHeight", true );
 
    
    $("#PortfolioManagementHeader").click(function(event) {
    event.cancelBubble = true;
    if(event.stopPropagation) { event.stopPropagation(); }
    return false;
    });

    $("#TechnologyHeader").click(function(event) {
        event.cancelBubble = true;
        if (event.stopPropagation) { event.stopPropagation(); }
        return false;
    });

}

var currently_shown="#pm_experience";
	function show(selected_to_show) {
		$(currently_shown).fadeOut(200);
		$(selected_to_show).fadeIn(200);
		currently_shown = selected_to_show;
	}
	
function getQuerystring(key, default_) {
	if (default_==null) default_=""; 
	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
	var qs = regex.exec(window.location.href);
	if(qs == null)
		return default_;
	else
		return qs[1];
}

function getChosenService() {
	if (getQuerystring('service') == "portfolio_management")
		return (0);
	if (getQuerystring('service') == "advisory_services")
		return (1);
	return (0);	   
}

function openCorrectService(chosenService) {
	//show("#as_asset_valuation");
	//currently_shown="#as_asset_valuation";
	servicesSubmenuAccordion(chosenService);
	if (chosenService == 0) {
		show("#pm_experience");
		currently_shown="#pm_experience";
	}
	if (chosenService == 1) {
		show("#advisory_home");
		currently_shown = "#advisory_home";
	}
}

function teamContentSwap() {
	
	$("#DFGteamSummary1").css("display","block");
	$("#DFGteam1").css("text-decoration","underline");
	$(".dfgSubCol1Info div").each(
		function(intIndex){
			$(this).bind(
				"mouseover",
				function(){
					if ($(this).css("text-decoration") == "none") {
						$(this).css({
							"cursor" : "pointer",
							"text-decoration" : "underline"
						});
					}
				}
			);
			$(this).bind(
				"mouseout",
				function(){
					if ($("#DFGteamSummary" + (intIndex+1)).css("display") == "none") {
						$(this).css({
							"text-decoration" : "none"
						});
					}
				}
			);				
			$(this).bind(
				"click",
				function(){
					if ($("#DFGteamSummary" + (intIndex+1)).css("display") == "none") {
						$(".dfgTeamSummary").css("display","none");
						$("#DFGteamSummary" + (intIndex+1)).queue(function(){
							$(this).fadeIn(1000);
							$(".dfgSubCol1Info div").css("text-decoration","none");
							$("#DFGteam" + (intIndex+1)).css("text-decoration","underline");
							$(this).dequeue();
						});
					}
				}
			);				
		}
	);
	
}

function mainBannerCheck(){
	alert($(".dfgMenu ul li").html())	
	alert($(".dfgMenu ul li a").css("letter-spacing"))
}

function mainPromoButtonRollover() {
	
	$(".dfgPromoButton").each(
		function(intIndex){
			$(this).bind(
				"mouseover",
				function(){
					$(this).find("a").css("cursor","pointer");
				}
			);
			$(this).bind(
				"click",
				function(){
					document.location = $(this).find(".dfgPromoButtonHeadline a").attr("href");
				}
			);
		}
	);
	$("#DFGpromoButton1").mouseover(
		function(){
			$(this).css({
				"cursor" : "pointer",
				"background" : "#03132c"
			});	
		}
	).mouseout(
		function(){
			$(this).css("background","#394d6e");
		}
	);
	$("#DFGpromoButton2").mouseover(
		function(){
			$(this).css({
				"cursor" : "pointer",
				"background" : "#03132c"
			});
		}
	).mouseout(
		function(){
			$(this).css("background","#0d2c58");
		}
	);	

}
