function getEl (id) // v1.0.0
{

	return document.getElementById(id);

}

function showImg (id, arr, key, state) // v1.0.0
{

	getEl(id).src = arr[key][state].src;

}

function setFocus (id) // v1.0.0
{

	getEl(id).focus();
	getEl(id).select();

}

function showEl (id) // v1.1.0
{

	if (typeof(arguments[1]) == 'undefined')
		str = "block";
	else
		str = arguments[1];

	getEl(id).style.display = str;

}

function hideEl (id) // v1.0.0
{

	getEl(id).style.display = "none";

}

function addClass (id, str) // v1.0.0
{

	el = getEl(id);

	re = new RegExp("( |^)"+str);

	if (el.className.search(re) == -1)
		el.className += " "+str;

}

function delClass (id, str) // v1.0.0
{

	el = getEl(id);

	re = new RegExp(" ?"+str);

	el.className = el.className.replace(re, "");

}


function addSlashes( str )
{
	// http://kevin.vanzonneveld.net

	return str.replace(/([\'\"])/g, "\\$1");

}


function urlEncode(str)
{
	// http://kevin.vanzonneveld.net

	str = str.toString();
	str = encodeURIComponent(str);
	str = str.replace(/%20/g, '+');

	return str;

}


function moneyFormat (flt) // v1.1.0
{

	if (arguments[1] == undefined)
		arguments[1] = "$";

	return arguments[1]+" "+numberRound(flt, 2);

}

function numberRound (flt, numdec) // v1.0.0
{

	flt = parseFloat(flt);

	if (isNaN(flt) || flt == 0) {

		flt = "0";
	
		if (numdec > 0) {
		
			flt += ".";
		
			for (b=1; b<=numdec; b++)
				flt += "0";
			
		}
		
		return flt;
	
	}
	
	for (b=1; b<=numdec; b++)
		flt = flt * 10;

	flt = Math.round(flt);

	if (numdec == 0)
		return flt;

	flt = flt.toString();
	int = flt.substr(0, flt.length-numdec);
	dec = flt.substr(flt.length-numdec, numdec);

	return int+"."+dec;

}


function getAnchor ()
{

	return unescape(document.location.hash.substring(1));
	
}


function showSingleEl (ids, show)
{

	for (a in ids) {

		if (ids[a] == show)
			showEl(ids[a]);
		else
			hideEl(ids[a]);
	
	}

}


function showEls (ids)
{

	for (a in ids)
		showEl(ids[a]);

}


function hideEls (ids)
{

	for (a in ids)
		hideEl(ids[a]);

}

function locationByLinkName (name)
{

	document.location.href = document.links[name].href;

}
