var hideMenuEvent;
var displayMenu="";

/*

if(document.images)
{
	
	var invreportson = new Image();
	invreportson.src = "http://www.savills.co.uk/images/investor_relations/reports_ro.gif";
	var invreportsoff = new Image();
	invreportsoff.src = "http://www.savills.co.uk/images/investor_relations/reports.gif";
	var invfinancialon = new Image();
	invfinancialon.src = "http://www.savills.co.uk/images/investor_relations/financial_ro.gif";
	var invfinancialoff = new Image();
	invfinancialoff.src = "http://www.savills.co.uk/images/investor_relations/financial.gif";
	var invshareon = new Image();
	invshareon.src = "http://www.savills.co.uk/images/investor_relations/financial_summary_ro.gif";
	var invshareoff = new Image();
	invshareoff.src = "http://www.savills.co.uk/images/investor_relations/financial_summary.gif";
	
	var arrow0on = arrow1on = arrow2on = arrow3on = arrow4on = arrow5on = new Image();
	arrow1on.src = "/images/spacer.gif";
	var arrow0off = arrow1off = arrow2off = arrow3off = arrow4off = arrow5off = new Image();
	arrow0off.src = "/images/spacer.gif";
	
	
	//var hubarrow0on = hubarrow1on = hubarrow2on = hubarrow3on = hubarrow4on = hubarrow5on = hubarrow6on = hubarrow7on = hubarrow8on = hubarrow9on = hubarrow10on = hubarrow11on = new Image();
	var hubarrow0on = hubarrow1on = hubarrow2on = new Image();
	
	hubarrow0on.src = hubarrow1on.src = hubarrow2on.src = imgAppUrl + "/images/furniture/arrow_g_on.gif";
	
	var hubarrow0off = hubarrow1off = hubarrow2off = new Image();
	
	hubarrow0off.src = hubarrow1off.src = hubarrow2off.src = imgAppUrl + "/images/spacer.gif";
	
	/*
	var titlearrow0on = titlearrow1on = titlearrow2on = titlearrow3on = titlearrow4on = titlearrow5on = titlearrow6on = titlearrow7on = titlearrow8on = new Image
	var titlearrow0off = titlearrow1off = titlearrow2off = titlearrow3off = titlearrow4off = titlearrow5off = titlearrow6off = titlearrow7off = titlearrow8off = new Image
	
	titlearrow0on.src = titlearrow1on.src = titlearrow2on.src = titlearrow3on.src = titlearrow4on.src = titlearrow5on.src = titlearrow6on.src = titlearrow7on.src = titlearrow8on.src = "/images/furniture/arrow_hubtitle_w_on.gif"
	titlearrow0off.src = titlearrow1off.src = titlearrow2off.src = titlearrow3off.src = titlearrow4off.src = titlearrow5off.src = titlearrow6off.src = titlearrow7off.src = titlearrow8off.src = "/images/spacer.gif"
	
}
*/

// functions duplicated in sharePriceTable.xsl

function twentyFourHourToTwelveHour(iHour){

	iHour = parseInt(iHour)
	
	if (iHour > 12)
		return iHour - 12
	else
		return iHour

}

function twentyFourHourToAMPM(iHour){

	iHour = parseInt(iHour)
	
	if (iHour > 11)
		return "pm"
	else
		return "am"
}

function getTime(){
	var d, s
	var c = ":";
	d = new Date();
	s = twentyFourHourToTwelveHour(d.getHours()) + c;
	s += twoFigs(d.getMinutes()) + c;
	s += twoFigs(d.getSeconds());
   s += " "
   s += twentyFourHourToAMPM(d.getHours())
   
   return s

}

function twoFigs(sString){
	var sOutStr
	sOutStr = "00" + sString
	return sOutStr.substr(sOutStr.length - 2)

}

// end functions duplicated in sharePriceTable.xsl


function shareGraph(){
	openWin("http://www.hemscott.com/scripts/irgraph.dll/show?epic=SVS&p=4&FTSE=true&SECT=true&TMPL=sp01864.htm", "shareGraph",700)

}

//show n hide layers

var secNavCopyReady=false;

