function divEzGuideHide()
{
	ezbody.innerHTML = '';
	/*
	ezbody.style.paddingTop = '0pc';
	ezbody.style.paddingBottom = '0pc';
	ezbody.style.paddingLeft = '0pc';
	ezbody.style.paddingRight = '0pc';
	ezbody.style.marginTop = '0pc';
	ezbody.style.marginBottom = '0pc';
	*/
	ezbody.style.visibility = 'hidden';
	ezbody.style.display = "none";
	//var fr = document.getElementById('idezGuideIFrame');
	//document.body.removeChild(fr);
}

function show_ezguide(curpage){
	//Pull the html for this ez-guide
	var xmlhttp=new ActiveXObject('Msxml2.xmlHTTP');
	var page = '\\includes\\GetEZGuide.asp?pg='+ escape(curpage);
	xmlhttp.Open('Get', page, false);
	xmlhttp.Send();

	//Populate the div with the html	
	ezbody.style.visibility = 'visible';
	ezbody.innerHTML = '<span style="WIDTH: 100%; POSITION: relative; TOP: 0pc; TEXT-ALIGN: right"><span style="filter:shadow(color:gray,strength:50,direction:135);BORDER-RIGHT: activeborder 2px ridge; BORDER-TOP: activeborder 2px ridge; BORDER-LEFT: activeborder 2px ridge; CURSOR: hand; BORDER-BOTTOM: activeborder 2px ridge; BACKGROUND-COLOR: buttonface; ZOOM: 125%">&nbsp;X&nbsp;</span></span>'
		+ xmlhttp.responseText;
	
	//Slide an iframe directly under it to hide any windowed elements on the layer below.
	var iframeEl = document.createElement("IFRAME");
	iframeEl.id = 'idezGuideIFrame';
	iframeEl.frameBorder = 10;
	iframeEl.src = "javascript:;";
	iframeEl.style.display = "none";
	iframeEl.style.position = "absolute";
	//iframeEl.style.top = idPageHeader.style.height;
	//iframeEl.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=50)";
	iframeEl.style.backgroundColor = 'beige';
	ezbody.style.paddingTop = '1pc';
	ezbody.style.paddingBottom = '1pc';
	ezbody.style.paddingLeft = '1pc';
	ezbody.style.paddingRight = '1pc';
	ezbody.style.display = "block";
	ezbody.style.filter="progid:dximagetransform.microsoft.shadow(color:gray,strength:10,direction:135)";
	ezbody.parentNode.insertBefore(iframeEl, ezbody);
}

function is_blankN(tstr){
	out = " "; 
	add = ""; 
	tmpObscure = "" + tstr;
	while (tmpObscure.indexOf(out)>-1) {
		pos= tmpObscure.indexOf(out);
		tmpObscure = "" + (tmpObscure.substring(0, pos) + add + 
		tmpObscure.substring((pos + out.length), tmpObscure.length));
	}
	if(tmpObscure.length==0){
		return true;
	}else{
		return false;
	}
}
function showquicklist(op){
	if(!is_blankN(op)){
	window.location=op;
	}
}

function flipImg(imgObj,pic){
	imgObj.src=pic;
}

function inList(lstBox, srchFor, val_Or_text)
{
	found = 0;
	
	for(q = 0; q<lstBox.length; q++)
	{
		if(val_Or_text = 'val')
		{
			if(lstBox.options[q].value == srchFor)
			{
				found = 1;
				break;
			}
		}
		if(val_Or_text = 'id')
		{
			if(lstBox.options[q].text == srchFor)
			{
				found = 1;
				break;
			}
		}
		
	}
	
	return found;
}

function is_blank(tstr){
		out = " "; 
		add = ""; 
		temp = "" + tstr;

		while (temp.indexOf(out)>-1) {
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + 
			temp.substring((pos + out.length), temp.length));
		}
		
		if(temp.length==0){
			return true;
		}else{
			return false;
		}
}



