/*
	Oxford Economics
	DOM Functions Javascript
	
	Created:	8.29.2006
	Modified:	--
	
	Matt Kircher
	Mainline Media, LLC

*/
function JumpPage(newloc)
{
	newPage = newloc.options[newloc.selectedIndex].value;
	if (newPage != "")
		{
		openInfoWindow(newPage);
		}
}

function openInfoWindow(url)
{
	url = url.toLowerCase();
	if (url.indexOf('pdf') > -1)
		{
		//pdf file to display, need larger screen
		Ht = screen.availHeight * 4 / 5;
		Wd = screen.availWidth * 3 / 4;
		}
	else
		{
		Ht = screen.availHeight/2;
		Wd = screen.availWidth*2/3;
		};
	xpos = screen.availWidth-20-Wd;
	str = 'titlebar=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,top=50,left=' + xpos + ',height=' + Ht + ',width=' + Wd;
	if (url.indexOf("events.asp") != -1 || url.indexOf("allnewtoday.asp") != -1 || url.indexOf("dbupdates.asp") != -1)
    {
        window.open(url, '_blank', str);
    }
    else if(url.indexOf("general_request.aspx") == -1)
    {
	    window.open('general_request.aspx?FPath=' + url, '_blank', str);
	}
	else
    {
        window.open(url, '_blank', str);
    };
}

function openFullInfoWindow(url)
{
	url = url.toLowerCase();
	if (url.indexOf('pdf') > -1)
		{
		//pdf file to display, need larger screen
		Ht = screen.availHeight * 4 / 5;
		Wd = screen.availWidth * 3 / 4;
		}
	else
		{
		Ht = screen.availHeight/2;
		Wd = screen.availWidth*2/3;
		};
	xpos = screen.availWidth-20-Wd;
	str = 'location=yes,titlebar=yes,menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes,top=50,left='+xpos+',height='+Ht+',width='+Wd;
	window.open(url,'_blank',str);
}

function Show_Hide_Ctries() 
{
	var argv = Show_Hide_Ctries.arguments;
	var argc = argv.length;
	var show = true;
	
	if (argc > 0)
		{
		txtID = document.getElementById(argv[0]);
		if (txtID.style.display == "block")
			{
			txtID.style.display = "none";
			}
		else
			{
			txtID.style.display = "block";
			};
		};
}

function ShowHideCtryMenu() 
{
	var argv = ShowHideCtryMenu.arguments;
	var argc = argv.length;
	var show = true;
	
	if (argc > 0)
		{
		txtID = document.getElementById(argv[0]);
		if (txtID.style.display == "block")
			{
			for (i=0; i<argc; i++)
				{
				(document.getElementById(argv[i])).style.display = "none";
				};
			}
		else
			{
			for (i=0; i<argc; i++)
				{
				(document.getElementById(argv[i])).style.display = "block";
				};
			};
		};
}

function ShowCtryDet()
{		
	var argv = ShowCtryDet.arguments;
	var argc = argv.length;
	var ToShow = argv[0];	//div id to be visible - hide all others
	
	var c = document.getElementById("CtryDetWrap");
	var divs = c.getElementsByTagName("div");
	
	for(var i=0; i<divs.length; i++)
		{
		if (divs[i].id == ToShow)
			{
			divs[i].style.display = "block";
			}
		else
			{
			divs[i].style.display = "none";
			};
		};
}

var curr_section = null;

