document.getEleByClass = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};

function insertAfter(parent, node, referenceNode) {
	parent.insertBefore(node, referenceNode.nextSibling);
}


function setCookie( name, value, expires, path, domain, secure ) {

	var today = new Date();

	today.setTime( today.getTime() );

	if ( expires ) {

		expires = expires * 1000 * 60 * 60 * 24;

	}

	var expires_date = new Date( today.getTime() + (expires) );

	//document.cookie = name+'='+escape( value ) +
	
	document.cookie = name+'='+value+

		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()

		( ( path ) ? ';path=' + path : '' ) +

		( ( domain ) ? ';domain=' + domain : '' ) +

		( ( secure ) ? ';secure' : '' );

}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return null;
}

function deleteCookie(c_name) {
setCookie(c_name,'',-1,'/global3digital/');
}


function inNewWindowLinks() {
	
	// little hack that allows xhtml strict validation when in need of "_target=blank"
	// just put in the link >
	// 					rel="inNewWindow"
	// instead of >
	// 					target="_blank"
	
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "inNewWindow")
anchor.target = "_blank";
}
}

function getWidth(el)
{
	//console.log(el);
	//var x = document.getElementById(el);
	if (el.currentStyle){
	//alert('ie');
		//var y = x.currentStyle['offsetHeight'];
		var y = el.offsetWidth;
	}
	else if(window.getComputedStyle) {
		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue('width');
	}
	return y;
}

function toptabs(){
var img1 = new Image();
	img1.src = "http://ww1.investorrelations.co.uk/pg/assets/gfx/internaltab/_left_active_purple.gif";
	var img2 = new Image();
	img2.src = "http://ww1.investorrelations.co.uk/pg/assets/gfx/internaltab/_left_inactive_purple.gif";
	var img3 = new Image();
	img3.src = "http://ww1.investorrelations.co.uk/pg/assets/gfx/internaltab/_right_active_purple.gif";
	var img4 = new Image();
	img4.src = "http://ww1.investorrelations.co.uk/pg/assets/gfx/internaltab/_right_inactive_purple.gif";
	var obj = document.getElementById('toptabsrow');
	var counter = 0;
	for(var i=0; i<obj.childNodes.length;i++)
	{
		if(!is_ignorable(obj.childNodes[i])){
		
		obj.childNodes[i].id = 'jj'+counter;
		
		counter++;
		
		//console.log(obj.childNodes[i]);
	if(obj.childNodes[i].tagName.toLowerCase()=='li'){
		obj.childNodes[i].onmouseover = function(){
			this.className = 'active';
			}
		obj.childNodes[i].onmouseout = function(){
			if(this.id!=('jj'+activetoptab)){

			this.className = '';
			}
			}
		
		obj.childNodes[i].onclick = function(){
			
			for(var i=0; i<obj.childNodes.length;i++)
				{
		if(!is_ignorable(obj.childNodes[i]))
		{
			if(obj.childNodes[i].tagName.toLowerCase()=='li'){
				obj.childNodes[i].className = '';
			}
		}
		}
			
			
			
			this.className = 'active';
			window.activetoptab = parseInt(this.id.substr(2));
			
		myTabs.activate(document.getElementById(window.activebottomtab));
			
			}
			
		}	
	
		}
	
	}
	
	}

function hrDecoration(){
	var hrs = $ES('hr');
	for(var y = 0; y < hrs.length; y++){
		var newdiv=document.createElement("div");
		newdiv.className = "divider";
		hrs[y].parentNode.insertBefore(newdiv,hrs[y]);
		hrs[y].style.visibility = 'hidden';
		hrs[y].style.display = 'none';
		}
	}


