/****************************************************************************************************
*  Following are User Interface related functions
***************************************************************************************************/
var dom = (document.getElementById)? true:false;
function layerDim() {
	var mnLyr = "mainLyr"
	var pbLyr = "pageBody"
	//var lmLyr = "leftMenu"
	var nwHt  = "";

	if (dom) {
		var mnHt = document.getElementById(mnLyr).offsetHeight; 
		var pbHt = document.getElementById(pbLyr).offsetHeight;
		//var lmHt = document.getElementById(lmLyr).offsetHeight;
		var lmHt = 0;
		
		if (lmHt >= pbHt) {
			nwHt = (lmHt + 50);
		} else {
			nwHt = (pbHt + 50);
		}	
		document.getElementById(mnLyr).style.height = nwHt;
	}
}

/*routine to show/hide the menu options */
var active = "mnu_0";
var tgId = false;
var dStat = true;
function chCls(mnHdr,mnuEl) {;}
function shMenu(mnuId) {;}

function ChangedshMenu(mnuId) {
	tgId = (active == mnuId) ? true:false;
	if (tgId == false) {
		document.getElementById(active).style.display = 'none';
		active = mnuId;
		document.getElementById(active).style.display = 'block';	
		dStat	= false;
	} else {
		 if (dStat == false) {
			document.getElementById(active).style.display = 'none';
		 } else {
			document.getElementById(active).style.display = 'block';	
		 }
		 dStat	= (dStat == true) ? false:true;
	}
}

function ChangedchCls(mnHdr,mnuEl) {
	if(document.getElementById) {
		var obj = document.getElementById('leftMenu').getElementsByTagName('li');
		var mHdr = document.getElementById(mnHdr);		
		var mEl = document.getElementById(mnuEl);
		for(i=0; i < obj.length; i++) {obj[i].className = "";}
		mHdr.className = "active";
		if (mEl != null) {mEl.className = "active";}
	}
}

/* routine for removing the rubberband highlight  and set a default text in the Statusbar of the browser */
function unblur() {
	this.blur();
}

function blurLinks() {
	if (!document.getElementById) return;
	theLinks = document.getElementsByTagName("a");
	for(i=0; i<theLinks.length; i++) {
	theLinks[i].onfocus = unblur;
	theLinks[i].onmouseover = fnStatBar;
}
	window.status = 'appraiserConnect';
	return true;
}

function fnStatBar() {
	window.status = 'appraiserConnect'; 
	return true;
}


/*	ZEBRA Tables */
function hasClass(obj) {
	var result = false;
	if (obj.className != null) {
		result = obj.className;
	}
	return result;
}   

function stripe(id) {
	var even = false;
	var evenColor = arguments[1] ? arguments[1] : "";
	var oddColor = arguments[2] ? arguments[2] : "#F4F5F6";
	var table = document.getElementById(id);
	if (! table) { return; }
	var tbodies = table.getElementsByTagName("tbody");
	for (var h = 0; h < tbodies.length; h++) {
		var trs = tbodies[h].getElementsByTagName("tr");
		for (var i = 0; i < trs.length; i++) {
			if (! hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
				var tds = trs[i].getElementsByTagName("td");
				for (var j = 0; j < tds.length; j++) {
					var mytd = tds[j];
					mytd.style.backgroundColor = even ? evenColor : oddColor;
				}
			}
			even =  ! even;
		}
	}
}


/* Following 2 routines set the color of the input boxes */
function fnCFocus(obj) {
	obj.style.backgroundColor = '#f2faff';
	obj.style.borderColor = '#116aaa';
	obj.style.color = '#000000';
}

function fnCBlur(obj) {
	obj.style.backgroundColor = '#ffffff';
	obj.style.borderColor = '#6caad6';
	obj.style.color = '#000000';
}