function ShowTxtCons() 
{
	var IDArray = ["OE_Cons_Descns_ImpStud_Text","OE_Cons_Descns_ScenAn_Text","OE_Cons_Descns_MacPolAss_Text","OE_Cons_Descns_TaxAn_Text","OE_Cons_Descns_ModBldg_Text","OE_Cons_Descns_ProdMktFore_Text","OE_Cons_Descns_RegAn_Text","OE_Cons_Descns_Stress_Text","OE_Cons_Descns_Carbon_Text","OE_Cons_Descns_Thought_Text","OE_Cons_Descns_GenText"];
	var argv = ShowTxtCons.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtFAIntMac() 
{
	var IDArray = ["FA_Int_Descns_ForeReps_Text","FA_Int_Descns_OLConfs_Text","FA_Int_Descns_ForeDB_Text","FA_Int_Descns_ScenAn_Text","FA_Int_Descns_CtryCov_Text","FA_Int_Descns_ForeProc_Text","FA_Int_Descns_ForeTeam_Text","FA_Int_Descns_IMGenText"];
	var argv = ShowTxtFAIntMac.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtFAIntSects() 
{
	var IDArray = ["FA_Int_Descns_ForeReps_Text","FA_Int_Descns_OLConfs_Text","FA_Int_Descns_ForeDB_Text","FA_Int_Descns_ScenAn_Text","FA_Int_Descns_CtryCov_Text","FA_Int_Descns_ForeProc_Text","FA_Int_Descns_ForeTeam_Text","FA_Int_Descns_IMGenText"];
	var argv = ShowTxtFAIntSects.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtUK() 
{
	var IDArray = ["FA_Int_Descns_ForeReps_Text","FA_Int_Descns_OLConfs_Text","FA_Int_Descns_ForeDB_Text","FA_Int_Descns_ScenAn_Text","FA_Int_Descns_CtryCov_Text","FA_Int_Descns_ForeProc_Text","FA_Int_Descns_ForeTeam_Text","FA_Int_Descns_IMGenText"];
	var argv = ShowTxtUK.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtMods() 
{
	var IDArray = ["FA_Mod_Descns_Glob_Text","FA_Mod_Descns_IIS_Text","FA_Mod_Descns_REG_Text","FA_Mod_Descns_Bespoke_Text","FA_Mod_Descns_ScenAn_Text","FA_Mod_Descns_Soft_Text","FA_Mod_Descns_Train_Text","FA_Mod_Descns_GenText"];
	var argv = ShowTxtMods.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtAbout() 
{
	var IDArray = ["AU_WhoWeAre_Text","AU_SenStaff_Text","AU_WhatWeDo_Text","AU_OurSubs_Text","AU_HowWeDoIt_Text","AU_OurEcMods_Text","AU_OurClients_Text","AU_OurOffices_Text","AU_OurPartners_Text","AU_Careers_Text","AU_AboutGenText"];
	var argv = ShowTxtAbout.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ShowTxtTourism() 
{
	var IDArray = ["OE_Tourism_Descns_MktStrats_Text","OE_Tourism_Descns_ProjFeas_Text","OE_Tourism_Descns_TImpStudies_Text","OE_Tourism_Descns_ProjImp_Text","OE_Tourism_Descns_VisFores_Text","OE_Tourism_Descns_TourismPolRec_Text","Tourism_Descns_ForeTeam_Text","OE_Tourism_Descns_GenText"];
	var argv = ShowTxtTourism.arguments;
	var argc = argv.length;
	
	//First hide all
	for (i=0; i<IDArray.length; i++)
		{
		txtID = document.getElementById(IDArray[i]);
		txtID.style.display="none";
		};
		
	for (i = 0; i < argc; i++) 
		{
		txtID = document.getElementById(argv[i]);
		txtID.style.display="block";
		};
	
	setTimeout("setHeights()",20);
}

function ExpandMenuItem() 
{
	var argv = ExpandMenuItem.arguments;
	var argc = argv.length;
	for (i = 0; i < argc; i++) 
		{
		row2Show = document.getElementById(argv[i]);
		if (row2Show.style.display=="") 
			{
			row2Show.style.display="none";
			}
		else
			{	
			row2Show.style.display="";
			};
		};
}

var tallest;
function setHeights(){
	
	if(document.getElementById("content")){
		var c = document.getElementById("content");
		var mcw = document.getElementById("main-content-wrap");
		var mcwh = document.getElementById("main-content-wrap-home");
		var sc = document.getElementById("sub-nav");
		var sch = document.getElementById("sub-nav-home");
		var divs = c.getElementsByTagName("div");
				
		tallest = 0;
		for(var x=0; x<divs.length; x++){
			divs[x].style.height = "";
			if(divs[x].offsetHeight > tallest){ tallest = divs[x].offsetHeight; }
		}
		if(mcw){ mcw.style.minHeight = eval(tallest)+"px";  }
		else   { mcwh.style.minHeight = eval(tallest)+"px"; }
		
		if(sc) { sc.style.minHeight = eval(tallest)+"px";  }
		else   { sch.style.minHeight = eval(tallest)+"px"; }	
	}
}

function init(){ setTimeout("setHeights()",20); }
window.onload = init;
