function getAbsLeft(o) {
	oLeft = o.offsetLeft
	while(o.offsetParent!=null) {
		oParent = o.offsetParent
		oLeft += oParent.offsetLeft
		o = oParent
	}
	return oLeft
}

function getAbsTop(o) {
	oTop = o.offsetTop
	while(o.offsetParent!=null) {
		oParent = o.offsetParent
		oTop += oParent.offsetTop
		o = oParent
	}
	return oTop
}

function OpenEvolve() {
  var usrname = document.getElementById('username').value;
  var pwd = document.getElementById('password').value;
  var formobj = document.getElementById('loginfrm');
  LeftPosition = (screen.availWidth) ? (screen.availWidth-600)/2 : 0;
  TopPosition = (screen.availHeight) ? (screen.availHeight-800)/2 : 0;
  settings = 'height=600,width=800,top='+TopPosition+',left='+LeftPosition+',resizable=yes,scrollbars=yes';
  var x = window.open('http://www.pmasolutions.com.au/ordering/login.php?login_attempt=true&username='+usrname+'&password='+pwd,'evolve',settings);
  x.opener = null;
  formobj.reset();
}

function OpenCentreWin(page_name,window_name,page_height,page_width,attributes) {
  LeftPosition = (screen.availWidth) ? (screen.availWidth-page_width)/2 : 0;
  TopPosition = (screen.availHeight) ? (screen.availHeight-page_height)/2 : 0;
  settings = 'height='+page_height+',width='+page_width+',top='+TopPosition+',left='+LeftPosition;
  if(attributes!='') settings = settings +','+attributes;
  var x = window.open(page_name,window_name,settings);
  x.opener = null;
}

function expand_menu(menu_arr, curmenu) {
	for(i=0; i<menu_arr.length; i++) {
	  tmpel = document.getElementById('lyr_'+menu_arr[i])
	  tmpel.style.display = 'none'
	  tmptdel = document.getElementById('tdtxt_'+menu_arr[i])
	  tmptdel.className = 'nav_section_ncheading'
	  tmptdel = document.getElementById('tdimg_'+menu_arr[i])
	  tmptdel.className = 'nav_section_ncheading'
	}

  newel = document.getElementById('lyr_'+curmenu);
  newel.style.display = 'block';
  newtdel = document.getElementById('tdtxt_'+curmenu);
  newtdel.className = 'nav_section_heading';
  newimgel = document.getElementById('tdimg_'+curmenu);
  newimgel.className = 'nav_section_heading';
}