
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//  © Copyright 2000, Calypso Systems, Inc.
//  All Rights Reserved.
//
//  Description:	Browser Side xTools
//
//  Who                     When         What
//  ------------------------------------------------
//  lGoodman@calsys.com     01/17/00     Created
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// var MODULE_NAME = "xTools.asp"
/*
Functions
Name
---------------------------------------------------
jsHTMLEncode(sSrc)
jsHTMLDecode(sSrc)
strBuilder()
	.join(sDelim)
   .add(sItem)
   .addEx(item1,item2,...)

*/



// -----------------------------------------
// jsHTMLEncode
// -----------------------------------------
function jsHTMLEncode(sSrc) 
	{
		var sRet = new String(sSrc);
		sRet = sRet.replace(/&/g,"&amp;");
		sRet = sRet.replace(/</g,"&lt;");
		sRet = sRet.replace(/>/g,"&gt;");
		//sRet = sRet.replace(/ /g,"&nbsp;");
		sRet = sRet.replace(/"/g,"&quot;");
		return sRet;
	}
function jsHTMLDecode(sSrc) 
	{
		var sRet = new String(sSrc);
		sRet = sRet.replace(/&lt;/g,"<");
		sRet = sRet.replace(/&gt;/g,">");
		//sRet = sRet.replace(/&nbsp;/g," ");
		sRet = sRet.replace(/&quot;/g,'"');
		sRet = sRet.replace(/&amp;/g,'&');
		return sRet;
	}
	
	


// -----------------------------------------
// String Builder
// -----------------------------------------
function strBuilder()
{
	this.count = 0;
	this._items = new Array();
}

	// Add a property
	strBuilder.prototype.addProp = function(sName,sValue)
	{
	this.add(" " + sName + "='" + sValue + "'");
	}


	// Add an item 
	strBuilder.prototype.add = function(sItem)
	{
		this.count++;
		this._items[this.count] = sItem;
	}
	
	// AddEx - Add as many strings as there are items
	strBuilder.prototype.addEx = function()
	{
		for (var i=0;i < arguments.length; i++)
		{
			this.add(arguments[i])
		}
	}
	

	// Return Results
	strBuilder.prototype.join = function(sDelim)
	{
		if (sDelim) 
		{
			return this._items.join(sDelim);
		}
		else
		{
			return this._items.join("");
		}
	}

function getSelectValue(select){
if (navigator.appName =='Netscape'){
	return select.options[select.selectedIndex].value;
}else{
	return select.value;
}

}