//<SCRIPT>
/*Hide/Show Layer for Navigation
© Jonathan Guthrie (jono@dna.co.nz) + Hamish Couper (hamish@dna.co.nz) 2001, 2002, 2003; DNA Designed Communications Ltd : 
*/
var numlayers = 1;
var menuon;
var timeoutID;
var execme = 'testmenus()';
var timeoutInt = 1000;
var gstrAppDirectory;

function showme(whichlayer,imgName){
	var y = 0;
	var x = 0;
	var obj = eval('$(' + imgName + ')'); // Changed to getelementbyid
	
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
			
	x += obj.offsetLeft;
	y += obj.offsetTop;
//	x += eval('document.'+imgName+'.width');
	y += eval('document.'+imgName+'.height');
// not required as starting at top of image

	hideall();
	setmenuon();	
	var obj =  eval('$(\'m'+whichlayer+'\').style');
	obj.left = x + 'px';
	obj.top = y + 'px';
	obj.width = eval('document.'+imgName+'.width') + 'px';
//	obj.width = document.gap.width + 'px';
	obj.visibility = "visible";
}

function hideall(){	
	for(i = 1; i <= numlayers; i++){
				var obj =  eval('$(\'m'+i+'\').style');
				obj.visibility = "hidden";			
	}
}

function setmenuon(){
	menuon = 'yes';
	timeoutID = window.setInterval(execme,timeoutInt);
}

function testmenus(){
	if(menuon == 'no'){
		hideall();
	}
}

function cleartimetag(){
	menuon = 'no';
}
function AnimationImage(_name, _img1, _img2, _delay, _duration){
	this.name = _name;	
	this.delay = _delay;
	this.duration = _duration;
	this.image1 = new Image(); this.image1.src = _img1;
	this.image2 = new Image(); this.image2.src = _img2;
	this.currImage = 1;
				
}

AnimationImage.prototype.Image = function(){
	return "<img src='"+this.image1.src+"' name='"+this.name+"' style='filter:blendTrans(duration="+this.duration+")' border=0>";
}
AnimationImage.prototype.Image2 = function(){
	return "<img src='"+this.image2.src+"' name='"+this.name+"' style='filter:blendTrans(duration="+this.duration+")' border=0>";
}
AnimationImage.prototype.Play = function(){
	var obj = eval(this.name);
	obj.filters.blendTrans.apply();
				
	if(obj.src == this.image1.src){
		obj.src = this.image2.src;
	} else {
		obj.src = this.image1.src;
	} 
	obj.filters.blendTrans.play();
				
	eval("setTimeout(\"obj"+this.name+".Play()\","+this.delay+");");
}
// Adding a means to change the image source on the fly
AnimationImage.prototype.setImageSource = function(_index,_src){
	if(_index == 1) {
		this.image1.src = _src;
	}else{
		this.image2.src = _src;
	}
}

function toggle(strImg, blState){
	if(blState){
		//textbin.innerHTML = "<img src='../../PME/images/squares/"+strImg+".jpg'>";			
		textbin.innerHTML = "<img src='./images/squares/"+strImg+".jpg'>";				
	} else {
		//textbin.innerHTML = "<img SRC='../../PME/images/squares/square-transparent.gif' WIDTH=75 HEIGHT=75>";				
		textbin.innerHTML = "<img SRC='./images/squares/square-transparent.gif' WIDTH=75 HEIGHT=75>";				
	}
}


//AMPMENU=====================================================================

var isIE=window.navigator.userAgent.toLowerCase().indexOf('msie')!=-1;
var isMAC=window.navigator.platform.toLowerCase().indexOf('mac')!=-1;
var activeButton=null;

function buttonMouseover(event,menuId){
	var button;
	
	if(window&&window.event&&window.event.srcElement)
		button=window.event.srcElement;
	else if(event&&event.currentTarget)
		button=event.currentTarget;
	else 
		return true;
		
	if(button==null)
		return true;
	if(button.blur)
		button.blur();
		
	button=getContainerWith(button,"DIV","menuButton");
		
	if(button==activeButton)
		return true;
		
	if(button.menu==null){
		if(document.getElementById){
			button.menu=document.getElementById(menuId);
		} else { 
			button.menu=getElementById(menuId);
		}
		if(button.menu)	
			menuInit(button.menu);
	}
	
	if(button.onmouseout==null)
		button.onmouseout=ButtonOrMenuMouseout;
	
	if(activeButton!=null)
		resetButton(activeButton);
	
	if(button!=activeButton){
		depressButton(button);
		activeButton=button;
	} else 
		activeButton=null;
	
	return false;
}
	
function depressButton(button){
	var x,y;
	button.className=button.className.replace("menuButton","menuButtonActive");
	
	if(button.menu){
		x=getPageOffsetLeft(button)+button.offsetWidth-2;
		y=getPageOffsetTop(button);
		
		if(isIE){
			x+=button.offsetParent.clientLeft;
			y+=button.offsetParent.clientTop-2;
			if(isMAC){x-=18;}
		}
		
		button.menu.style.left=x+"px";
		button.menu.style.top=y+"px";
		button.menu.style.visibility="visible";
		
	}
}

function resetButton(button){
	button.className=button.className.replace("menuButtonActive","menuButton");
	
	if(button.menu!=null){
		button.menu.style.visibility="hidden";
	}
}

