
// footer popups
function fnPopup(FilePath)
{
	window.open(FilePath,"Mydoc","toolbars=no,scrollbars=yes,height=500,width=690,top=0,left=0,status=yes,resizable=true")
}
	
function navOver(myNav)
{
	
	eval("DivObject.all." + myNav + ".show(true)")
	eval("DivObject.all." + myNav + ".inherit()")
}

function navOut(myNav)
{
	eval("DivObject.all." + myNav + ".hide(true)")
	eval("DivObject.all." + myNav + ".inherit()")
	
}

function popupImageViewer(src,type){
	var settings = "toolbar=no,status=no,menubar=no,resizable=yes,directories=no,location=no,left=20,top=20,";
	switch(type) {
		case "contact" : {settings+= "width=300,height=400,scrollbars=yes"; break;}
		case "office" : {settings+= "width=420,height=330,scrollbars=no"; break;}
		default : {settings+= "width=400,height=400,scrollbars=yes"; }
	}
	var newWin = window.open('/Showimage/showimage.aspx?Binaryname='+src,'',settings)
	
}



var useLocalDrillDown=false
var drillDownOnForMoreInfo=false
function findNestedContent(cTypeId,cItemId)
{
	// find the location from the contentTypeId
	
	
	// ----- fix the inputs -----
	if(cTypeId.indexOf(',') > 0){
		cItemId = cTypeId.substring((cTypeId.indexOf(',') + 1), cTypeId.length);
		cTypeId = cTypeId.substring(0, cTypeId.indexOf(','));
	}	
	if(cTypeId.indexOf('cTypeID=') == 0){
		cTypeId = cTypeId.substring(8, cTypeId.length);
	}
	if(cItemId.indexOf('cItemID=') == 0){
		cItemId = cItemId.substring(8, cItemId.length);
	}
	
	
	// we stay on the same page
	// if using local drill down
	if (useLocalDrillDown && drillDownOnForMoreInfo)
	{
		var currPath=window.location.href
		if(currPath.indexOf("substnId")!=-1) window.location=currPath.replace(/substnId=\d+/,"substnId="+cItemId);
		else window.location=currPath + "&substnId="+cItemId;
		
	}
	// otherwise we try to find a suitable page to show the content on
	else
	{
		switch(cTypeId){
			case '1':
				// Do nothing
				break
			case '2':
				window.location = '/expertise/legal_services/details.aspx?contentItemID=' + cItemId;
				break
			case '3':
				// Do nothing
				break
			case '4':
				window.location = '/expertise/locations/details.aspx?contentitemid=' + cItemId;
				break
			case '5':
				window.location = '/directory/offices/details.aspx?contentitemid=' + cItemId;
				break
			case '6':
				window.location = '/directory/lawyers/details.aspx?ContentItemId=' + cItemId;
				break
			case '7':
				window.location = '/expertise/industries/details.aspx?contentItemID=' + cItemId;
				break
			case '8':
				window.location = '/expertise/events/details.aspx?contentItemID=' + cItemId;
				break
			case '9':
				window.location = '/news/latest_news/details.aspx?contentItemID=' + cItemId;
				break
			case '10':
				//This URL may, or may not, remain...
				window.location = '/online_services/overview/details.aspx?contentItemID=' + cItemId;
				break
			case '11':
				window.location = '/expertise/publications/details.aspx?ContentItemId=' + cItemId;
				break
			case '12':
				window.location = '/careers/job_search/details.aspx?ContentItemId=' + cItemId;
				break
			case '13':
				// Do nothing
				break
			case '14':
				window.location = '/editorial/details.aspx?ContentItemId=' + cItemId;
				break
			case '15':
				window.location = '/careers/roles/details.aspx?ContentItemId=' + cItemId;
				break
			case '16':
				window.location = '/careers/careersdetails.aspx?contentItemID=' + cItemId;
				break
			case '17':
				window.location = '/about_us/awards/details.aspx?contentItemID=' + cItemId;
				break
			case '18':
				window.location = '/directory/lawyers/details.aspx?ContentItemId=' + cItemId;
				break
			case '19':
				window.location = '/online_services/testimonial/default.aspx?contentItemID=' + cItemId;
				break
			case '20':
				window.location = '/directory/teams/details.aspx?contentitemid=' + cItemId;
				break
			case '21':
				// Do nothing
				break
			case '22':
				// Do nothing
				break
			default:
				// Do nothing
		}
	
	}
	return
}

function goToCountry(strCountry){
	/* called from  the flash file */
	location = "/Expertise/Locations/details.aspx?strCountry="+strCountry;
}


function fnOpen(URL)
{	
	var myBars = 'directories=no, location= yes, menubar=yes, status = no';
	myBars += 'titlebar=yes,toolbar=yes';	
	var myOptions = 'scrollbars= yes, width = 700, height=400 toolbar = yes resizable = yes';
	var myFeatures = myBars + ',' + myOptions;
	window.open(URL,'',myFeatures);
}

///////////////////////// Print pop-up /////////////////////////////////////////////////
function fnGlobalOpenPrint(strQueryStr)
{
	strURL="../../print/default.aspx?"+strQueryStr;
	window.open(strURL,"Print","toolbar,scrollbars=yes,width=770, height=600");
}

function fnAlignPromos(){
	if (document.getElementById("PromoInner0") && document.getElementById("PromoInner1"))
	{  
		var height1 = document.getElementById("PromoInner0").offsetHeight;
		var height2 = document.getElementById("PromoInner1").offsetHeight;	
		var maxHeight = Math.max(height1,height2) + 5;
		document.getElementById("PromoOuter0").style.height = maxHeight + "px";
		document.getElementById("PromoOuter1").style.height = maxHeight + "px";}
	}
	
///////////////////////// Dropdown pop-up //////////////////////////////////////////////
function fnPopupDD (selectObjectID) {
		obj = document.getElementById(selectObjectID);
		url = obj.options[obj.selectedIndex].value;
		if (url != "-1" && url !="") {
			win=window.open(url, 'new', 'resizable, height=600, width=800,scrollbars');
			win.focus();
		}
	}
///////////////////////// Equal Height Boxes ///////////////////////////////////////////
var equalHeightBoxID = "";
function fnEqualHeightBoxes() {
	offset = 6;
	if (equalHeightBoxID.indexOf("|") > -1) {
		arrIds = equalHeightBoxID.split("|");
		lng = arrIds.length - 1;
		for (var i = 0; i < lng; ) {
			i1 = i;
			i2 = i+1;
			if (obj1 = document.getElementById(arrIds[i1])) {
				if ((i2 < lng) && (obj2 = document.getElementById(arrIds[i2]))) {
					height1 = obj1.offsetHeight;
					height2 = obj2.offsetHeight;	
					maxHeight = Math.max(height1,height2) + offset;
					obj1.style.height = maxHeight + "px";
					obj2.style.height = maxHeight + "px";
				} else {
					height1 = obj1.offsetHeight;
					maxHeight = height1 + offset;
					obj1.style.height = maxHeight + "px";
				}			
			}
			i +=2;
		}
	}
}