function h2decoration(){
	
	// create the decorations of the titles, based on the classes names
	//var myh2 = document.getEleByClass('purple').concat(document.getEleByClass('neutral'));
	var myh2 = $$('h2.purple').concat($$('h2.neutral'));
	var clarray = new Array();
	var rounds = 0;
	for (var i=0;i<myh2.length;i++)
	{
		// create a new span for the left corner and the image for the left corner
		
		
		var span1 = document.createElement("span");
		var newdiv=document.createElement("img");
		
		/*rounds++;
		console.log(myh2.length + ' is length');
		console.log(myh2[i].className + ' is classname');
		console.log(rounds) + ' is rounds'; */
		
		
		if((myh2[i].parentNode.className == 'gray')||(myh2[i].parentNode.className == 'grayrounded'))
		{	
		
			if(String(myh2[i].className).indexOf('purple')>-1){
			newdiv.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/_left-grey.gif';
			}
			if(String(myh2[i].className).indexOf('neutral')>-1){
			newdiv.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/_left-neutral-grey.gif';
			}
		}
		else 
		{
			
			if(String(myh2[i].className).indexOf('purple')>-1){
			newdiv.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/_left.gif';
			}
			if(String(myh2[i].className).indexOf('neutral')>-1){
			newdiv.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/_left-neutral.gif';
			}
			
		}
		span1.appendChild(newdiv);
					
		myh2[i].insertBefore(span1, myh2[i].firstChild);
		
		if(document.all)
		{
		myh2[i].firstChild.style.styleFloat = 'left';
		} 
		else 
		{
		myh2[i].firstChild.style.cssFloat = 'left';
		}
		myh2[i].firstChild.style.marginTop = '-12px';
		myh2[i].firstChild.style.clear = 'none';
		
		
		var span2 = document.createElement("span");
		var newdiv2=document.createElement("img");
				
		clarray = myh2[i].className.split(' ');
		
		if(clarray.length == 1)
		{
		// no additional classes
			if((myh2[i].parentNode.className == 'gray')||(myh2[i].parentNode.className == 'grayrounded'))
			{
				if(String(myh2[i].className).indexOf('purple')>-1){
				newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/fetta-grey.gif';
				}
				if(String(myh2[i].className).indexOf('neutral')>-1){
				newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/fetta-neutral-grey.gif';
				}
			}
			else
			{
				if(String(myh2[i].className).indexOf('purple')>-1){
				newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/fetta.gif';
				}
				if(String(myh2[i].className).indexOf('neutral')>-1){
				newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/fetta-neutral.gif';
				}
				
			}
		
		}
		else
		{
			//if(String(myh2[i].className).indexOf('purple')>-1){
			newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/uploads/navigation/titleicons/'+clarray[1]+'.gif';
			//}
			//if(String(myh2[i].className).indexOf('neutral')>-1){
			//newdiv2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/titles/'+clarray[1]+'-neutral.gif';
			//}
		
		}
		
		span2.appendChild(newdiv2);
		
		insertAfter(myh2[i], span2, myh2[i].lastChild);
		
		if(document.all)
		{
		myh2[i].lastChild.style.styleFloat = 'right';
		} 
		else 
		{
		myh2[i].lastChild.style.cssFloat = 'right';
		}
		
		myh2[i].lastChild.style.clear = 'none';		
		myh2[i].lastChild.style.marginTop = '-12px';
		


		}
		
	}
/* -------------------------------------------------------------------------- */	
function is_all_ws( nod )
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}	

function is_ignorable( nod )
{
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

function first_child( par )
{
  var res=par.firstChild;
  while (res) {
    if (!is_ignorable(res)) return res;
    res = res.nextSibling;
  }
  return null;
}
function next_li( par )
{
  var res=par.nextSibling;
  while (res) {
    if (!is_ignorable(res)) {
		if(res.tagName=='LI'){
		return res
		}
		};
    res = res.nextSibling;
  }
  return null;
}
function previous_li( par )
{
  var res=par.previousSibling;
  while (res) {
    if (!is_ignorable(res)) {
		if(res.tagName=='LI'){
		return res
		}
		};
    res = res.previousSibling;
  }
  return null;
}
/* -------------------------------------------------------------------------- */	
function beNiceToOpera(){
	if(window.opera){
		document.getElementById('mainpic').style.marginTop = '16px';
		document.getElementById('sharepricearea').style.marginTop = '14px';
		}
	}
	
function selectallfunc(){
	if(document.getElementById('selectall')){
		if(document.getElementById('investorpack')){
			var i = document.getElementById('selectall');
			i.onclick = function(){
			var ckb = $ES('input[type=checkbox]', 'investorpack');
				for(var e = 0; e<ckb.length; e++){
					ckb[e].checked = true;		
					}
				}
			if(document.getElementById('deselectall')){
			var u = document.getElementById('deselectall');
			u.onclick = function(){
				var ckb = $ES('input[type=checkbox]', 'investorpack');
				for(var e = 0; e<ckb.length; e++){
				ckb[e].checked = false;
				}
				}
			}
			}
		}
	}	
	
function stylesearch() {
	//alert('function called');
	var mybox = first_child(first_child(document.getElementById('searchbox')));
	//alert(mybox);
	//for(a in mybox.childNodes){
		for(var a=0;a<mybox.childNodes.length;a++){
			//alert(mybox.childNodes[a]);
			switch(String(mybox.childNodes[a].tagName).toLowerCase()){
				case 'button':
					// hide the text on the button
					mybox.childNodes[a].style.borderStyle = 'none';
					mybox.childNodes[a].removeChild(mybox.childNodes[a].firstChild);
					
					// set the background
					mybox.childNodes[a].style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/search.gif)";
					mybox.childNodes[a].style.height = '24px';
					mybox.childNodes[a].style.width = '24px';
					mybox.childNodes[a].style.marginBottom = '-6px';
				break;
				case 'input':
					mybox.childNodes[a].value = 'Search';
				break;
				case 'label':
					// make the label invisible
					mybox.childNodes[a].style.display = 'none';
					mybox.childNodes[a].style.visibility = 'hidden';
				break; 
				default:
				break;
				}
		}
	}	
	

	
