/* TEMPORARY short-country-url fix */
var curYear = new Date();
curYear = curYear.getYear();

 if (document.location.pathname.indexOf('/pressroomebo') == 0) {
  document.location.replace('/render.do?country=uk&type=press&doc=press.xml&year='+curYear)
 } 
 else if (document.location.pathname.indexOf('/pressroomau') == 0) {
  document.location.replace('/render.do?country=australia&type=press&doc=press.xml&year='+curYear)
 }
 else if (document.location.pathname.indexOf('/pressroom') == 0) {
  document.location.replace('/render.do?country=global&type=article&doc=gblpress&year='+curYear)
 }
 else if (document.location.pathname.indexOf('/au') == 0) {
  document.location.replace('/render.do?country=australia&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/be') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/br') == 0) {
  document.location.replace('/render.do')
 }
 else if (document.location.pathname.indexOf('/ebo') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/fr') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/de') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/it') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/ls') == 0) {
  document.location.replace('/render.do?country=life&type=home&doc=defaultls')
 }
 else if (document.location.pathname.indexOf('/nl') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/nordic') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/sp') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/uk') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/benelux') == 0) {
  document.location.replace('/render.do?country=uk&type=home&doc=default')
 }
 else if (document.location.pathname.indexOf('/participaties') == 0) {
  document.location.replace('/render.do?country=it&type=article&doc=home')
 }

function GotoAnchor(formObj)
{
	AnchorID = "#"+formObj[0].options[formObj[0].options.selectedIndex].value
	document.location.href = AnchorID
}
function SetPageTitle(MenuLevel1, MenuLevel2, MenuLevel3)
{
	document.getElementById("titleCell").innerHTML = MenuLevel1
	if (MenuLevel2 != "")
	{
		document.getElementById("titleCell").innerHTML = MenuLevel1 + " : " + MenuLevel2
	}
}
function DetermineXRes() {
 var ResolutionWidth = window.screen.availWidth
 ResolutionWidth = parseInt(ResolutionWidth)
 return ResolutionWidth;
}
function DetermineYRes() {
 var ResolutionHeight = window.screen.availHeight
 ResolutionHeight = parseInt(ResolutionHeight)
 return ResolutionHeight;
}
function setCssTag(styleResources) {
var cssTag =''
 appVersionArray= window.navigator.appVersion.split(" ")
 appVersion=parseFloat(appVersionArray[0])
 var cssTag = "<link rel='stylesheet' type='text/css' href='"+styleResources+"aabc";
 if (navigator.platform.indexOf("Mac")!=-1 && navigator.appName=="Netscape") {
  if (appVersion == 5) {
   cssTag += ".css' />"
  }
  if (appVersion < 5) {
   cssTag += "nn.css' />"
  }
 }
 else if (navigator.platform.indexOf("Mac")!=-1 && navigator.appName=="Microsoft Internet Explorer") {
  cssTag += ".css' />"
 }
 else if (navigator.appName=="Netscape" && navigator.platform=="Win32") {
  if (appVersion == 5) {
   cssTag += ".css' />"
  }
  if (appVersion < 5) {
   cssTag += "nn.css' />"
  }
 }
 else if (navigator.appName=="Microsoft Internet Explorer" && navigator.platform=="Win32") {
  cssTag += ".css' />"
 }
 else {
  cssTag += ".css' />"
 }
 document.write(cssTag)
}
//------------------------------------------------------------------
function activeMenuOption(imageResources, itemNumber) {
 if (document.images) {
  eval("(document.images['item"+itemNumber+"'].src='"+imageResources+"white_selection_marker.gif')");
 } 
 else {
  eval("(document.item"+itemNumber+".src='"+imageResources+"white_selection_marker.gif')");
 }
}
//------------------------------------------------------------------
function inactiveMenuOption(imageResources, itemNumber) {
  if (document.images) {
    eval("(document.images['item"+itemNumber+"'].src='"+imageResources+"blank.gif')");
  }
  else {
    eval("(document.item"+itemNumber+".src='"+imageResources+"blank.gif')");
  }
}
function PopWindow (Path , WindowName ,Toolbar, Scrollbars , Width, Height, Type) {
 LeftPos=DetermineXRes()
 LeftPos = Math.round(LeftPos/2)-(Width/2)
 TopPos=DetermineYRes()
 TopPos = Math.round(TopPos/2)-(Height/2)
 WindowName = window.open (Path ,WindowName,'toolbar='+Toolbar +',location=no,directories=no,status=no,menubar=no,scrollbars=' + Scrollbars+',width='+ Width+',height='+ Height+',left='+LeftPos+',top='+TopPos)
}
function rollOn(image) {
 theImage = document.images[image].src;
 document.images[image].src = theImage.replace(/Off/g,"On"); 
}
function rollOff(image) {
 theImage = document.images[image].src;
 document.images[image].src = theImage.replace(/On/g,"Off");
}
//------------------------------------------------
function sizerImg() {
if (headerPresent)
{
	//headerHeight = 123
	//new number to cater for the darn disclaimer copy
	headerHeight = 183
}
else
{
	headerHeight = 137
}

 if (document.all) {
  theHeight = document.body.clientHeight - headerHeight;
 }
 else if (document.getElementById || navigator.userAgent.indexOf('Opera')) {
  theHeight = innerHeight - headerHeight;
 }
 else if (document.layers) {
  theHeight = window.innerHeight - headerHeight;
 }
 if (sizerImg.arguments[0]) theHeight = theHeight - sizerImg.arguments[0]
 if (document.images["spacerImg"])
 {
 document.images["spacerImg"].height = theHeight
 }

}