function showContent(divnum)
	{

		if(secNavCopyReady){
	
			if(document.layers)
				{
				eval("document.pop" + divnum + "Div.visibility = 'visible'")
				}
			else if(document.all)
				{
				eval("pop" + divnum + "Div.style.visibility = 'visible'")
				}	
			else
				{
				eval("document.getElementById('pop" + divnum +"Div').style.visibility = 'visible'")
				}			
			
		}
		
	}	
	
	function hideAll(){
	
			if(secNavCopyReady) hideOtherContent(96,97,98)
	}
	
	function hideOtherContent()
	{
		if(secNavCopyReady){
			for(i=0;i<hideOtherContent.arguments.length;i++){
			
				var divnum=hideOtherContent.arguments[i]
				
				if(document.layers)
					{
					eval("document.pop" + divnum + "Div.visibility = 'hidden'")	
					}
				else if(document.all)
					{
					eval("pop" + divnum + "Div.style.visibility = 'hidden'")
					}
				else
					{
					eval("document.getElementById('pop" + divnum + "Div').style.visibility = 'hidden'")
					}			
			
			}
		}
	}	
	
	
	
	
function imgOn(imgName) {
		
   document[imgName].src = imgAppUrl + "Images/furniture/arrow_g_on.gif";
        
}

function imgOff(imgName) {
		
   document[imgName].src = imgAppUrl + "Images/spacer.gif";
}

function titleImgOn(imgName) {
		
   document[imgName].src = imgAppUrl + "Images/furniture/arrow_hubtitle_w_on.gif";
        
}

function titleImgOff(imgName) {
		
   document[imgName].src = imgAppUrl + "Images/spacer.gif";
}

function openPrinterFriendly(id)
{
	window.open('PrintContent.aspx?id=' + id)
}

function showDropDown(id) {
	getObj(id).style.display="block";
}

function resNav(iPage){
	document.keyWdSrchNav.startatpagenum.value = iPage
	document.keyWdSrchNav.submit()
}

function showDateDropdown(navNo){
	var i=1;
	while (eval("typeof topmenu"+i+"=='object'")){
		var curObj=eval("topmenu"+i)
		if(i==navNo){
			curObj.css.zIndex=6;
			curObj.css.filter="alpha(opacity=100)";
			curObj.inherit();
		}
		else {
			curObj.css.zIndex=5;
			curObj.fadeOut();
		}
		i++;
	}
	/*if (!ie4)
		{*/
			eval('topmenu'+navNo+'.moveTo(curX-25,null,1,10)');
			changeBackground(navNo);			
		//}
	upperdatedetector.inherit();
	lowerdatedetector.inherit();
	rightdatedetector.inherit();
	leftdatedetector.inherit();
}

function hideDateDetector() {
	upperdatedetector.hide();
	lowerdatedetector.hide();
	rightdatedetector.hide();
	leftdatedetector.hide();
	var i=1;
	while ((eval("typeof topmenu"+i+"=='object'"))&&('topmenu'+i+'.css.visibility=="inherit"')){
		eval("topmenu"+i+".fadeOut()");
		i++;
	}
}

function openPrinterFriendly(Name)
{
	window.open('PrintContent.aspx?pageName=' + Name, width=100);
}

function printWindow()
{
	window.print();
}

function showMenu(id)
{
	if (displayMenu!="" && displayMenu!=id) hideMenu(0)
	displayMenu = id;
	var obj = document.getElementById(id);
	obj.getElementsByTagName("ul")[0].style.left="1em"
}

function hideMenu(timeout)
{
	clearTimeout(hideMenuEvent);
	hideMenuEvent=window.setTimeout('document.getElementById("' + displayMenu + '").getElementsByTagName("ul")[0].style.left="-999px"', timeout);
}

function cancelHideMenu()
{
	clearTimeout(hideMenuEvent);
}

// function to open PDF's
function openPdf(url)
{

	var winWidth = 465
	var winHeight = 720
		
	if (screen.width==800||screen.height==600){
		winHeight = 582
		}
	else if (screen.width<=1024||screen.height<=768){
		winHeight = 582
		}			
		
	page= url ;
	newWin = window.open(page,"newWin","width=" + winWidth + ",height=" + winHeight + ",scrollbars=1")
	setTimeout("focusWin(newWin)",20)
}

var newWin
	function focusWin(oWin){
		if (oWin){
			oWin.focus()
		}
	}
