/* British Land Common JavaScript */

var newWin = null; 
function popUp(strURL, strType, strWidth, strHeight) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="elasticmenu") 
   strOptions="scrollbars,"+ 
     "resizable,width="+ 
     strWidth+",height="+strHeight; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

function WindowPrint(){
	window.print();
}

window.onload = function() {
	currPage = document.location + "";
	var currPage = currPage.substr( currPage.lastIndexOf("/")+1 );

	var arrPages = document.getElementById("BackgroundWrapper").getElementsByTagName("div")[0]; 

	currIndex = ArrayFindIndex(currPage, arrPages);
		
	if(currIndex > 0 && currIndex < arrPages.length){
		objBody = document.getElementById("Content");
		objBody.innerHTML = "<div class=\"pagination\"><a href=\"" + arrPages[currIndex-1] + "\" class=\"prev\">Previous</a><a href=\"" + arrPages[currIndex+1] + "\" class=\"next\">Next</a></div>" + objBody.innerHTML;
	}
/*	
	objSearchField = document.getElementById("searchterm");
	objSearchField.onfocus = function(){ if(this.value == "Search the report") this.value = ""; }
	objSearchField.onblur = function(){ if(this.value == "") this.value = "Search the report"; }
*/

}

function ArrayFindIndex(needle, haystack) {
	for(i=0;i<haystack.length;i++){
		if(haystack[i] == needle){
			return i;
		} 
	}
	return -1;
}

function EmailLink(){
var sPath = window.location.pathname;
var sPage = sPath.substr(sPath.lastIndexOf('/') + 1);
window.location = "mailto:"+"?subject=British Land PLC Annual Report and Accounts 2007" + "&body=" + "This link might interest you: http://www.britishland.com/FinancialReports/yearend2007/"+sPage;
}