//------------------------------------------------
function goURL(dropdown) {
 theLink = dropdown.options[dropdown.selectedIndex].value
 if (theLink.indexOf('http') > -1) {
  window.open(theLink,'newWindow')
 }
 dropdown.selectedIndex = 0
}
function CheckAllLinks()
{
if (document.layers)
{
	for(i=0; i< document.links.length;i++)
	{
	 document.links[i].href = document.links[i].href.replace(/ /g, "%20")
	 //alert(document.links[i].href)
	}
}
}
function Glossary (Path) {
 LeftPos=DetermineXRes()
 LeftPos = Math.round(LeftPos/2)-(207)
 TopPos=DetermineYRes()
 TopPos = Math.round(TopPos/2)-(264)
	
 if (document.all) {
  GlossaryWindow=window.open(Path,'GlossaryWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=	no,resizable=no,width=415,height=527,left=100,top=100')
 }
 if (!document.all) {
  GlossaryWindow=window.open(Path,'GlossaryWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=430,height=527,left=100,top=100')
 }
}
function MarkLetter(ID,imagePath)
{
	if (document.all)
	{
		document.all[ID].background=imagePath+"Letter_Box.gif"
	}
	
	if (!document.all)
	{
		
	}
}
function UnMarkLetter(ID,imagePath)
{
	if (document.all)
	{
		document.all[ID].background=imagePath+"blank.gif"
	}
	
	if (document.layers)
	{
	}
}
//------------------------------------------------------------------
function ActiveEntryPoints(LayerOne,LayerTwo)
{
	var MenuState="Open"
	if (document.all)
	{
		LayerObjOne = document.all[LayerOne]
		LayerObjTwo = document.all[LayerTwo]
		LayerObjOne.style.clip="rect(0,157,350,0)"
		LayerObjTwo.style.clip="rect(0,157,350,0)"
	}
	
	else if (document.getElementById)
	{
		LayerObjOne = document.getElementById(LayerOne)
		LayerObjTwo = document.getElementById(LayerTwo)
		LayerObjOne.style.clip="rect(0,157,350,0)"
		LayerObjTwo.style.clip="rect(0,157,350,0)"
	}
		
	else if (document.layers)
	{
		LayerObjOne = document.layers[LayerOne]
		LayerObjTwo = document.layers[LayerTwo]
		LayerObjOne.clip.height=270;
		LayerObjTwo.clip.height=270;
	}
}
//------------------------------------------------------------------
function BlurEntryPoints(LayerOne,LayerTwo)
{
	var MenuState="Closed"
	if (document.all)
	{
		LayerObjOne = document.all[LayerOne]
		LayerObjTwo = document.all[LayerTwo]
		LayerObjOne.style.clip="rect(0,157,26,0)"
		LayerObjTwo.style.clip="rect(0,157,26,0)"
	}
	
	else if (document.getElementById)
	{
		LayerObjOne = document.getElementById(LayerOne)
		LayerObjTwo = document.getElementById(LayerTwo)
		LayerObjOne.style.clip="rect(0,157,26,0)"
		LayerObjTwo.style.clip="rect(0,157,26,0)"
	}
	
	else if (document.layers)
	{
		LayerObjOne = document.layers[LayerOne]
		LayerObjTwo = document.layers[LayerTwo]
		LayerObjOne.clip.height=26;
		LayerObjTwo.clip.height=26;
	}
	
}
//------------------------------------------------------------------satnam