function callthetabs(){
	var io = document.getElementById('navx');
var i1 = new Image;
i1.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-normal-nextoactive.gif';
var i2 = new Image;
i2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal-nextoactive.gif';
var i3 = new Image;
i3.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active.gif';
var i4 = new Image;
i4.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_leftleft-active.gif';
var i5 = new Image;
i5.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active.gif';
var i6 = new Image;
i6.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_rightright-active.gif';
var i7 = new Image;
i7.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal.gif';
var i8 = new Image;
i8.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-normal.gif';
var i9 = new Image;
i9.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_leftleft-normal.gif';
var i10 = new Image;
i10.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_rightright-normal.gif';
var i11 = new Image;
i11.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active-nextoactive.gif';
var i12 = new Image;
i12.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active-nextoactive.gif';

	for(var a=0;a<io.childNodes.length;a++){
			if((String(io.childNodes[a].tagName).toLowerCase()=='li')&&(io.childNodes[a].firstChild.className!='active')){
				
function hop (){
	if(next_li(this.parentNode.parentNode)){
	var rightisactive = next_li(this.parentNode.parentNode).firstChild.className=='active'?true:false;
	}
	else
	{
	var rightisactive = false;	
	}

	if(previous_li(this.parentNode.parentNode))
	{
	var leftisactive = previous_li(this.parentNode.parentNode).firstChild.className=='active'?true:false;
	}
	else
	{
	var leftisactive = false;	
	}

	
						if(next_li(this.parentNode.parentNode))
							{
							// not the last, so adapt the following
next_li(this.parentNode.parentNode).firstChild.style.backgroundImage = rightisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active-nextoactive.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-normal-nextoactive.gif)"							
							}	
							
						if(previous_li(this.parentNode.parentNode))
							{
								// not the first, so adapt the previous
							previous_li(this.parentNode.parentNode).firstChild.firstChild.style.backgroundImage = leftisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active-nextoactive.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal-nextoactive.gif)";
							}
							
							if(this.parentNode.parentNode.className!='first')
							{
							// if I'm not the first
							this.parentNode.parentNode.firstChild.style.backgroundImage = leftisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active-nextoactive.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active.gif)";
							}
							else
							{
							// If I'm the first
							this.parentNode.parentNode.firstChild.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_leftleft-active.gif)";
							}
							
							if(this.parentNode.parentNode.className!='last')
							{
							// if I'm not the last
							this.parentNode.parentNode.firstChild.firstChild.style.backgroundImage = rightisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active-nextoactive.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active.gif)";
							}
							else
							{
								// if I'm the last
							this.parentNode.parentNode.firstChild.firstChild.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_rightright-active.gif)";
							}
					
					this.parentNode.style.color = '#710D69';					
					this.parentNode.style.fontWeight = 'bold';
					
					}
					