function menuInit(menu){
	if(menu.onmouseout==null)
		menu.onmouseout=ButtonOrMenuMouseout;
		
	if(isIE){
		if(menu.offsetWidth>500){
			var itemList;
			var i,w,max=0;
			itemList=menu.all.tags("DIV");
			for(i=0;i<itemList.length;i++){
				w=itemList[i].children[0].offsetWidth;
				if(max<w)max=w;
			}
			max+=16;
			menu.style.width=max+"px";
		}
		menu.children[0].style.width=menu.offsetWidth;
	}
	
	menu.initialized=true;
}

var activeItem=null;

function itemMouseover(event){
	var item;
	if(window&&window.event&&window.event.srcElement)
		item=window.event.srcElement;
	else if(event&&event.currentTarget)
		item=event.currentTarget;
	else 
		return true;
	
	if(item==null)
		return true;
	
	if(item.blur)item.blur();
		item=getContainerWith(item,"DIV","menuItem");
	
	if(item==activeItem)
		return true;
		
	if(item.onmouseout==null)
		item.onmouseout=ButtonOrMenuMouseout;
	
	if(activeItem!=null)
		resetItem(activeItem);
	
	if(item!=activeItem){
		depressItem(item);
		activeItem=item;
	} else 
		activeItem=null;

	return false;
}
	
function depressItem(item){
	item.className=item.className.replace("menuItem","menuItemActive");
}

function resetItem(item){
	item.className=item.className.replace("menuItemActive","menuItem");
}

function ButtonOrMenuMouseout(event){
	var el;
	
	if(activeButton==null)
		return;
	
	if(isIE)
		el=window.event.toElement;
	else if(event.relatedTarget!=null)
		el=(event.relatedTarget.tagName?event.relatedTarget:event.relatedTarget.parentNode);
	
	if(getContainerWith(el,"DIV","menu")==null){
		resetButton(activeButton);
		activeButton=null;
		if(activeItem)
			resetItem(activeItem);
		
		activeItem=null;
	}
}

function getContainerWith(node,tagName,className){
	var re;
	re=new RegExp(className,"i");
	while(node!=null){
		if(node.tagName!=null&&node.tagName==tagName&&re.test(node.className))
			return node;
		
		if(node.parentNode){
			node=node.parentNode;
		} else {
			node=node.parentElement;
		}
	}
	return node;
}

function getPageOffsetLeft(el){
	var x;
	x=el.offsetLeft;
	if(el.offsetParent!=null)
		x+=getPageOffsetLeft(el.offsetParent);
	
	return x;
}

function getPageOffsetTop(el){
	var y;
	y=el.offsetTop;
	if(el.offsetParent!=null)
		y+=getPageOffsetTop(el.offsetParent);

	return y;
}
	
function getElementById(menuId){
	return $(menuId);
}


//============================================================== 

function toggleTick(objImg, intMode){
	var el = window.event.srcElement;
	
	if(el.tagName.toLowerCase() == "a" && el.imgID){
		var objImg2 = eval("IMG"+el.imgID);
	
		/*if(objImg.src.indexOf("../../PME/images/tick-lite.gif") !== -1){		
			objImg.src = "../../PME/images/tick-dark.gif";
		} else {
			objImg.src = "../../PME/images/tick-lite.gif";
		}*/
		
		if(objImg2.src.indexOf("images/tick-lite.gif") !== -1){	
			//alert('Set to dark...');	
			if(intMode != null && intMode == 1) {
				objImg2.src = "../images/tick-dark.gif";
			}else{
				objImg2.src = "./images/tick-dark.gif";
			}
		} else {
			//alert('Set to lite...');
			if(intMode != null && intMode == 1) {
				objImg2.src = "../images/tick-lite.gif";
			}else{
				objImg2.src = "./images/tick-lite.gif";
			}
		}
	}
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; 
  	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0){ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// 08/12/2003	mtb This paths will be changed locally by the application page to set it relative
//var objHome = new AnimationImage("Home", "../../PME/images/logo-amphenderson.jpg", "../../PME/images/logo-henderson.jpg", "4000", 2);
var objHome = new AnimationImage("Home", "./images/logo-henderson_med.jpg", "./images/logo-henderson_med.jpg", "4000", 2);	
	
function openImage(strURL,x,y){
	window.open('image-load.asp?IMAGE='+strURL,'image','width='+x+',height='+y+',menubar=no,taskbar=no,toolbar=no,scroll=no');
}

//var arrText = new Array('Organisation','Purpose','Goal','Value Proposition','Brand','Strategy','Template','Visual Identity','Guidelines','Logo','Colour','Typeface','Design Grid','Alignment Device','Imagery','Presentations','Documents','Merchandise','Signage','Banner','PDF','Examples','Downloads');
var arrText = new Array('Commitment','Capital','Flexible','Responsive','Efficient','Strong Management','Demonstrated Success','Multi-Asset');
var intCurrIndex = 0;

function textSwitch(){

	//textroll.filters.blendTrans.apply();
	textroll.innerHTML = arrText[intCurrIndex];
	//textroll.filters.blendTrans.play();

	if(intCurrIndex == arrText.length -1){
		intCurrIndex = 0;
	} else {
		intCurrIndex++;
	}
				
	eval("setTimeout(\"textSwitch()\", 4000);");
}