function ActiveEntryPointsC(LayerOne,LayerTwo)
{
	var MenuState="Open"
	if (document.all)
	{
		LayerObjOne = document.all[LayerOne]
		LayerObjTwo = document.all[LayerTwo]
		LayerObjOne.style.clip="rect(0,90,350,0)"
		LayerObjTwo.style.clip="rect(0,90,350,0)"
	}
	
	else if (document.getElementById)
	{
		LayerObjOne = document.getElementById(LayerOne)
		LayerObjTwo = document.getElementById(LayerTwo)
		LayerObjOne.style.clip="rect(0,90,350,0)"
		LayerObjTwo.style.clip="rect(0,90,350,0)"
	}
		
	else if (document.layers)
	{
		LayerObjOne = document.layers[LayerOne]
		LayerObjTwo = document.layers[LayerTwo]
		LayerObjOne.clip.height=270;
		LayerObjTwo.clip.height=270;
	}
}
//------------------------------------------------------------------
function BlurEntryPointsC(LayerOne,LayerTwo)
{
	var MenuState="Closed"
	if (document.all)
	{
		LayerObjOne = document.all[LayerOne]
		LayerObjTwo = document.all[LayerTwo]
		LayerObjOne.style.clip="rect(0,90,26,0)"
		LayerObjTwo.style.clip="rect(0,90,26,0)"
	}
	
	else if (document.getElementById)
	{
		LayerObjOne = document.getElementById(LayerOne)
		LayerObjTwo = document.getElementById(LayerTwo)
		LayerObjOne.style.clip="rect(0,90,26,0)"
		LayerObjTwo.style.clip="rect(0,90,26,0)"
	}
	
	else if (document.layers)
	{
		LayerObjOne = document.layers[LayerOne]
		LayerObjTwo = document.layers[LayerTwo]
		LayerObjOne.clip.height=26;
		LayerObjTwo.clip.height=26;
	}
	
}
//------------------------------------------------------------------satnam

function SetUrlFromSel(formObj)
{
	
	URL = formObj[0].options[formObj[0].options.selectedIndex].value
	if (URL!='')
	{
		if (URL.search(/http:/)!=-1)
		{
			window.open(URL)
		}
		
		else
		{
    		document.location.href=URL
		}
	}
}
function topMenuOver(ObjRow)
{
	ObjRow.style.backgroundColor="#7EA8B7"
}
function topMenuOut(ObjRow)
{
	ObjRow.style.backgroundColor="#4C8497"
}

function investSearch(formObj, queryString)
{
	searchURL = "/render.do?country="+getQueryValue("country")+"&type=invest_search&doc=investments.xml"
	if (formObj.x.value != "")
	{
		searchURL  += "&amp;x=1";
	}
	if (formObj.year.options[formObj.year.options.selectedIndex].value != "")
	{
		searchURL  += "&year="+formObj.year.options[formObj.year.options.selectedIndex].value
	}

	if (formObj.dDYear.options[formObj.dDYear.options.selectedIndex].value != "")
	{
		searchURL  += "&dDYear="+formObj.dDYear.options[formObj.dDYear.options.selectedIndex].value
	}
	alert(searchURL)
	document.location.href= searchURL
}


function pressSearch(formObj, queryString)
{
	
	searchURL = "/render.do?country="+getQueryValue("country")+"&type=press&doc=press.xml"
	

	if (formObj.x.value != "")
	{
		searchURL  += "&amp;x=1";
	}
	if (formObj.year.options[formObj.year.options.selectedIndex].value != "")
	{
		searchURL  += "&amp;year="+formObj.year.options[formObj.year.options.selectedIndex].value
	}
	document.location.href= searchURL
}

function peopleSearch(formObj, queryString)
{
	
	searchURL = "/render.do?country="+getQueryValue("country")+"&type=people&doc=people.xml"
	
	if (formObj.sector.options[formObj.sector.options.selectedIndex].value != "")
	{
		searchURL  += "&sector="+formObj.sector.options[formObj.sector.options.selectedIndex].value
	}
	
	if (formObj.name.value != "")
	{
		searchURL  += "&name="+formObj.name.value
	}
	
	if (formObj.country.options[formObj.country.options.selectedIndex].value != "")
	{
		searchURL  += "&amp;reg="+formObj.country.options[formObj.country.options.selectedIndex].value
	}
	
	document.location.href= searchURL
}