function downn(){
	
	if(next_li(this.parentNode.parentNode)){
	var rightisactive = next_li(this.parentNode.parentNode).firstChild.className=='active'?true:false;
	}
	else
	{
	var rightisactive = false;	
	}

if(previous_li(this.parentNode.parentNode)){
	var leftisactive = previous_li(this.parentNode.parentNode).firstChild.className=='active'?true:false;
} else {
	var leftisactive = false;
	}

	
					if(next_li(this.parentNode.parentNode))
					{
						// not the last, so revert the following
					next_li(this.parentNode.parentNode).firstChild.style.backgroundImage = rightisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-active.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-normal.gif)";
	
					}	
					
					if(previous_li(this.parentNode.parentNode))
					{
						// not the first, so revert the previous
				previous_li(this.parentNode.parentNode).firstChild.firstChild.style.backgroundImage = leftisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-active.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal.gif)";	
					}
					
					if(this.parentNode.parentNode.className!='first')
					{
					// if I'm not the first
					this.parentNode.parentNode.firstChild.style.backgroundImage = leftisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/uga.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_left-normal.gif)";
					//console.log(this.parentNode.parentNode.firstChild);
					}
					else
					{
					// If I'm the first
					this.parentNode.parentNode.firstChild.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_leftleft-normal.gif)";
					}
					
					if(this.parentNode.parentNode.className!='last')
					{
						// If I'm not the last
					this.parentNode.parentNode.firstChild.firstChild.style.backgroundImage = rightisactive?"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal-nextoactive.gif)":"url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_right-normal.gif)";
					//console.log(this.parentNode.parentNode.firstChild.firstChild.innerHTML);
					//console.log(this.parentNode.parentNode.firstChild.firstChild)
					}
					else
					{
					// If I'm the last
					this.parentNode.parentNode.firstChild.firstChild.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/tabs/_rightright-normal.gif)";
					}	
					
					this.parentNode.style.color = '#222222';					
					this.parentNode.style.fontWeight = 'normal';					
					}	
				
				
				
				io.childNodes[a].firstChild.firstChild.onmouseover = hop;
				io.childNodes[a].firstChild.firstChild.onmouseout = downn;
				}
		}
		
for(var a=0;a<io.childNodes.length;a++){
			if((String(io.childNodes[a].tagName).toLowerCase()=='li')&&(io.childNodes[a].firstChild.className=='active')){
	
io.childNodes[a].firstChild.firstChild.onmouseover = hop;		
var fireOnThis = io.childNodes[a].firstChild.firstChild;
if(document.createEvent) {
  var evObj = document.createEvent('MouseEvents');
  evObj.initEvent( 'mouseover', true, false );
  fireOnThis.dispatchEvent(evObj);
} else if(document.createEventObject) {
var evObj = document.createEventObject();

  fireOnThis.fireEvent('onmouseover', evObj);
}
			
			
			}
}

}	

function openresdiv()
{
if(document.getElementById('resdiv'))
	{
	var myuls = $ES('ul', 'resdiv');
	//console.log(document.getElementById('resdiv'));
	for(var r = 0; r<myuls.length;r++)
		{
			
			if(String(first_child(myuls[r]).tagName).toLowerCase()=='li')
			{
				//console.log(first_child(myuls[r]));
				var obj = first_child(myuls[r]);		
				obj.onclick = function()
					{
					if($E('ul', this).className=='hidden')
					{
						//console.log('open');
						$E('ul', this).className = 'visible';
						this.style.backgroundImage = 'url(http://ww1.investorrelations.co.uk/pg/assets/gfx/arrowopen.gif)';
					} 
					else 
					{
						$E('ul', this).className = 'hidden';
						this.style.backgroundImage = 'url(http://ww1.investorrelations.co.uk/pg/assets/gfx/arrowclose.gif)';
					}
				}
			}
		}
	}
}

function brandsHover(){
	var img1 = new Image();
	img1.src = "http://ww1.investorrelations.co.uk/pg/assets/gfx/borders/bgbrandstab_hover.gif";
	var img2 = new Image();
	img2.src = 'http://ww1.investorrelations.co.uk/pg/assets/gfx/borders/bgbrandstab.gif';
	var io = document.getElementById('brands');
		for(var a=0;a<io.childNodes.length;a++){
			if(String(io.childNodes[a].tagName).toLowerCase()=='li'){
				io.childNodes[a].firstChild.firstChild.onmouseover = function (){
					this.parentNode.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/borders/bgbrandstab_hover.gif)";
					//this.parentNode.style.backgroundImage = 'none';
					//this.parentNode.style.backgroundColor = '#ff00ff';
					if(!document.all){
					this.parentNode.style.height = '35px';
					}
					else
					{
					this.parentNode.style.height = '35px';
					
					}
					this.parentNode.style.marginTop = '-6px';
					}
				io.childNodes[a].firstChild.firstChild.onmouseout = function (){
					this.parentNode.style.backgroundImage = "url(http://ww1.investorrelations.co.uk/pg/assets/gfx/borders/bgbrandstab.gif)";
					if(!document.all)
					{
					this.parentNode.style.height = '29px';
					}
					else
					{
					this.parentNode.style.height = '29px';
					
					}
					this.parentNode.style.marginTop = '0px';
					}
				}
				}
	}

window.onload = function(){
	h2decoration();
	stylesearch();
	beNiceToOpera();
	callthetabs();
	brandsHover();
	hrDecoration();
	openresdiv();
	inNewWindowLinks();
	selectallfunc();
	}