function focus_control(ctrl){
	try{
		ctrl.focus();
		ctrl.select();
	}catch(errObjF_C){}
}
	
	
function trim(strValue){
	var objRegExp = /^(\s*)$/;

	// Check for all spaces
	if (objRegExp.test(strValue)) 
	{
	    strValue = strValue.replace(objRegExp, '');
	    if( strValue.length == 0)
	        return strValue;
	}
	
	// Check for leading & trailing spaces
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if (objRegExp.test(strValue)) 
	{
	    //remove leading and trailing whitespace characters
	    strValue = strValue.replace(objRegExp, '$2');
	}
	return strValue;
}


function isnumeric(strValue){
if (strValue == "")  { return false }
if (strValue.charAt(0) == "-")
    start = 1;
else
    start = 0;
for (i = start; i < strValue.length; i++){
    if ((strValue.charAt(i) < "0") && (strValue.charAt(i) != ".")) { return false; }
    if ((strValue.charAt(i) > "9") && (strValue.charAt(i) != ".")) { return false; }
}
return true;
}


function loadCboXmlData(lstbox,XmlDoc,tagName){
	for (var i = lstbox.length;i > 0;i--){lstbox.options[0] = null;}
	
	var mynodeList = XmlDoc.getElementsByTagName(tagName);

	for( nIndex = 0; nIndex < mynodeList.length; nIndex++ ){
		var objoption = document.createElement("OPTION");
		objoption.text = mynodeList.item(nIndex).text;
		objoption.value = mynodeList.item(nIndex).text;
		lstbox.options.add(objoption);
	}
}

function loadCboXmlDataVT(lstbox,XmlDoc,tagNameForValue, tagNameForText){
	for (var i = lstbox.length;i > 0;i--){lstbox.options[0] = null;}
	
	var mynodeListValue = XmlDoc.getElementsByTagName(tagNameForValue);
	var mynodeListText = XmlDoc.getElementsByTagName(tagNameForText);

	for( nIndex = 0; nIndex < mynodeListValue.length; nIndex++ ){
		var objoption = document.createElement("OPTION");
		objoption.text = mynodeListText.item(nIndex).text;
		objoption.value = mynodeListValue.item(nIndex).text;
		lstbox.options.add(objoption);
	}
}


function addOptionToSelect(lstBox, v, t)
{
	var objoption = document.createElement("OPTION");
	objoption.text = t;
	objoption.value = v;
	lstBox.options.add(objoption);
}


function formatCurrency(num) {
	var isNeg = false;
	var retval = '';
	num = num.toString().replace(/\$|\,/g,'');
	if(num < 0)
	{
		isNeg = true;
		num = num * -1;
	}
	if(isNaN(num)) num = "0";
	cents = Math.floor((num*100+0.5)%100); 
	if(parseInt(num)>=0)
	{
		num = Math.floor(num).toString();
	}
	
	if(cents < 10) cents = "0" + cents; 
	
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
	num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3)); 
	
	if(isNeg)
	{
		retval = '$-' + num + '.' + cents;
	}
	else
	{
		retval = '$' + num + '.' + cents
	}
	return (retval); 
	
	//num = num.toString().replace(/\$|\,/g,'');
	//if(isNaN(num)) num = "0";
	//cents = Math.floor((num*100+0.5)%100); 
	//num = Math.floor(num).toString();
	//if(cents < 10) cents = "0" + cents; 
	//for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
	//num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3)); 
	//return ('$' + num + '.' + cents); 
} 


function populateSelectFromString(cboObj,strToParse,strDelim){
	var arrNodes = strToParse.split(strDelim);
	var objoption = document.createElement("OPTION");
	
	//'Clear the select box first
	for (var i = cboObj.length;i > 0;i--){cboObj.options[0] = null;}
	
	for (var i=0; i < arrNodes.length; i++){	
		objoption = document.createElement("OPTION");
		objoption.text = arrNodes[i];
		objoption.value = arrNodes[i];
		cboObj.options.add(objoption);
		
	}
}
	
function numbersonly(myfield, e, dec) {
	var key; var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else return true;
	
	keychar = String.fromCharCode(key);
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true;
	else if ((("0123456789").indexOf(keychar) > -1)) return true;
	else if (dec && (keychar == ".")) {
		myfield.form.elements[dec].focus();
		return false;
	}
	else return false;
}
