
function launchSummary() {window.open('popup_summary.asp', 'summary', 'width=550,height=400,noresize,scrollbars=yes');}

function showPopup(divIdentifier, popupWidth, popupHeight) {
 windowHeight = parseInt(document.body.clientHeight);
 //windowWidth = parseInt(document.body.clientWidth);
 //windowWidth = 760;
 windowWidth = 600;
 scrollPosition = parseInt(document.body.scrollTop);

 //leftCoord = parseInt((parseFloat(windowWidth) / 2.0) - (parseFloat(popupWidth) / 2.0))
 leftCoord = 160 + parseInt((parseFloat(windowWidth) / 2.0) - (parseFloat(popupWidth) / 2.0))
 topCoord = scrollPosition + parseInt((parseFloat(windowHeight) / 2.0) - (parseFloat(popupHeight) / 2.0))

 //debug
 //alert(leftCoord + 'x' + topCoord);
 
 document.getElementById(divIdentifier).style.top = topCoord
 document.getElementById(divIdentifier).style.left = leftCoord
 document.getElementById(divIdentifier).style.visibility = 'visible';

}

function fixMenu() {
 var mElement;
 windowHeight = parseInt(document.body.clientHeight);
 scrollPosition = parseInt(document.body.scrollTop);
 if (windowHeight < 400) {
  document.getElementById('sidemenu').style.top = 140
  for (mElement=0;mElement<submenuArray.length;mElement++) {document.getElementById('submenu_' + submenuArray[mElement]).style.top = submenuPosArray[mElement]+140}
 }
 else {
  if (scrollPosition>140) {
   document.getElementById('sidemenu').style.top = scrollPosition+5
   for (mElement=0;mElement<submenuArray.length;mElement++) {document.getElementById('submenu_' + submenuArray[mElement]).style.top = (submenuPosArray[mElement]) + scrollPosition + 5}
  }
  else {
   document.getElementById('sidemenu').style.top = 140
   for (mElement=0;mElement<submenuArray.length;mElement++) {document.getElementById('submenu_' + submenuArray[mElement]).style.top = submenuPosArray[mElement]+140}
  }
 }
}

function showMenu(menuToShow) {
 var mElement;
 for (mElement=0;mElement<submenuArray.length;mElement++) {document.getElementById('submenu_' + submenuArray[mElement]).style.visibility = 'hidden';}
 if (menuToShow.length > 0) {
  iIn();
  document.getElementById('submenu_' + menuToShow).style.visibility = 'visible';
 }
}

function iIn() {
 isOverMenu = true;
}

function iOut() {
 isOverMenu = false;
 setTimeout("menuTimeout()",timeoutDelay);
}	

function menuTimeout() {
 if (!isOverMenu) showMenu('');
}

function mainBranchOut() {
 iOut();
}

function bP() {
 showMenu('');
 if (deliveryPage) {
  showPopup('popup_choose_location', 220, 220)
  return false;
 }
 return true;
}
