/* LAYOUT FIXES */

//elem2 = document.getElementById( "foot-logo-en" );
//alert("TEST: " + elem2);

function fixLayout()
{
	var r = document.getElementById("right-col");
	var c = document.getElementById("content");
	var cc = document.getElementById("center-col-cont");
	var h = c.offsetHeight;
	if (r)
	{
		r.style.height = h + "px";
	}
}


if (window.addEventListener)
	window.addEventListener("load", fixLayout, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", fixLayout);



/* CLIENT LOGIN EXPANDER*/

function ExpanderPanel_Toggle( targetID ) {
	if ( document.getElementById ) {
		
		var target 		= document.getElementById( targetID );
		
		if ( target != null ) {
			target.style.display = ( target.style.display != "none" ) ? "none" : "block";
		}

		
		return false;
	}
	return true;
}

/* TOP URL CHECKER FOR TABS*/
function checkTopParent(targetURL) {
	
	var topURL	= new String ( window.top.location.href );
	// Diregard Query Strings
	topURL = topURL.split("?");
	topURL = topURL[0];
	var parentURL	= new String ( "https://" + window.top.location.hostname + targetURL );
	
//alert(topURL)
	var cmsdesk = topURL.match("cmsdesk");

	if (topURL+"!" != parentURL+"!" && cmsdesk == null ) {
		window.top.location.replace(parentURL);

	}
	
}

/* Hide Webcontainer via javascript if empty*/
function hideLayer(element) {
	elem = document.getElementById( element );
	elem.style.display = "none";
}

/* Hide Webcontainer via javascript if empty*/
function fixLogo(logoType, logoLang) {
	
	
	elem = document.getElementById( "pwl-logo-"+logoLang );
	if (logoType == "neutral") {
		elem.style.backgroundImage = 'url(/static/images/logo-neutral.gif)';
	} else if (logoType == "advisor" && logoLang =="en") {
		elem.style.backgroundImage = 'url(/static/images/logo-advisor.gif)';
	} else if (logoType == "advisor" && logoLang =="fr") {
		elem.style.backgroundImage = 'url(/static/images/logo-conseil.gif)';
	}

}

/* Hide footer if necessary*/
function hideFooter(logoLang) {
	
	// remove also the logo at the bottom
	if (footerType == "none") {
		elem_2 = document.getElementById( "foot-logo-" + logoLang);
		elem_2.style.display = 'none';
		
	}

}