function changeMap(img, src) {
    document.images[img].src = src
   }


function getQueryValue(name)
{
  
  var sURL = new String(window.location);
  var iQMark= sURL.lastIndexOf('?');
  var iLensName=name.length;
  var iStart = sURL.indexOf('?' + name +'=')
  if (iStart==-1)
        {
        iStart = sURL.indexOf('&' + name +'=')
		if (iStart==-1)
		   {
		    return 0; 
		   }   
        }
        
  iStart = iStart + + iLensName + 2;
  var iTemp= sURL.indexOf('&',iStart);
  if (iTemp ==-1)
		{
		iTemp=sURL.length;
		}  
  return sURL.slice(iStart,iTemp ) ;
  sURL=null;

}
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
function acceptDisclaimer() {
	setCookie("ukdisclaimer",true);
	document.location.href = unescape(getCookie("ukreturnpage")).replace(/&/g,'&amp;');
	return false;
}


function showmeta(varLayer) {
 showLayer(varLayer);
}

function hidemeta(varLayer) {
 hideLayer(varLayer);
}



function hideLayer(whichLayer) {
 if (document.getElementById) {
  document.getElementById(whichLayer).style.visibility = "hidden";
 }
 else if (document.all) {
  document.all[whichlayer].style.visibility = "hidden";
 }
 else if (document.layers) {
  document.layers[whichLayer].visibility = "hidden";
 }
}

function showLayer(whichLayer) {
 if (document.getElementById) {
  document.getElementById(whichLayer).style.visibility = "visible";
 }
 else if (document.all) {
  document.all[whichlayer].style.visibility = "visible";
 }
 else if (document.layers) {
  document.layers[whichLayer].visibility = "visible";
 }
}


 function printMe() {
//			  var bd = document.body;
  var bd = document.body.cloneNode(true)
  var myNodesArray = new Array()
  for (i=0; i<bd.childNodes.length; i++) {
   if (bd.childNodes[i].nodeName.toLowerCase() != 'table') {
    myNodesArray[myNodesArray.length] = bd.childNodes[i];
   }
  }
  for (j=0; j<myNodesArray.length; j++) {
   bd.removeChild(myNodesArray[j])
  }
  mainTable = bd.firstChild;
  mainTable.setAttribute('width', '100%');
  while (mainTable.firstChild.nodeType != 1) {
	  mainTable.removeChild(mainTable.firstChild)
  }
  mainTBody = mainTable.firstChild;
  while (mainTBody.firstChild.nodeType != 1) {
	  mainTBody.removeChild(mainTBody.firstChild)
  }
  mainTBody.removeChild(mainTBody.firstChild)
  while (mainTBody.firstChild.nodeType != 1) {
	  mainTBody.removeChild(mainTBody.firstChild)
  }
  mainTBody.removeChild(mainTBody.firstChild)
  while (mainTBody.firstChild.nodeType != 1) {
	  mainTBody.removeChild(mainTBody.firstChild)
  }
  mainTr = mainTBody.firstChild;
  while (mainTr.firstChild.nodeType != 1) {
	  mainTr.removeChild(mainTr.firstChild)
  }
  mainTr.removeChild(mainTr.firstChild)

  newContainer = document.createElement('div');
  newStyle = document.createElement('link');
  newStyle.setAttribute('href', '/css/print.css');
  newStyle.setAttribute('type', 'text/css');
  newStyle.setAttribute('rel', 'stylesheet');
  newContainer.appendChild(newStyle);

  printLink = document.createElement('a');
  printLink.setAttribute('href', 'javas'+'cript:window.print()');
  printLink.innerHTML = 'Print this page';
  newContainer.appendChild(printLink);

  lineBreak = document.createElement('br');
  newContainer.appendChild(lineBreak);
  newContainer.appendChild(lineBreak);


  newTable = document.createElement('table');
  newTBody = document.createElement('tbody');
  newContainer.appendChild(newTable);
  newTable.appendChild(newTBody);
  newTBody.appendChild(mainTr)
  newWin = window.open('','abc',' status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=650, height=700');
  newWin.document.write(newContainer.innerHTML)
  newWin.document.title = 'ABN AMRO Capital';
  newWin.document.close();
 }
