var CurMnu = '';
//window.alert('Initial => {'+CurMnu+'}');

//Close all sub menus of the menu bar item on the web page 
function CloseMenu()
{if (CurMnu !='')
 {
  var mnuObj=eval("document.all('"+CurMnu+"')");
  if (mnuObj != undefined)
   {  
    if (mnuObj.style.display=='')
 	  {mnuObj.style.display='none';
       CurMnu == '';
	  }
   }
 }
}

//Set the position of a certain sub menu of the menu bar item on the web page 
function OpenMenu(mnuStr)
{if (CurMnu != '')
	CloseMenu();
 CurMnu = mnuStr;
 //window.alert('In action => {'+CurMnu+'}');
 var mnuObj=eval("document.all('"+mnuStr+"')");
 if (mnuObj != undefined)
  {
		theY=document.body.scrollTop + window.event.y;
		theX=document.body.scrollLeft + window.event.x; 
		if (document.body.clientWidth<(mnuObj.style.width + window.event.x))
			theX=document.body.scrollLeft + window.event.x - mnuObj.style.width;
		if (document.body.clientHeight<(mnuObj.style.height + window.event.y))
			theY=document.body.scrollTop + window.event.y - mnuObj.style.height;
		DispMenu(mnuStr,theX, theY);
  }
}

//Display the sub menu of the menu bar item on the web page 
function DispMenu(mnuStr, xPos, yPos)
{
 var mnuObj=eval("document.all('"+mnuStr+"')");
 mnuObj.style.top = yPos;
 mnuObj.style.left = xPos;
 mnuObj.style.display='';
}

function OpenDownload(dnid)
{
 window.open('DNItem.aspx?dnid='+dnid,'newDN','height=420,width=480,top=100,left=100,scrollbars=yes,resizable=yes,menubar=yes');
}

//Do web search
function DoSearch()
{
 var FindDB = document.Form1.CtrlSearch1_SrchList.value;
 var kwd =  document.Form1.CtrlSearch1_Kwdbox.value;
 window.location.href="../Search/Search.aspx?FindDB=" + FindDB + "&kwd=" + kwd;
}

function tellFriend(db,id)
{
 var URLStr;
 URLStr="http://iven/cipherlab/Product/List.aspx?";
 eval("window.open('../Product/TellFriend.aspx?db='+db+'&id='+id,'','width=500,Height=380,left=200,top=130');");
}

function getFilenameExt(fileStr) {
  if (fileStr=="") {return "";}
  else {return fileStr.substring(fileStr.lastIndexOf("."),fileStr.length);}
}