//Menu
topmenuarray=new Array('topmenu_on','submenu_on');
topmenutargets=new Array('Home','Reports','Investor','About','News','Contacts','Calendar','Meetings','Fact','Presentations')
submenutargets=new Array('Auto','Packaging','Industrial','Footwear','Diversified')
function domenu(id,mennum){
	currentclass=id.className
    id.className=topmenuarray[mennum]
}
function undomenu(id,mennum){
	Lmenuid=mennum
	var curstyle=topmenuarray[mennum]
	if(currentclass!=curstyle){
	id.className=currentclass;
	}
}
function activatemenu(menuid) {
	dotopmenu = setTimeout("initialisemenus("+menuid+")", 2000);
}
function activatesubmenu(menuid) {
	dosubmenu = setTimeout("initialisesubmenus("+menuid+")", 2000);
}
function initialisemenus(mennum){
	menutarget=topmenutargets[mennum];
	document.getElementById(menutarget).className="topmenu_on";
	clearTimeout(dotopmenu);
}
function initialisesubmenus(mennum){
	submenutarget=submenutargets[mennum];
	document.getElementById(submenutarget).className="submenu_on";
	clearTimeout(dosubmenu);
}
function BC_swapClass() {
   BC_swapClassRestore()
   var i,j=0,x,a=BC_swapClass.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.oClassName) x.oClassName=x.className; x.className=a[i+2];}
}
function BC_swapClassRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oClassName;i++) x.className=x.oClassName;
}
function navigateext(str){
	myRef = window.open()
    myRef.top.location.href=str
   }
//Endof Menu
//Panel Adjust
function checkpanels(){
HM_UserAgent = navigator.userAgent;
HM_IsSafari = (HM_UserAgent.indexOf("Safari")!=-1);
HM_IsFireFox = (HM_UserAgent.indexOf("Firefox")!=-1);
if(HM_IsSafari){
document.getElementById('stock_pic').height=200+"px";
document.getElementById('hellaby_images').height=200+"px";
document.getElementById('news_Panel').height=224+"px";
}
if(!HM_IsSafari){
document.getElementById('lastpanel').className="";
document.getElementById('lastpanel').height=16+"px";
}
if(HM_IsFireFox){
document.getElementById('lastpanel').height=16+"px";
document.getElementById('lastpanel').className="";
}
}
//Endof Panel Adjust
//Menu Location
function findObj(theObj, theDoc){
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
function calmenuleft(imgid){
	var LL = findObj(imgid)
	var xPos = eval(LL).offsetLeft;
	var tempEl = eval(LL).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}
function calmenutop(imgid){
	var TT = findObj(imgid)
	var yPos = eval(TT).offsetTop;
	var tempEl = eval(TT).offsetParent;
  	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}
function getHeight(){
	return window.innerHeight ? window.innerHeight :(document.getBoxObjectFor ? Math.min(document.documentElement.clientHeight, document.body.clientHeight) : ((document.documentElement.clientHeight != 0) ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0)));
}
function getWidth(){
	return (document.layers||(document.getElementById&&!document.all)) ? window.outerWidth : (document.all ? document.body.clientWidth : 0);
}
function reposmenus(){
	newwidth=getWidth();
	if(newwidth!=currentwidth){
	var curloc = document.location.href
    MM_goToURL('parent',curloc); 
	return document.MM_returnValue;
	}
}
function navigate(str){
	MM_goToURL('parent',str);return document.MM_returnValue
}
//Endof Menu Location
//Generic Functions
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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function gotoadmin(){
	MM_goToURL('parent','Admin/Login.php');return document.MM_returnValue
}
function tmt_formManager(f,c){
	if(MM_findObj(f)){eval("MM_findObj('"+f+"')."+c);}
}
function tmt_formAction(f,p){
	if(MM_findObj(f)){eval("MM_findObj('"+f+"').action='"+p+"'");}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//Endof Generic functions
//Contact Us Function
function contactus(){
	tmt_formAction('Former','Mail.php');
	tmt_formManager('Former','submit()');
}
//Endof Contact Us Function
//News Archives Function
function selectpage(str,val){
	document.getElementById('dispnum').value=val;
	document.getElementById('selectnum').value=str
	tmt_formManager('former','submit()');
}
function selectpageadmin(str,val){
	document.getElementById('dispnum').value=val;
	document.getElementById('selectnum').value=str
	document.location.href=("News.php?s="+str+"&dispnum="+val);
}

function turnoffnumbertable(){
	document.getElementById('Recnumbers').className="hidden";
}
//Endof Archives Function
//Shareprice Nav
function gotohistoricshares(){
	var retlink="<a href=\"#\" title=\"Current Share Price\" class=\"link\" onClick=\"rettocurrentshare()\"><strong>&lt;&lt; CURRENT SHARE PRICE</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;";
	document.getElementById('sharelink').innerHTML=retlink
	document.getElementById('Share_Heading').innerHTML="Historical Share Price Information";
	document.getElementById('Shareprice').src="Historical_shares.php";
}
function rettocurrentshare(){
	var retlink="<a href=\"#\" title=\"Historical Share Price Info\" class=\"link\" onClick=\"gotohistoricshares()\"><strong>HISTORICAL SHARE PRICE INFO &gt;&gt;</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;";
	document.getElementById('sharelink').innerHTML=retlink
	document.getElementById('Share_Heading').innerHTML="Share Price";
	document.getElementById('Shareprice').src="shares.php";
}
function getRadioValue (radioButtonOrGroup) {
  var buttonsLength = radioButtonOrGroup.length;
  if (buttonsLength) { // group
    for (var b = 0; b < buttonsLength; b++)
      if (radioButtonOrGroup[b].checked)
        return radioButtonOrGroup[b].value;
  }
  else if (radioButtonOrGroup.checked)
    return radioButtonOrGroup.value;
  return null;
}
function generatechart(){
	var chtimgurl = "http://charts.iguana2.com/hellaby/chart2/";
	var q = document.former.params;
	var r = getRadioValue (q);
	var a = document.getElementById('StartDay').value;
	var b = document.getElementById('StartMonth').value;
	var c = document.getElementById('StartYear').value;
	var subone = (c+b+a);
	var d = document.getElementById('EndDay').value;
	var e = document.getElementById('EndMonth').value;
	var f = document.getElementById('EndYear').value;
	var subtwo = (f+e+d);
	var chart = (subone+"/"+subtwo);
	if(r=="nz50"){
	chart = (chart+"/nz50");
	}
	document.getElementById('historic_Chart').src=(chtimgurl+chart)
}