var dir = "../";
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};

function ShowMnu(Img, Mnu) {
  setX(Img);
  setY(Img);
  HM_f_PopUp(Mnu, event);
}

function Null(){}

if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;

function ReloadBrowser()
{
  parent.opener.location.reload()
  parent.close()
}

//==========================================================================//
//	Function:	searchSelectBox(in_sFormName, in_sInputName, in_sSelectName)
//	Purpose: Acts as a "searchable" input for a given select box.
//	Parameters:
//		in_sFormName 	- The form name where the elements live
//		in_sInputName 	- The "search input element name.
//		in_sSelectName	- The select box to search against.
//
//==========================================================================//
function searchSelectBox(in_sFormName, in_sInputName, in_sSelectName) {
	sSearchString = document.forms[in_sFormName].elements[in_sInputName].value.toUpperCase();
	iSearchTextLength = sSearchString.length;

	for (j=0; j < document.forms[in_sFormName].elements[in_sSelectName].options.length; j++) {
		sOptionText = document.forms[in_sFormName].elements[in_sSelectName].options[j].text;
		sOptionComp = sOptionText.substr(0, iSearchTextLength).toUpperCase();

		if(sSearchString == sOptionComp) {
			document.forms[in_sFormName].elements[in_sSelectName].selectedIndex = j;
			break;
		}
	}
}


//=====================================================================
//         When changing the value in Edit FORM
//----------------------------------------------------------------------
function ChangeFormVal() {
  var Form = document.forms['qEditForm'];
  var Select = Form.linkid;
  var selectedIndex = Select.selectedIndex;
  var CurVal = Form.CategoryName.value;

  if (CurVal.length == 0)
    Form.CategoryName.value = Select[selectedIndex].text;
}
//=====================================================================


//--Delete Conformation
function ConfirmDel(NavURL) {
  if(window.confirm("You are about to delete the selected record permenently\n\n"+
  "Are you Sure?"))
    window.location.href = NavURL;
  return false;
}

//--Delete Conformation
function ConfirmRemove(NavURL) {
  if(window.confirm("You are about to Remove the record\n\n"+
  "Are you Sure?"))
    window.location.href = NavURL;
  return false;
}
function ConfirmDelTree(NavURL) {
  if(window.confirm("You are about to Remove the record\n\n"+
  "Are you Sure?"))
    window.location.href = NavURL;
  return false;
}

function TopLeft(Width, Height) {
  var winWidth, winHeight;
  winWidth = (screen.availwidth - Width)/2;
  winHeight = (screen.availheight  - Height)/2;
  var T =
  "top="    + winHeight + "," +
  "left="   + winWidth  + "," +
  "width="  + Width     + "," +
  "height=" + Height
  return T;
}

function OpenFiles(URL) {
  var MyWindow = window.open(URL, 'MyWindow', TopLeft(640,300) + "status=yes,resizable=yes,scrollbars=Yes");
  if(MyWindow) MyWindow.focus();
}


function Wizard(URL)
{
	var WizardWindow = window.open(URL, 'WizardWindow', "width=640,height=480,status=yes,top=200,left=200,resizable=yes,scrollbars=no");
}

//----------------------------------------------------------------------------
function hideOthers(ID) {
  for (i=1; i<=10; i++) {
    if (ID != i) {
      var M = document.getElementById('M_elMenu' + i);
      if (M)
        M.className = 'MenuBar_Normal';
     }
  }
}

/*
==============================================================================
Additions done by ADT:
==============================================================================
*/

if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;

var xpos = 0;
var ypos = 0;

//---------------------------------------------------------------------
//Setting up the X location of
//---------------------------------------------------------------------
function setX(Item) {
	if (document.all) {
		xpos = getOffsetLeftX(document.images[Item]);
	} else {
       xpos = document.images[Item].x;
  }
  xpos = xpos + 7 ;//'+ 35;
}

//---------------------------------------------------------------------
// Setting up Y location
//---------------------------------------------------------------------
function setY(Item) {
	if (document.all) {
		ypos = getOffsetTopX(document.images[Item]) ;
	} else {
    ypos = document.images[Item].y;
  }
  ypos = ypos + document.images[Item].height;
}

//---------------------------------------------------------------------
// Reading the X Position
//---------------------------------------------------------------------
function getX() {
	return  xpos;
}

//---------------------------------------------------------------------
// Reading the Y Position
//---------------------------------------------------------------------
function getY() {
  return ypos;
}

//---------------------------------------------------------------------
//Brower setup for Netscape
//---------------------------------------------------------------------
function getOffsetLeftX (el) {
    var ol = el.offsetLeft;
    while ((el = el.offsetParent) != null)
        ol += el.offsetLeft;
    return ol;
}
function getOffsetTopX (el) {
    var ot = el.offsetTop;
    while((el = el.offsetParent) != null)
        ot += el.offsetTop;
    return ot;
}

/*-----------------------------------------------------------------------
Show or Hide Search form on the bar
-----------------------------------------------------------------------*/
function ShowHide(IDName) {
  if (!document.all) return;
  var TR = eval(IDName);
  if (!TR) return;
  
  var Style = TR.style.display;
  if (Style == "none") {Style = "block"} else {Style = "none"}
  TR.style.display = Style;
}


var M_Array;
function setActiveMenu(MenuID)
{
  M_Array = eval('M_Array' + MenuID);
}

function ShowMenu(HM_MenuID, Menu_ID) {
  var MyURL = M_Array[Menu_ID];
  var jScript = /^JavaScript:/i
  if(MyURL.search(jScript) >= 0 ) {
    eval(MyURL)
  } else {
    document.location.href = MyURL;
  }
}

minYearList = 1930;
maxYearList = 2002;
