// JavaScript Document
var oldNode = "";
var oldRow = null;
var undefined;
var rowWithMouse= null;

ColorAr = new Array();
ColorAr[0]="#FFFFFF"
ColorAr[1]="#E6E6FA"
DispAr = new Array();
DispAr[0]="none"
DispAr[1]=""
ImgAr = new Array();
ImgAr[0]="../Images/expand.gif"
ImgAr[1]="../Images/fixed.gif"

	
function rowCollapse(frame, Id, type) {
	elem = getRow(frame, Id);
	ImgElem = getRow(frame, Id+"IMG");
	if (elem.className == "collapsible") {
		colId = elem.id + "D";
		colElem = getRow(frame, colId);
			if (colElem.style.display =="none") {
				ChangeStyle(elem,colElem,ImgElem,1)
			} else {
			ChangeStyle(elem,colElem,ImgElem,0)
		    }
		// Package menus has one type of collapsable nodes
		// opening one will close another
		// Hotels menu has two levels of collapsable nodes
		// collapsing/opening of sublevel is caused by requiring DB source
		// and reloading of the page
		
		if (type==1) {
			if (oldNode!=Id && oldNode!="") {
				el = getRow(frame,oldNode);
				oldElem= getRow(frame,oldNode+ "D");
				oldImgElem = getRow(frame,oldNode+ "IMG");
				oldNode=Id;
				ChangeStyle(el,oldElem,oldImgElem,0)
			}
			if (oldNode=="") {
				oldNode=Id;
			}
		}		
	}
	
	function ChangeStyle(parEl,El,imgEl,State){
	parEl.style.backgroundColor=ColorAr[State];
	El.style.display = DispAr[State];
	imgEl.src = ImgAr[State];
	}
}
function getRow(frame, Id) {

  //  Row = page.frames["menu"].document.getElementById(Id);
	Row = document.getElementById(Id);
	
	if (frame=="nav") {
		if (window.nav!=undefined) {
			Row = nav.document.getElementById(Id);
			}
	 } else {
	 	if (window.page!=undefined) {
			if (frame == "mmenu" )
				{
	 				Row = page.frames["menu"].frames["mmenu"].document.getElementById(Id);
				} 
				else
				{
					Row = page.frames["menu"].document.getElementById(Id);
			}
	 	}
	 }
	return Row 
}

function Rollover(frame, myId, isInRow, color) {
      // myId is our own integer id, not the DOM id
      // isInRow is 1 for onmouseover, 0 for onmouseout
     // var row = document.getElementById('tr_' + myId);
	 
	 var colId ="d"+myId;
	
	 var row=getRow(frame, colId);
	 if (color==null) {color='#E6E6FA'}
	// if (row.style.backgroundColor!='#b0c4de') 
	 if (oldRow!=row)
	 {
      rowWithMouse = (isInRow) ? row : null;
      rowUpdateBg(row, color);
	  }
	  else
	   {
     // rowWithMouse = (isInRow) ? row : null;
	 rowWithMouse=row;
      rowUpdateBg(row, '#b0c4de');
	  }
    }

 function rowUpdateBg(row,color) {
        row.style.backgroundColor = (row == rowWithMouse) ? color : '#FFFFFF';
    }
	
function RowSelect(frame,id){
	var row=getRow(frame, id);
	row.style.backgroundColor="#b0c4de";
	if (oldRow !=null && oldRow!=row) {
		oldRow.style.backgroundColor="#FFFFFF";
		}
	oldRow = row;
	}

function Secure(val) {
	var url = "default.asp";
	if (val=="LogOn") {	url = "logon1.asp" }

	if (window.nav!=undefined) {
		window.nav.document.frmTop.action = "https://lockdown.secure-orders.net/ledatrav/" + url;
	    //window.nav.document.frmTop.action ="http://localhost/LedaTravel/ssl/" + url;
		 window.nav.document.frmTop.submit();
		} else {
		document.frmTop.action = "https://lockdown.secure-orders.net/ledatrav/" + url;
		//document.frmTop.action = "http://localhost/LedaTravel/ssl/" + url;
	    document.frmTop.submit();
		}
	}