window.loaded = false;
var Debug = true;
var here = "trace marker";
var formerror = "Your request could not be submitted. Please enter\nthe following required information and resubmit.\t\t\n\n";
function copy(text){window.clipboardData.setData("Text",text);}

var post = "POST";
var get = "GET";
var ie4 = (document.all)?true:false;
var ie  = (navigator.appName.toLowerCase().indexOf("microsoft") != -1);
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var mac = (navigator.platform.toLowerCase().indexOf("mac") != -1);
var ns  = (navigator.appName.toLowerCase().indexOf("netscape") != -1);
var NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
var ns4 = (document.layers)?true:false;
var ns6 = (document.getElementById&&!document.all)?true:false;
var win = (navigator.platform.toLowerCase().indexOf("win") != -1);
var browserVer = parseFloat(ie ? navigator.appVersion.substring(navigator.appVersion.toLowerCase().indexOf("msie") + 4) : navigator.appVersion);


function agent(){
	result = new Object();
	result.name = "agent()";
	result.appname = navigator.appName + "\n" + navigator.appVersion;
	result.opera = (navigator.appVersion.indexOf("opera")!=-1);
	result.msie = (navigator.appVersion.indexOf("MSIE")!=-1);
	result.netscape = (navigator.appName.indexOf("Netscape")!=-1);
	result.safari = (navigator.appName.toLowerCase().indexOf("safari")!=-1);
	result.win = (navigator.platform.toLowerCase().indexOf("win")!=-1);
	result.mac = (navigator.platform.toLowerCase().indexOf("mac")!=-1);
	result.ie4 = (navigator.appVersion.indexOf("MSIE 4")!=-1)
	result.ie5 = (navigator.appVersion.indexOf("MSIE 5")!=-1)
	result.ie6 = (navigator.appVersion.indexOf("MSIE 6")!=-1)
	result.ie7 = (navigator.appVersion.indexOf("MSIE 7")!=-1)
	return result;
}

// Global Event Listeners
AddListener(window,"load",function(){setIp();});
AddListener(window,"load", KillGoogleColorsStart,false);
AddListener(document,"mousemove",captureMousePosition,true);
AddListener(document,"keydown",function(e){
	window.keyCode = e.keyCode;
});
AddListener(document,"keyup",function(e){
	window.lastKeyPress = window.keyCode;
	window.keyCode = undefined;
});


function SetOnClickThrowLinkFocus(){
	var me, _me;
	for(me in document.links){
		_me = document.links[me];
		if(typeof(_me)=="object"){
			AddListener(_me, ((ie)?"onfocus":"focus"),OnClickThrowLinkFocus, true);
		}
	}
}

// Global variables
window.mouse = {
	id: "mouseobject",
	type: "mouseobject",
	_x:function(){return(window._xmouse);},
	_y:function(){return(window._ymouse);}
}

window._xmouse = 0; // Horizontal position of the mouse on the screen
window._ymouse = 0; // Vertical position of the mouse on the screen

function captureMousePosition(e) {
	try {
		 if (document.layers) {
			  window._xmouse = e.pageX-window._hscroll();
			  window._ymouse = e.pageY-window._vscroll();
		 } else if (document.all) {
			  window._xmouse = window.event.x;
			  window._ymouse = window.event.y;
		 } else if (document.getElementById) {
			  // Netscape 6 behaves the same as Netscape 4 in this regard
			  window._xmouse = e.pageX-window._hscroll();
			  window._ymouse = e.pageY-window._vscroll();
		 }
		} catch(e){}
}

window._hscroll = function(){
	return(
		(window.pageXOffset&&window.pageXOffset>0)?window.pageXOffset:(
			(document.documentElement&&document.documentElement.scrollLeft>0)?document.documentElement.scrollLeft:(
				(document.body&&document.body.scrollLeft>0)?document.body.scrollLeft:0
			)
		)
	);
}
window._vscroll = function(){
    return(
    	(window.pageYOffset && window.pageYOffset>0)?window.pageYOffset:(
    		(document.documentElement&&document.documentElement.documentElement>0)?document.documentElement.scrollTop:(
    			(document.body && document.body.scrollTop>0)?document.body.scrollTop:0
    		)
    	)
    );
}

function loadFlashTo(Address, minFlashVersion,width,height,output,args){
	var oFlash = loadFlash(Address, minFlashVersion,width,height,true,args);
	var o;
	if(typeof(output)=="string"){
		o = document.getElementById(output);
	} else {
		o = output
	}
	if(o){
		o.innerHTML = oFlash;
	} else {
		return(oFlash);
	}
}


/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
/* usage:
swfobject.embedSWF("Path/To/File","NameOfObjectToREPLACE","Width","Height","Version");
NOTE: create a div layer which will be completely replaced by the movie file.. referance to the movie
will now be made through that div layers name... e.g.

<div id="MyMovie"></div>

to access the movie at this point you would use
window["MyMovie"]. or document["MyMovie"]. (function getSWF takes care of the addressing)
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
// TODO :: Replace all loadFlash referances to swfobject.embedSWF

function loadFlash(Address,minFlashVersion,width,height,DoReturn,args){
	var Return = ""
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i) {
			if (isNaN(parseInt(words[i]))){ continue; }
			var MM_PluginVersion = words[i];
		}
		var MM_FlashCanPlay = MM_PluginVersion >= minFlashVersion;
	} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
		&& (navigator.appVersion.indexOf("Win") != -1)) {
		Return += ('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		Return += ('on error resume next \n');
		Return += ('MM_FlashCanPlay = ( IsObject(CreateObject("))." & ' + minFlashVersion + ')))\n');
		Return += ('</SCR' + 'IPT\> \n');
	}
	MM_FlashCanPlay = true;
	if ( MM_FlashCanPlay ) {
		Return += ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		Return += ('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" ');
		Return += ('  width="' + width + '"');
		Return += ('  height="'+ height + '"');
		Return += ('  allowScriptAccess="always"');
		try {
			if(args.align!=undefined){Return += ('  align="'+ args.align + '"');}
			if(args.vspace!=undefined){Return += ('  vspace="'+ args.vspace + '"');}
			if(args.hspace!=undefined){Return += ('  hspace="'+ args.hspace + '"');}
			Return += ('  id="' + ((args.id!=undefined)?args.id:"FlashMovie") + '"');
		} catch(e){}
		Return += ('>');

		Return += (' <param name="movie" value="' + Address + '?pepper="' + getPepper() + '">')
		Return += (' <param name="height" value="' + height + '">')
		Return += (' <param name="width" value="' + width + '">')
		Return += (' <param name="loop" value=false>');
		Return += (' <param name="quality" value="autohigh">');
		Return += (' <param name="wmode" value="opaque">');
		Return += (' <param name=\"allowScriptAccess\" value=\"always\" /> ')
		Return += (' <embed src="' + Address + '?pepper="' + getPepper() + '" loop=false quality=autohigh');
		Return += (' swLiveConnect=false');
		Return += ('  width="' + width + '"');
		Return += ('  height="'+ height + '"');
		try {
			if(args.align!=undefined){Return += ('  align="'+ args.align + '"');}
			if(args.vspace!=undefined){Return += ('  vspace="'+ args.vspace + '"');}
			if(args.hspace!=undefined){Return += ('  hspace="'+ args.hspace + '"');}
			Return += ('  id="'+ ((args.id!=undefined)?args.id:"FlashMovie") + '"')
		} catch(e){}
		Return += (' wmode="opaque"');
		Return += (' type="application/x-shockwave-flash" ')
		Return += (' pluginspage="http://www.macromedia.com/go/getflashplayer">');
		Return += (' </embed>');
		Return += (' </object>');
	}

	if(Return!=""){
		if(DoReturn){
			return(Return);
		} else {
			document.write(Return);
			return;
		}
	}
}


/** @function isPhone
 * @purpose returns if a phone number is valid
 * @author Scott McDonald
 * @version 1.0
 * @lastedit Monday, July 22, 2002
 * @param $val phone number to check as string
 * @return boolean
*/ function isPhone($val){var phone = validPhone($val);return phone.valid;}

/** @function validPhone
 * @purpose returns if a phone number is valid, and puts it in database freindly order
 * @author Scott McDonald
 * @version 1.0
 * @lastedit Monday, July 22, 2002
 * @param $val phone number to check as string
 * @param $args as ArgObject
 *		@arg allowAreaCode
 				@value allow - not required but allowed [default]
 				@value force - must have
 				@value disallow - not allowed
 *		@arg formatAreaCodeParam : boolean - should area code be wrapped in paranthasys
 *		@arg formatSpaceAfterAreaCode : boolean - should there be a space after the area code rather then the delim
 *		@arg allowDilim : enum allows for a dilimiter in phone number.
 				@value allow - not required but allowed [default]
 				@value force - must have dilim
 				@value disallow - no dilim allowed
 *		@arg formatDilim : String sets phone dilimiter defaults "-"
 			@arg allowExtention :
 				@value allow - not required but allowed [default]
 				@value force - must have
 				@value disallow - not allowed
 			@formatExtention : string sets extention dilimiter
 			@restrict555 : if true : will not allow phone numbers which start with the prefix 555
 * @return Object (
			.value =	re-formatted phone number.
			.valid	=	returns if phone number is valid
			.origonal = returns passed number (misspelling noted... oops, too late :\ )
			.empty = boolean if passed number was empty
			.altered = boolean if script altered the number
			.error = string error message
		)
*/
function validPhone($val, $args){
	var args = new Object();
	try { args.allowCountryCode = ($args.allowCountryCode==undefined)?false:$args.allowCountryCode!=false;} catch(e){args.allowCountryCode = false;}
	try { args.allowDilim = ($args.allowDilim==undefined)?"allow":$args.allowDilim;} catch(e){args.allowDilim = "allow";}
	try { args.formatDilim = ($args.formatDilim==undefined)?"-":$args.formatDilim;} catch(e){args.formatDilim = "-";}
	try { args.allowAreaCode = ($args.allowAreaCode==undefined)?"allow":$args.allowAreaCode;} catch(e){args.allowAreaCode = "allow";}
	try { args.formatAreaCodeParam=($args.formatAreaCodeParam==undefined)?false:$args.formatAreaCodeParam;} catch(e){args.formatAreaCodeParam = false;}
	try { args.formatSpaceAfterAreaCode=($args.formatSpaceAfterAreaCode==undefined)?false:$args.formatSpaceAfterAreaCode;} catch(e){args.formatSpaceAfterAreaCode = false;}
	try { args.autoRemoveAreaCode = ($args.autoRemoveAreaCode==undefined)?false:$args.autoRemoveAreaCode;} catch(e){args.autoRemoveAreaCode = false;}
	try { args.allowExtention=($args.allowExtention==undefined)?"allow":$args.allowExtention;} catch(e){args.allowExtention = "allow";}
	try { args.formatExtention=($args.formatExtention==undefined)?" x":$args.formatExtention;} catch(e){args.formatExtention = "x";}
	try { args.restrict555 = ($args.restrict555==true) } catch(e){args.restrict555 = false;}
	/* defines if Alpha is allowed in a number.
	*/
	try { args.AllowAlpha = ($args.AllowAlpha==true) } catch(e){args.AllowAlpha = false;}
	try { args.RequireAlpha = ($args.RequireAlpha==true) } catch(e){args.RequireAlpha = false;}



	try {
	/* create a return object
	 */ var $return = new Object();
	 		$return.origonal = $val;
			$return.valid = false;
			$return.empty = false;
			$return.altered = false;
			$return.value = $val;
			$return.error = "";

	 /* check to see if dilims are allowed, if not set dilim as ""
	 */ if(args.allowDilim!="disallow"){
			/* check to see if args allows for a user defined dilim
			 */ if(args.formatDilim==""){
					/* script allows user defined dilim, we need to get it out of the
					 * string, we will use the first one we find (not including parans) so if they have used several
					 * different types, they are out of luck
					 */ var dilim = numOnly($val,"","returnNoneNumeric=true")
						 if(dilim!=""){
						/* remove open and close params from the possible list.
						*/
								dilim = dilim.replace("(","");
								dilim = dilim.replace(")","");
						/* just to be safe, if dilim is " " (space) and there are more dilims in the list
						 * lets use the next in line, otherwise we will use space
						 */  dilim = ((dilim.charAt(0)==" " && dilim.length>1)?dilim.charAt(1):dilim.charAt(0));
						 } else {dilim = "-";}
					} else {dilim = args.formatDilim;}
			} else {dilim = "";}
	 /* check to see if extention is allowd, if not set extDilim to ""
	 */ if(args.allowExtention!="disallow"){
	 			if(args.formatExtention==""){
	 			 	exDilim = " x";
	 			 } else {
	 			 	exDilim = args.formatExtention;
	 			 }
	 		} else {
	 			exDilim = " x";
	 		}

	var prevalue = $val;
	if(args.AllowAlpha){
		if(!args.allowCountryCode){
			$val = $val.replace("1"+dilim,"");
		}
		var tempAlpha = window.convertAlphaPhoneToNumber($val);
		var newValidate = validPhone(tempAlpha);
		if(tempAlpha!=$val && newValidate.valid){
			$return.valid = true;
			$return.altered = $val==$return.origonal;
			$return.value = $val;
			$return.error = "";
			return($return);
		} else if(tempAlpha!=$val) {
			$return.valid = false;
			$return.error = newValidate.error;
			return($return);
		}
	}

	 /* strip out anything that isn't a number
	 */ $val = numOnly($val);
	 $return.value = numOnly($val,exDilim+dilim);

	/* if we have an empty phone string, then return
	*/ if(!$val){
				$return.valid = false;
				$return.empty = true;
				$return.value = "";
				$return.error = "phone number is empty"
				$return.altered = ($return.origonal != $return.value);
				return($return);
			}

	/* loop through the string, ensuring valid data.
	 * current checks:
	 *	 - 1 or 0 at the beginning of the number
	 *	 - 911, 411 as first three digits (this can be added to as needed)
	 *	 - 555 as first three, or second three chars indicate a phone company number or a fake number
	 *		fail on these and return entire number
	 * if anything illegal is found, loop will begin again.
	 */ for(var $i=0;$i<$val.length;$i++){
	 			if(($val.charAt(0)==1)||($val.charAt(0)==0)){
					$val = $val.substr(1,$val.length);
					$i=0;
					continue;
	 			}
	 			if((($val.substr(0,3)=="911") || ($val.substr(0,3)=="411")) && $val.length>3) {
					$val = $val.substr(3,$val.length);
					$i=0;
					continue;
	 			}
	 			if(args.restrict555){
					if($val.substr(0,3)=="555") {
						$return.error = "phone number may not start with 555"
						$return.valid = false;
						return($return);
					}
				}
	 		}
	 		$return.empty = false;

	 		/* now check the length and compare it to the allowed params
	 		 */
	 		 	/* no handling for 3 digit phone numbers currently
	 		 	 */ if($val.length<7){
	 		 	 			$return.valid = false;
	 		 	 			$return.value = $val;
	 		 	 			$return.altered = ($return.origonal != $return.value);
	 		 	 			$return.error = "not enough digits";
	 		 	 		}
	 		 	/* no area code.
	 		 	 */ else if($val.length==7){
	 		 	 			$return.valid = (args.allowAreaCode!="force")
	 		 	 			if(!$return.valid){$return.error = "area code required";}
	 		 	 			$return.value = $val.substr(0,3) + dilim + $val.substr(3,$val.length);
	 		 	 			$return.altered=true;
	 		 	 		}
	 		 	/* with area code [and extention]
	 		 	 */ else if($val.length>=10){
	 		 	 			if(args.allowAreaCode=="disallow" && args.autoRemoveAreaCode){
								var newPhoneNumber = $val.substr(3);
								return(validPhone(newPhoneNumber, $args));
							} else {
								$return.valid = (args.allowAreaCode!="disallow");
								if(!$return.valid){$return.error = "area code not allowed";}

								var PreACWrap = (args.formatAreaCodeParam)?"(":"";
								var PostACWrap = (args.formatAreaCodeParam)?") ":((args.formatSpaceAfterAreaCode)?" ":dilim);
								/* get main part of phone number
								 */ $return.value = PreACWrap + $val.substr(0,3) + PostACWrap + $val.substr(3,3) + dilim + $val.substr(6,4);
								/* now check if there is an extention
								 */ if($val.length>10){
											$return.valid = (args.allowExtention!="disallow");
											if(!$return.valid){$return.error = "extention not allowed";}
											$return.value += exDilim + $val.substr(10,$val.length);
										}
								$return.altered=true;
							}
	 		 	 		} else if($val.length>7 && $val.length<10){
	 		 	 			$return.valid = false;
	 		 	 			$return.value = $val;
	 		 	 			$return.altered = ($return.origonal != $return.value);
	 		 	 			$return.error = "not enough digits";
						}
		$return.altered = ($return.origonal != $return.value);
	 	return($return)
	} catch(e) {
		trace("common.js->326->"+ e.message);
	}
}

/** @funciton getTextNumbers
* @purpose :: takes an alpha'd phone number and returns the number equiv
* @author :: Scott McDonald
* @param :: $val as string
* @returns :: string
* @created :: Monday, October 06, 2008
*/
window.convertAlphaPhoneToNumber = function(__val){
	__val = __val.toLowerCase();
	var __r = ""
	var mask = { a:2, b:2, c:2, d:3,e:3,f:3,g:4,h:4,i:4, j:5,k:5,l:5, m:6,n:6,o:6, p:7,q:7,r:7,s:7, t:8,u:8,v:8, w:9,x:9,y:9,z:9 }
	var i = 0;
	var l = __val.length;
	var v = __val.split("");
	for(i;i<l;i++){
		__r += (mask[v[i]])?(mask[v[i]]):v[i];
	}
	return(__r);
}
/** end function **/


/** @function : numOnly
 * @purpose :  remove anything but numbers from the field
 * @author : Scott McDonald
 * @version : 2.1
 * @param : $val : number to parse, as string
 * @param : $add : non numeric values to allow as string
 * @param : $args : additional params can be passed with the args object
 * 	@argparam : returnNoneNumeric : returns none numeric portion if set to true
 * 	@argparam :  default : set return value if $val is empty
 * @return cleaned value as string
 * @revision Wednesday, January 18, 2006 - added support for default value if return string is null - changed third argument  to "args" peram to allow for future additions
 * @revision Friday, May 02, 2003 - added support for non numaric return (ie: make function do opposite of designed task)
 */
	function numOnly($val,$add,$args){ // returns string stripped of any none number
		var $returnNoneNumeric = (argVal($args,"returnNoneNumeric")=="true")?true:false;
		var $default = (argVal($args,"default"));

		// $add = any charictors to add to the list.
		if(!$add){$add="";} // if the $add variable is NULL then give it an empty string
		if($val){ // if there is a value...
			var $allowList = "1234567890"+$add; // define the list of allowable chars. 0-9 and any other chars that's been passed
			for(var $i=0;$i < $val.length;$i++){ // loop from char(0) in the string to the last char
				var $g = $val.charAt($i); // get the value of the current char

				if((!$returnNoneNumeric && $allowList.indexOf($g)==-1) || ($returnNoneNumeric && $allowList.indexOf($g)!=-1)){  // if the current char is not found in allowable list then ...
					$val = $val.replace($g,""); // remove all insences of the offending charictor
					$i=-1; // reset the counter to -1
				} // end if

			} // loop
		} // end if
		// check to see if there is a default value, if so, and $val == "" then insert the default value;
		if($default&&$val==""){$val = $default;}
		return $val;
	} // end function


/** @function : 	argVal
 * @purpose: used to split a string list of arguments seperated by | and return the
 		one corrisponding with the passed dilimiter (dilim)
 * @param : $arglist : list of arguments in "var=val|var=val|var=val" format as string
 * @param : $dilim : val currently looking for as string
 * @return : string value attached to the dilim variable
 * @usage :
 		argList = "one=1|two=2|three=3"
 		response.write argValue(argList,"two") // 2
 * @author : Scott McDonald
 * @version : 1.1
 * @revistion: Thursday, September 18, 2003 - unknown
 */

function argVal($argList,$dilim){
	var $theList, $thisArg, $thisDilim, $i;
	/* first check to see if the arglist is in an array or a string. if it is an array,
	 *then pass it on to the array  version of this function, otherwise continue
	 */ if( typeof($argList)=="object"){
	 			/* make sure not empty, if so, return nothing
	 			*/ if($argList.length<=0){return;}
	 			return argListFromArray($argList,$dilim);
	 		}

	/* remove leading and trailing spacing, as these would keep
	 * anything after the spaces from being seen
	 */ $argList = _trim($argList);

	/* if the arglist is empty exit function
	 */ if($argList == "") return;

	/* remove any extra spacing in the arg list, there should only be no spaces between
	 * items in the list. without this line, leading spaces on val names could prevent the item
	 * from being found
	 */ try { $argList = $argList.replace("| ","|"); } catch(e){return;}

 	/* split the argList into an array on " " which should be seperating each var=val par
 	 */ try {$theList = $argList.split("|");  } catch(e){return;}

	/* loop through the resulting array if there is a uBound value > 0
	 */ for($i=0;$i<$theList.length;$i++){
	 			$theList[$i] = $theList[$i].split("=");
	 		}
	return argListFromArray($theList,$dilim);
}


/** @function argListFromArray
 * @purpose : itinerates through argList array object looking for a spacific dilimiter to
 *	and returns the value associated with it
 * @param : $arrArgs : argument pares to search through as array
 * @param : $dilim : value name as string
 * @return : string
 * @author : Scott McDonald
 */	function argListFromArray($arrArgs, $dilim){
			if(typeof($arrArgs)!="object") return "";
			if(!$arrArgs.length) return "";
			for(var $i=0;$i<$arrArgs.length;$i++){
				$thisArg = $arrArgs[$i]
				if($thisArg[0] == $dilim){ return $thisArg[1] }
			}
			return "";
		} /**@function argListFromArray **/

/** @function _trim
 * @purpose : removes leading and trailing spaces from string
 * @param : $string as string
 * @return : string
 * @author : Scott McDonald
 * @note : sets String object prototype String.trim
 */ function _trim($string){

			if($string==undefined) return "";
			try{
					while($string.charAt(0)==" "){$string = $string.substr(1);}
					while($string.charAt($string.length-1)==" "){$string = $string.substr(0,$string.length-1);}
			} catch(e){}
			return($string);
		}

String.prototype.trim = function(){return(_trim(this));}

function emptyFunction(o){
	return(o=="function(){}");
}

function tCase(value){
	// lowercase the entire string
	value = value.toLowerCase();
	var i = 0;
	var t = 0;

	var WORDS = value.split(" ")
	var dilim = Array("-","'","\"",".");
	var _word = 0
	for(_word=0;_word<WORDS.length;_word++){
		word = WORDS[_word];
		for(t=0;t<dilim.length;t++){
			i = 0;
			var arr = word.split(dilim[t]);
			for(i;i<arr.length;i++){
				if(dilim[t]=="'" && arr.length>1 && (i == arr.length-1 && arr[i].length==1)){
					// in this loop, do nothing
				} else {
					arr[i] = replaceAt(arr[i], 0, arr[i].charAt(0).toUpperCase());
				}
			}
			word = arr.join(dilim[t]);
			WORDS[_word] = word;
		}
	}
	return(WORDS.join(" "));
} String.prototype.tCase = function(){return(tCase(this));}


function replaceAt(s, n, t){
	var a, b, c
	a = s.substring(0, n);
	b = t
	c = s.substring(n+1)
	return(a + b + c);
}

/** @function ssubstr (search sub string)
 * @purpose : returns a substring of a string between two given string points
 * @param : sString : string to search as string
 * @param : sStart : start search string as string
 * @param : sEnd : end seach string as string
 * @return : found substring as string
 * @author : Scott McDonald
 * @created : Wednesday, February 21, 2007
 * @version : 1.0
 */ function ssubstr(sString, sStart, sEnd){
			var sPos = sString.indexOf(sStart);
			var ePos = -1;
			if(sPos!=-1){
				var ePos = sString.indexOf(sEnd,sPos);
				sPos += sStart.length;
				if(ePos==-1){ePos = sString.length;}
			}
			if(ePos!=-1){
				return(sString.substr(sPos, ePos-sPos));
			} else {
				return("");
			}
		} /** @function ssubstr **/




/** @function: validEmail/isEmail
 * @purpose: looks at the given email address and ditermins if it is valid.
 * @param $val : email value to validate
 * @param #args : for later use
 * @return boolean
 * @author Scott McDonald
 */
 	function isEmail($val){return(evalEmail($val).valid);}
 	function validEmail($val){return(evalEmail($val).valid);}
	function evalEmail($val){ // check to see if email address is valid
		var $return = new Object()
		$return.valid = false;
		$return.value = $val;
		$return.error = "";

		// set up a list of valid chars for an email address.. if it's not on this list, it's not valid.
		var $validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-._0123456789@";
		if($val.length == 0){
			$return.error = "Email Address is Empty";
			return($return);
		} // if the email address is empty, return false.

		var $thisChar=0
		// first ensure that there are only valid charictors in the string
		for($thisChar=0;$thisChar<=$val.length;$thisChar++){ // loop through each char of the string
			if($validChars.indexOf($val.charAt($thisChar))=="-1") {
				$return.error = "Address Contains Invalid Characters";
				return($return);
			} // if it's got illegal chars exit false
		} // loop

		var $arrEmail = $val.split("@"); // split the string into an array, at the @ symble
		if($arrEmail.length==2){ // if the array has 2 parts then we're good, keep going
			if(($arrEmail[0].length==0)||($arrEmail[1].length==0)){
				$return.error = "Email address must have something on each side of the @";
				return($return);
			} // if either part of the address is empty then return [exit] false
			var $name = $arrEmail[0].split("."); // split the name part on it's .'s
			for(var $name_i=0;$name_i<$name.length;$name_i++){ // cycle through each part of the name
				if($name[$name_i].length==0){ // if it's empty (meaning there was a . at the beginning which isn't valid) then exit false
					$return.error = "Email Address Has a '.' Out Of Place";
					return($return);
				}
			} // loop

			var $dom = $arrEmail[1].split("."); // split the domain on it's .'s
			if($dom.length==1){ // if there is only one index in the array, then there are no dots in the domain.. which means it's invalid
				$return.error = "Email Address Has an Invalid Domain Name";
				return($return);
			} else { // has length, check the chars
				for(var $dom_i=0;$dom_i<$dom.length;$dom_i++){ // loop through the different parts of the domain
					if($dom[$dom_i].length==0){ // if any part is 0 length, then...
						$return.error = "Email Address Domain Name Has A '.' Out Of Place";
						return($return);
					}
				} // loop
			} // end if
		} else { // length of email address split on @ is ! 2... where means there are more then one @'s
			$return.error = "Email Address Must Be \"name@domain.com\" Format";
			return($return);
		} // end if
		$return.valid = true;
		return($return);
	} // end function


function alphaOnly($val,$add,args){
	if(!args){args = new Object();}
	if(!args.returnNonAlpha){args.returnNonAlpha = false;}

	$add = (!$add)?"":$add;
	if($val){
		var $allowList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"+$add;
		var $a, $z, $g;
		var goodloop = false;
		for(var $i=0;$i < $val.length;$i++){
			$g = $val.charAt($i);
			if(args.returnNonAlpha==true){
				goodloop = ($allowList.indexOf($g)==-1);
			} else {
				goodloop = ($allowList.indexOf($g)!=-1);
			}
			if(!goodloop){
				$a = $val.substring(0,$i);
				$z = $val.substring($i+1,$val.length);
				$val = "" + $a + "" + $z;
				$i=-1;
			}
		}
	}
	return $val;
}

function stripExtraSpaces($val){
	while($val.indexOf("  ")!=-1){$val = $val.replace("  "," ");}
	return($val);
}

window.markitColor = "#FFFFCC";
function markit(oObj, bError){
	try {
		if(typeof(oObj)=="string"){oObj = document.getElementById(oObj);}
		if(oObj){
			if(oObj.length && oObj.type!="select-one"){
				var i
				for(i=0;i<oObj.length;i++){
					if(typeof(oObj[i])=="object"){
						oObj[i].style.background = ((bError)?window.markitColor:"");
						markit(oObj[i].name,bError);
					}
				}
			} else {
				try {
					oObj.style.backgroundColor = ((bError)?window.markitColor:"");
				} catch(e) {}
			}
		}
	} catch(e){}
}

function markIt($obj,$error){try {markit($obj, $error)} catch(e) {}}

/*
******************************************************************
	FUNCTION:		throwStyle
	PURPOSE: 			Sends new value, to a style of an object
	AUTHOR:			Scott McDonald
	VERSION: 			1.0
	LAST EDIT:		Friday, July 19, 2002
	RETURNS:			none
	ARGUMENTS:
		throwTo: 			Object to send style value to.
		throwAt:			Name of style that will be changed.
		throwWhat:		Value to send to style.

	EXAMPLE OF USE:
		throwStyle("divLayer","visibility","hide");
*******************************************************************
*/
	function throwStyle(throwTo,throwAt,throwWhat,$index){
		$index = ($index>=0)?$index:-1;
		// If browser is IE set up document.all to work without locating object
		if (!document.all&&document.getElementById){document.all = document.getElementsByTagName("*")}
		// setting up location for NN
		if(document.layers) throwObj = ($index>=0)?document.layers[throwTo][$index]:document.layers[throwTo];
		// setting up location for IE
		if(document.all) throwObj = ($index>=0)?document.all[throwTo][$index].style:document.all[throwTo].style;
		// send value to the objects style

		if(throwObj==undefined){
			throwObj = MM_findObj(throwTo);
		}
		try {
			throwObj[throwAt]=throwWhat;
		} catch(e){}
	}


	function setRadio($obj,$value){return(selectRadio($obj,$value));}
	function selectRadio($obj, $value){
		if(typeof($obj)=="string"){$obj=getElem($obj);}
		// since radio's created using createElement don't loop so well, we're going to
		// grab the form.radio from the radio object... it's silly, but it works
		if(!$obj.form){
			$obj = getElem($obj.id);
		}
		if(!$obj){
			trace("Element not found on page, be sure that it is loaded before attempting to set");
			return;
		}
		try {
			if($obj){
				if(!$obj.length){
					/** go from the base of the document to make sure that
					* you get a true object. radios are very picky that way
					*/ $obj = document.forms[$obj.form.id].elements[$obj.id];
				}
				try {
					if($obj.length!=undefined){
						for(var $i=0;$i<$obj.length;$i++){
							if($obj[$i].value==$value){
								$obj[$i].click();
								return(true);
							}
						}
					} else if($obj.type=="radio"){
						// there is only one element in this radio set
						if($obj.value==$value){
							$obj.click();
							return(true);
						};
					};
				} catch(e){Catch("/js/common.js->selectRadio(1)",e,true);}
			};
		} catch(e){Catch("/js/common.js->selectRadio(0)",e,true);}
		return(false);
	};

	function selectedRadio($obj){
		try {
			if($obj){
				if(!$obj.length){
					$obj = $obj.form[$obj.id]
				}
				if($obj.length!=undefined){
					for(var $i=0;$i<$obj.length;$i++){
						if($obj[$i].checked){
							return $i;
						};
					};
				} else if($obj.type=="radio"){
					return(0)
				}
			};
		} catch(e){Catch("/inc/js/common.js->selectRadio", e,true);}
		return(-1);
	}

	function radiovalue($obj){return(selectedRadio($obj));}
	function radioValue($obj){return(selectedRadio($obj));}

/*
	******************************************************************
		FUNCTION:		isZip
		PURPOSE: 			checks $val to see if it's a valid zip code.
		AUTHOR:			Scott McDonald
		VERSION: 			1.0
		LAST EDIT:		Monday, July 22, 2002
		RETURNS:			bool
		ARGUMENTS:
			$val string to check
	*******************************************************************
*/

function isZip($val){
	var $zip = "1234567890-";
	for(var $i=1;$i < $val.length;$i++){
		var $g = $val.charAt($i);
		if($zip.indexOf($g) == -1){return false}
	}
	if ($val.length < 5 && $val.length > 0){
		return false;
	} else if ($val.length > 5 && $val.charAt(5) != "-"){
		return false;
	}
	return (true);
}

	/*
	******************************************************************
		FUNCTION:		showHide
		PURPOSE: 			makes a layer visible or invisible
		AUTHOR:			Scott McDonald
		VERSION: 			1.0
		LAST EDIT:		Friday, July 19, 2002
		RETURNS:			none
		ARGUMENTS:
			obj: 			layer name
			objDir:
				1 = force visible
				2 = force invisible
				0 = toggle vis/invis

		EXAMPLE OF USE:
			showHide("divLayer",1);
	*******************************************************************
*/

function showHide(obj,objDir) {
	var flipObj;
	if (!document.all&&document.getElementById){document.all = document.getElementsByTagName("*")}
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	objArray = obj.split(",");
	if (ns4){_hide="hide";_visible="show"}else{_hide="hidden";_visible="visible"}
	for (var i = 0; i < objArray.length; ++i){
		if(ns4){flipObj = document.layers[objArray[i]];}
		if(ie4){
			try {flipObj = document.all[objArray[i]].style;}
			catch(e){}
		}
		if(flipObj==undefined) {
			alert("Can not find object " + objArray[i]);
			continue;
		}

		if(objDir==0) {
			flipObj.visibility=_hide
		} else if(objDir==1){
			flipObj.visibility=_visible
		} else {
			flipObj.visibility==_hide? flipObj.visibility=_visible:flipObj.visibility=_hide;
		}
	}
}

function MaskEmail(domainName, AddressName, label, style){
	return(' <a href="mailto:' + AddressName + "@" + domainName + '" ' + ((style)?'style="' + style + '" ':'') + ' >' + ((label==undefined)?AddressName + "@" + domainName:label) + '</a>');
} function emailLink(a,b,c){return(MaskEmail(a,b,c));}

function MailTo(domainName, addressName, subject){
	document.location = "mailto:" + addressName + "@" + domainName + ((subject)?"?subject=" + subject:"");
}

function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function setCookie (name, value, oneyear) {

  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;

  nd = new Date();
  nd.setTime (nd.getTime()+(365*24*60*60*1000));

  var expires = (!oneyear) ? null : nd;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 4) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain));
}

function DeleteCookie(name){
	exp=new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = getCookie ("name");
	document.cookie = name + "=" + cval +"; expires=" + exp.toGMTString();
}

function dollar(val){
	var r = "$" + Float(val,2);
	if(r.indexOf(".")==-1){r += ".00";}
	else if(r.indexOf(".")==r.length-2){r += "0";}
	return(r);
}

function Float(val, to){
	val = val/1
	if(to==undefined){to=2};
	return(Math.round(val*Math.pow(10,to))/Math.pow(10,to));
}

Math.float = function(to){
	return(Float(this, to))
}

function QueryString(Dilim,URL){
	var u = ((URL==undefined)?document.location:URL).toString();
	try {
		q = u.split("?");
		if(q.length>1){q = q[1];} else {return("");}
		if(Dilim==undefined){return(q);}
		var vp = q.split("&");
		for(t in vp){
			if(typeof(vp[t])!="function"){
				var s = vp[t].split("=");
				if(s.length==2){
					if(s[0]==Dilim){
						return(s[1]);
					}
				}
			}
		}
		return("")
	} catch(e){ Catch("common.js->880->",e,true);}
}

function SendAjaxMail(to,from,title,body,callback,message){
	try {
		var ajax = new Ajax();
		ajax.method = "post";
		ajax.add("to",to);
		ajax.add("from",from);
		ajax.add("title",title);
		ajax.add("body",body);
		ajax.message = (message)?message:"";
		ajax.url = "/inc/ajaxMethods/Method.AjaxEmail.Asp";
		ajax.debug=true;
		ajax.onSuccess = function(x,t){
			try{
				if(callback){
					callback(this.message);
				}
			} catch(e){
				alert(e.message);
			}
		}
		ajax.onFailed = function(){
			trace("failed");
		}
		try {ajax.send();} catch(e){trace("SendAjaxMail:" + e.message)}
	} catch(e) {
		trace("common.js->SendAjaxMail([" + to + "],[" + from + "],[" + title + "],[" + body + "],[" + callback.toString() + "])->" + e.description);
	}
}

function reportEmailError(info,message){
	try {
		SendAjaxMail("webmaster@lowen.com","website@lowen.com","Error Report isLocal:" + (document.location.toString().toLowerCase().indexOf("dev")!=-1),info,reportEmailAlert,message);
	} catch(e){
		trace("common.js->reportEmailError([" + info + "],[" + message + "])->" + e.description);
	}
}

function reportEmailAlert(message){
	var persists = "\nIf this problem continues, please contact our webmaster at webmaster@lowen.com."
	if(message && message!="silent"){
		alert(message + persists)
	} else if(message == undefined) {
		alert("an error occured and information has been sent to the webmaster." + persists)
	}
}

function mixedCase($string){
	/*
	the purpose of this function will be to check that the given string
	is not all in caps and not all in lower case. It will ignore any none
	alpha charictors.

	AUTHOR: Scott McDonald
	DATE: Friday, September 12, 2003
	Version: 1.0

	Ex.
	mixCase("JOHN HANCOCK") // returns: FALSE
	mixCase("JOHN 5 HANCOCK") // returns: FALSE
	mixCase("john hancock") // returns: FALSE
	mixCase("JoHn HaNcOcK") // returns: TRUE
	mixCase("John Hancock") // returns: TRUE
	*/

	if(!$string){return;} // jump out if $string has no content
	var $upper = false;
	var $lower = false;
	for(var $i=0;$i<$string.length;$i++){
		var $thisChar = $string.charCodeAt($i);
		if(($thisChar>=65)&&($thisChar<=90)) { $upper = true; }
		if(($thisChar>=97)&&($thisChar<=122)) { $lower = true; }
	}
	return (($upper)&&($lower))?true:false;
}

/*
	******************************************************************
		FUNCTION:		sCase
		PURPOSE: 			alters str $val to as close an approximet to sentence case.
										used to stip out "all caps" or odd caps.
		AUTHOR:			Scott McDonald
		VERSION: 			1.0
		LAST EDIT:		Monday, July 22, 2002
		RETURNS:			string
		ARGUMENTS:
			$val 		string value to alter
	*******************************************************************
*/

function sCase($val){
	if($val){
		var $newValue = markReturns($val,1);
		var $arrThisVal =$newValue.split(" ");
		for(var $i=0;$i<$arrThisVal.length;$i++){
			var $foundFirst = 0;
			var $thisWord = $arrThisVal[$i];
			for(var $ii=0;$ii<$thisWord.length;$ii++){
				if((legalAlpha($thisWord.charCodeAt($ii)))&&($foundFirst)){
					var $thisChar = $thisWord.charAt($ii);
					if(isCap($thisWord.charCodeAt($ii))){
						var $a = $thisWord.substring(0,$ii);
						var $b = $thisWord.substring($ii+1,$thisWord.length);
						$thisWord = $a + $thisChar.toLowerCase() + $b;
					}
				} else if((legalAlpha($thisWord.charCodeAt($ii)))&&(!$foundFirst)) {
					$foundFirst = 1;
				}
			}
			if($thisWord != $arrThisVal[$i]){
				 $arrThisVal[$i] = $thisWord;
			}
		}
		$newString = markReturns($arrThisVal.join(" "),0);
		if ($newString != $val){
			return $newString;
		}
	}
	return $val;
}

function imgWindow($src,$title,$width,$height,$owidth,$oheight,$args){

	$owidth = ($owidth>0)?$owidth:$width;
	$oheight = ($oheight>0)?$oheight:$height;
	$imgWindow = openWindow($title,$width,$height);

	try{if($args.header){$imgWindow.document.write($args.header);}}catch(e){}
	if($src.toLowerCase().indexOf(".swf")!=-1){
		$imgWindow.document.write("<object ");
		$imgWindow.document.write("classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ");
		$imgWindow.document.write("codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ");
		$imgWindow.document.write("id=\"imgWindowSWF\" ");
		$imgWindow.document.write("align=\"middle\" ");
		if($owidth>0) $imgWindow.document.write("width=\""+$owidth+"\" ");
		if($oheight>0) $imgWindow.document.write("height=\""+$oheight+"\"");
		$imgWindow.document.write(">");
		$imgWindow.document.write("<param name=\"allowScriptAccess\" value=\"always\" />");
		$imgWindow.document.write("<param name=\"movie\" value=\"" + $src + "\" />");
		$imgWindow.document.write("<param name=\"quality\" value=\"high\" />");
		$imgWindow.document.write("<param name=\"bgcolor\" value=\"#ffffff\" />");
		$imgWindow.document.write("<embed ");
		$imgWindow.document.write("src=\"" + $src + "\"");
		$imgWindow.document.write("quality=\"high\" ");
		$imgWindow.document.write("bgcolor=\"#ffffff\" ");
		$imgWindow.document.write("name=\"imgWindowSWF\" ");
		$imgWindow.document.write("align=\"middle\"");
		$imgWindow.document.write("allowScriptAccess=\"always\" ");
		$imgWindow.document.write("type=\"application/x-shockwave-flash\" ");
		$imgWindow.document.write("pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
		if($owidth>0) $imgWindow.document.write("width=\""+$owidth+"\" ");
		if($oheight>0) $imgWindow.document.write("height=\""+$oheight+"\" ");
		$imgWindow.document.write("/></object>");
	} else {
		if($imgWindow){
			try{output = $imgWindow.document.getElementById("content");}catch(e){}
			if(output){try{output.innerHTML = '<a href=\"#\" onClick=\"window.close();return false;\" title=\"click to close window\"><img src=\"'+$src+'\" border=\"0\" width=\"' + (($owidth!=undefined)?$owidth:'100%') + '\"></a><br /><a href=\"#\" onClick=\"window.close();\" title=\"click to close window\" style=\"font-family:arial, helvetica; font-size:7pt;color:#000000;\">click image to close window</a>';}catch(e){}}
		}
	}
	return $imgWindow;
//  if (navigator.appName == 'Netscape') i=40;
//  if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
//  self.focus();
}

function openWindow($title,$width,$height){
	$windowName = urlString($title);
	try{$imgWindow = window.open('',$windowName,'width='+$width+',height='+$height+',resizable=yes');}catch(e){}
	try{$imgWindow.document.write('<html><style>body{padding:0px;margin:0px}</style>');}catch(e){}
	try{$imgWindow.document.write('<title>'+$title+'</title>');}catch(e){}
	try{$imgWindow.document.write('<script>window.focus();</script>');}catch(e){}
	try{$imgWindow.document.write('<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">');}catch(e){}
	try{$imgWindow.document.write('<table width=100% height=100%><tr><td align=\"center\" valign=\"middle\" id=\"content\" name=\"content\">');}catch(e){}
	try{$imgWindow.document.write('</td></tr></table></body></html>\n');}catch(e){}
	return($imgWindow);
}


/** @function urlString
	*@purpose  converts a given string into an acceptable HTTP filename
	*@param $val as string - item to convert
	*@param $add as string - added allowed charictors
	*@return string - revised string
	*@author Scott McDonald
	*@version 1.0
	*@creation Monday, July 22, 2002
	*@revision Thursday, April 12, 2007 - clean up, update, comment
	*/
		function urlString($val,$add){
			/* create list of allowed charictors
			*/ var $strAcceptList = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9";
			/* add charictors passed as argument
			 */ if($add!=""){$strAcceptList += "," + $add;}
			/* create an array of allowed charictors
			 */ var $goodArray = $strAcceptList.split(",");
			/* split the passed string into an array of charictors
			 */ var $valArray = $val.split("");
			 /* loop through the array of "passed string" and compare the value against the allowed
			  * charictor array
			  */ for(var $i=0;$i<$valArray.length;$i++){
			  			/* if the current value isn't found in the allowed array then
			  			 * remove it from the return string
			  			 */ if(!inArray($goodArray,$valArray[$i])){$valArray[$i]="";}
			  		}
			  	/* remove any trailing dot
			  	 */ if($valArray[$valArray.length-1]=="."){$valArray[$valArray.length-1]="";}
			  	 /* return string
			  	  */ return $valArray.join("");
		}

/**	@function inArray
	*	@purpose returns if passed value is found in an array object
	*	@param $array as array : array to search
	*	@param $value as variant : item to compare against
	*	@param $index as Boolean : return index of found item otherwise returns boolean found
	* @param $caseInsensitive as Boolean : indicates if string comparrison should be done case sensitive
	* @return Boolean if $index is Null or False, array index if $index is true
	* @author Scott McDonald
	*	@creation Monday, July 22, 2002
	*	@revision Thursday, April 12, 2007 - clean up, update, comment
	*/
		function inArray($array,$value,$index,$caseInsensitive){
			for(var $i=0;$i<$array.length;$i++){
				if($caseInsensitive && typeof($value)=="string" && typeof($array[$i])=="string"){
					if($array[$i].toLowerCase()==$value.toLowerCase()) {return (($index)?$i:true);}
				} else {
					if($array[$i]==$value) {return (($index)?$i:true);}
				}
			}
			return (($index)?-1:false);
		};
		Array.prototype.inArray = function($value, $index, $caseInsensitive){return(inArray(this,$value,$index,$caseInsensitive));}

	function inSelect(sel, val, onText){
		for(var o = 0 ; o < sel.length ; o++){
			if(!onText){
				if(sel.options[o].value==val){
					return(true)
				}
			} else {
				if(sel.options[o].text == val){
					return(true);
				}
			}
		}
		return(false);
	}

/*
	******************************************************************
		FUNCTION:		showProperties
		PURPOSE: 			diag function which will show all of the object properties of an element
		AUTHOR:			Scott McDonald
		VERSION: 			1.0
		CREATED:		Monday, July 22, 2002
		RETURNS:			none
		ARGUMENTS:
			obj = object to list values of
		@edit :: Tuesday, February 12, 2008 - fixed bug where filterFunctions wasn't returning anything
	*******************************************************************
*/
function showProperties(obj,filterFunctions,$return,$level) {
	$obj = (typeof(obj)!="object")?$obj = MM_findObj(obj):obj;
	$level = ($level)?$level:0;

	var $result = ""
	try {
		for (var $i in $obj) {
			try{
					if(!filterFunctions || (filterFunctions && typeof($obj[$i])!="function")){
						$result += $obj.id + "." + $i + " = " + ((typeof($obj[$i])=="object")?showProperties($obj[$i], filterFunctions, true,$level+1):$obj[$i]) + "\n";
					}
			} catch(e){}
		}
	} catch(e){}

	if($return){
		return $result;
	} else {
		trace($result.split("\n").join("<br />"));
	}
}


/*
******************************************************************
	FUNCTION: trace
	PURPOSE: Creates output window and sends text to this window for tracing errors. (immulates FLASH output field)
	AUTHOR: Scott McDonald
	RETURNS: VOID
	ARGUMENTS: [String] Output Text
	CREATED: Thursday, October 20, 2005
	VERSION: 1.0
	REVISIONS:
*******************************************************************
*/
AddListener(window,"load",function(){window.loaded=true})
function trace(){
	var val = arguments
	if(!window.devlogin){return;}
	if(window.loaded!=true){
		AddListener(window,"load",function(){
			var i = 0;
			var l = val.length;
			for(i;i<l;i++){
				trace("<sup>[beforeload]</sup>" + val[i]);
			}
		});
		return;
	}

	if(!window.TraceOutputWindow){
		window.TraceOutputWindow = top.window.document.createElement("div");
		window.TraceOutputWindow.id = window.TraceOutputWindow.name = "TraceOutputWindow";
		window.TraceOutputWindow.style.position = "absolute";
		window.TraceOutputWindow.style.top = document.body.scrollTop;
		window.TraceOutputWindow.style.left = "0px";
		window.TraceOutputWindow.style.zIndex = 1000;
		window.TraceOutputWindow.style.background = "#FFFFCC";
		window.TraceOutputWindow.style.padding = "10px";
		window.TraceOutputWindow.style.border = "1px solid #000000";
		window.TraceOutputWindow.style.textAlign = "left";
		AddListener(window.TraceOutputWindow,((ie)?"ondblclick":"dblclick"), function(){window.TraceOutputWindow.parentNode.removeChild(window.TraceOutputWindow);window.TraceOutputWindow = undefined;});
		try{top.window.document.body.appendChild(window.TraceOutputWindow);} catch(e){}
		window.TraceOutputWindow.innerHTML = TraceLoop(val,0);
	} else {
		window.TraceOutputWindow.innerHTML += TraceLoop(val,0);
	}
	window.TraceOutputWindow.style.top = document.body.scrollTop;
}

function reportPlugins(){
	var o = new Array();

	if(navigator.plugins.length){
		var L = navigator.plugins.length;
		for(var i=0; i<L; i++) {
			o[o.length] = {
				name:navigator.plugins[i].name,
				description: navigator.plugins[i].description
			}
		}
	} else {
		/*
		checkForQT6 = new ActiveXObject("QuickTime.QuickTime.4")
		checkForQT5 = new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1")
		checkForReal = new ActiveXObject("rmocx.RealPlayer G2 Control.1")
		checkForAcroRead7 = new ActiveXObject("acroPDF.PDF.1")
		checkForAcroRead6 = new ActiveXObject("PDF.PdfCtrl.6")
		checkForAcroRead5 = new ActiveXObject("PDF.PdfCtrl.5")
		checkForAcroRead4 = new ActiveXObject("PDF.PdfCtrl.4")
		checkForAcroRead3 = new ActiveXObject("PDF.PdfCtrl.1")
		checkForWMP = new ActiveXObject("MediaPlayer.MediaPlayer.1")
		*/
		var CheckFlash;
		try {
			/* Flash 10 */ CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.1");
		} catch(e){
			try {
				CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			} catch(e){
				try {
					CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				} catch(e){
					try {
						CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.5");
					} catch(e){
						try {
							CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.4");
						} catch(e){
							try {
								CheckFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3")
							} catch(e){
								try {
									CheckFlash = new ActiveXObject("SWCt1.SWCt1.9")
								} catch(e){
									try {
										CheckFlash = new ActiveXObject("SWCt1.SWCt1.8")
									} catch(e){
										try {
											CheckFlash = new ActiveXObject("SWCt1.SWCt1.7")
										} catch(e){
											try {
												CheckFlash = new ActiveXObject("SWCt1.SWCt1.1")
											} catch(e){}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		if(CheckFlash){
			o[o.length] = {
				name:"Shockwave Flash",
				description:CheckFlash.GetVariable("$version")
			}
		}
	}
	return(o);
}

/** { [lib.functions.window.Catch]
* Monday, February 11, 2008
*	calls trace using the error event object. i use this so that when i do a search for trace
*	it doesn't come up with catch messages i want to keep
* @dependency :: [lib.functions.window.reportEmailError]
* @dependency :: [lib.functions.window.reportPlugins]
* @dependency :: [lib.functions.window.trace]
*/
function Catch(text,e,report,callback){
	try {
		/* check all dependencies
		*/
		var message = "";
 		message += "<ul>Environment";
 		message += "<li><b>navigator.appName</b>: " + navigator.appName;
 		message += "<li><b>navigator.appVersion</b>: " + navigator.appVersion;
 		message += "<li><b>navigator.userAgent</b>: " + navigator.userAgent;
 		message += "<li><b>navigator.platform</b>: " + navigator.platform;
 		message += "<li><b>Screen Height</b>: " + screen.height;
 		message += "<li><b>width</b>" + screen.width;
 		message += "<li><b>hascookies</b>:" + (navigator.cookieEnabled==true);
 		message += "<li><b>Host Address</b>:" + window.remote_addr;
 		var o = reportPlugins();
 		if(o.length>0){
			for(var me in o){
				if(typeof(o[me])=="object"){
					message += "<li><b>" + o[me].name + "</b>:" + o[me].description;
				}
			}
		};
		message += "</ul>";
		if(window.devlogin){
			trace(text + " // " + e.message);
			if(callback){
				callback();
			}
		} else if(report){
			reportEmailError("Passed Error: " + text + "<br />Catch.Event.Message: " + e.message + "<br />Calling Page: " + document.location.toString() + "<br/>" + message, "silent");
			if(callback){
				callback();
			}
		}
	} catch(e){trace("Call to Catch Failed: Message: " + message);}
	return(true);
}
/** } [lib.functions.window.Catch] **/


function TraceLoop(Items, iLoopDepth){
	var r = "";
	var thisItem;
	for(i=0;i<Items.length;i++){
		thisItem = Items[i];
		r += "• " + thisItem + "<br />";
	}
	return(r);
}

function StringToHTML(STRING){
	return( replaceall( replaceall( replaceall(STRING, " ", "&nbsp;") , "\n","<br/>") , "\t","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
}

function EncodeHTML(HTML){
	return(replaceall(replaceall(HTML,">","&gt;"),"<","&lt;"));
}

var BREAKER = 0;


function getPepper(url){
	if(url){
			return(url + ((url.indexOf("?")==-1)?"?":"&") + "pepper=" + getPepper())
	} else {
		var d = new Date();
		return(d + "|" + d.getMilliseconds());
	}
}

// Friday, January 11, 2008
function removePepper(q, dilim){
	// split the string
	dilim = (dilim)?dilim:"pepper";
	var arr = q.split("?");
	var base = arr[0]
	arr[0]=null;
	var query = arr.join("\n");
	arr = query.split("&");
	query = arr.join("\n");
	arr = query.split("\n");
	var i=0;
	var l=arr.length;
	for(i;i<l;i++){
		if(arr[i].toLowerCase().indexOf(dilim)!=-1 || arr[i]==""){
			arr[i]=null;
		}
	}
	query = "";
	var clean = new Array()
	for(i=0;i<arr.length;i++){
		if(arr[i]!=null){
			query+=((query=="")?"?":"&")
			query += arr[i];
		}
	}
	return(base + query)
}
// Friday, January 11, 2008
function ReloadScript(url){
	if(url.indexOf("http://")==-1){url = "http://" + document.location.toString().split("/")[2] + url;}
	var head = document.getElementsByTagName("head")
	var scripts = document.getElementsByTagName("script");
	var newscript = document.createElement("script");
	newscript.src = getPepper(removePepper(url));;
	newscript.type = "text/javascript";
	newscript.defer = false;
	var i, l, thisurl;
	if(head){
		l = scripts.length;
		if(l>0){
			for(i=0;i<l;i++){
				try {
					thisurl = removePepper(scripts[i].src);

					if(thisurl.indexOf("http://")==-1){thisurl = "http://" + document.location.toString().split("/")[2] + thisurl;}
					if(thisurl.toLowerCase()==url.toLowerCase()){
						scripts[i].parentNode.removeChild(scripts[i]);
					}
				} catch(e){}
			}
		}
		head[0].appendChild(newscript);
	}
}

function LoadScript(src){
	// if there are any odd errors, start by making sure the URL exists...
	try {
		var heads = document.getElementsByTagName("head");
		var scriptFile = document.createElement("script");
		scriptFile.type = "text/javascript";
		scriptFile.src = src;
		heads[0].appendChild(scriptFile);
	} catch(e){Catch("inc/common.js->LoadScript",e);}
}

// Friday, January 11, 2008
function ReloadScripts(){ // fix to work with FireFox - using reload script on each loop
	var e = document.getElementsByTagName("script");
	var i = 0;
	var l = e.length;
	var me;
	var url;
	for(i;i<l;i++){
		me = e[i];
		if(me){
			ReloadScript(me.src);
		}
	}
}

window.width = function(){
	if(window.innerWidth!=undefined){
		return(window.innerWidth);
	} else if(document.body && document.body.clientWidth!=undefined){
		return(document.body.clientWidth);
	} else if(document.documentElement && document.documentElement.clientWidth != undefined){
		return(document.documentElement.clientWidth);
	} else {
		return(null);
	}
}

window.height = function(){
	if(window.innerHeight!=undefined){
		return(window.innerHeight);
	} else if(document.body && document.body.clientHeight!=undefined){
		return(document.body.clientHeight);
	} else if(document.documentElement && document.documentElement.clientHeight != undefined){
		return(document.documentElement.clientHeight);
	} else {
		return(null);
	}
}

/** { [lib.functions.window.getVal]
* @dependency :: [lib.functions.window.Catch]
**/
function getVal(me){
	try {
		var typename = "lib.functions.window.getVal";
		if(typeof(me)=="object"){
			/*
			* hopefully we're looking at a form element. if so
			* we should be able to ask what type it is, and get the value from there.
			*/
			switch(me.type){
				case("text"):{return(me.value);break;}
				case("select-one"):{return(me[me.selectedIndex].value);break;}
				case("select-multiple"):{
					var r = new Array();
					for(i=0;i<me.length;i++){
						if(me[i].selected){r[r.length]=me[i].value;}
					}
					return(r.join(","));
					break;
				}
				case("hidden"):{return(me.value);break;}
				case("checkbox"):{return(me.checked);break;}
				case("textarea"):{return(me.value);break;}
				default:{
						Catch(
							typename, {
								message:" GetVal not set to handle type: " + me.type + " yet. nows a good time to make it work though."
							},
							true
						);
						break;
					}
				}
			};
		} catch(e){ Catch(typename,e,true);};
	};
/** } [lib.functions.window.getVal] **/



function moveLayer(strLayerName, intX, intY){
		throwStyle(strLayerName,"top",intY);
		throwStyle(strLayerName,"left",intX);
		return;
	}

Object.prototype.clone = function(){
	var me;
	var o = new Object();
	try{
		for(me in this){
			if(typeof(this[me])!="function" && typeof(this[me])!="object"){
				o[me]=this[me];
			} else if(typeof(this[me])=="object" && this[me]!=this){
				o[me]=this[me].clone();
			}
		}
	} catch(e){Catch("Object.prototype.clone",e,true);}
	return(o)
}

	Object.prototype.isArray = function(){
		return(this.length!=undefined);
	}

		function createInputList(LIST){
			if(!LIST.isArray()){return(document.createTextNode("Invalid Input"));}
			var events = new Array("onclick","onmouseover","onmouseout","onblur","onkeydown","onkeyup","onkeypress","onfocus");

			var i = 0
			var l = LIST.length;

				var table = setElem("table");
				table.id = LIST[i].type + "_" + LIST[i].name + "LabelTable";
				table.border=0;
				table.style.borderSpacing = "0";
				table.style.borderCollapse = "collapse";

				table.body = setElem("tbody");
				table.body.id = table.id + "Body";
				table.appendChild(table.body);
				for(i;i<l;i++){
					if(LIST[i].stacked==true || i == 0){
						table.body.row = setElem("tr");
						table.body.row.id = table.body.id + "Row";
						table.body.appendChild(table.body.row);
					}
					table.label = setElem("td");
					table.label.id = table.body.row.id + "ColLabel";
					table.body.row.appendChild(table.label);
					table.label.innerHTML = LIST[i].label;

					table.body.row.tdSpacer = setElem("td");
					table.body.row.tdSpacer.id = table.body.row.id + "ColSpacer";
					table.body.row.appendChild(table.body.row.tdSpacer);
					table.body.row.tdSpacer.innerHTML = "&nbsp;";

					table.tdInput = setElem("td");
					if(LIST[i].stacked) table.tdInput.width = "90%";
					table.tdInput.id = table.body.row.id + "ColInput";
					table.body.row.appendChild(table.tdInput);
					var elem = undefined;
					if(ie){
						try {
							elem = document.createElement("<input type=" + LIST[i].type + " name=" + LIST[i].id + " id=" + LIST[i].id + ">")
							if(LIST[i].disabled==true) elem.disabled = true;
							for(var ii=0;ii<events.length;ii++){
								if(LIST[i][events[ii]]!=undefined){elem[events[ii]]=LIST[i][events[ii]]}
							}

						} catch(e){
							trace("common.js->1253->input type=" + LIST[i].type + " name=" + LIST[i].id + " id=" + LIST[i].id + "" + e.description);
						}
					} else {
						try {
							elem = document.createElement("input")
							elem.name = elem.id = LIST[i].id;
							elem.type =  LIST[i].type;
						} catch(e){
							trace("common.js->1519->"+ e.message);
						}
					}
					elem.value = LIST[i].value
					table.input = elem;
					table.tdInput.appendChild(table.input);
				}
				return(table);
	}



	function createInput(type,name,label,args){
		if(args==undefined){
			args = new Object();
		}
		args.checked = (args.checked==true)
		args.selected = (args.selected==true)
		var elem = undefined;
		if(ie){
			try {
				if(type=="textarea"){
					elem = document.createElement("<textarea name=" + name + " id=" + name + " rows=1 cols=1></textarea>")
				} else {
					elem = document.createElement("<input type=" + type + " name=" + name + " id=" + name + " " + ((args.checked)?"checked":"") + ">")
				}
			} catch(e){
				trace("common.js->1253->input type=" + type + " name=" + name + " id=" + name + "" + e.description);
			}
		} else {
			try {
				if(type=="textarea"){
					elem = document.createElement("textarea")
					elem.rows = 1;
					elem.cols = 1;
				} else {
					elem = document.createElement("input")
				}
				elem.name = elem.id = name;
				elem.type = type;
			} catch(e){
				trace("common.js->1545->"+ e.message);
			}
		}
		if(!label || type=="hidden"){
			return(elem);
		} else {
			var table = setElem("table");
			table.id = type + "_" + name + "LabelTable";
			table.border=0
			table.width = "100%";
			table.style.borderSpacing = 0;
			table.style.borderCollapse = "collapse";

			table.body = setElem("tbody");
			table.body.id = table.id + "Body";
			table.appendChild(table.body);

			table.body.row = setElem("tr");
			table.body.row.id = table.body.id + "Row";
			table.body.appendChild(table.body.row);

			table.label = setElem("td");
			table.label.id = table.body.row.id + "ColLabel";
			table.body.row.appendChild(table.label);
			table.label.innerHTML = label;

			table.body.row.tdSpacer = setElem("td");
			table.body.row.tdSpacer.id = table.body.row.id + "ColSpacer";
			table.body.row.appendChild(table.body.row.tdSpacer);
			table.body.row.tdSpacer.innerHTML = "&nbsp;";

			table.tdInput = setElem("td");
			table.tdInput.width = "90%";
			table.tdInput.id = table.body.row.id + "ColInput";
			table.body.row.appendChild(table.tdInput);
			table.input = elem
			table.tdInput.appendChild(table.input);
			return(table);
		}
	}

function alterCSSClass(className, Style, NewVal){
	var theClass = getCSSClass(className);
	if(theClass){
		try{
			theClass.style[Style] = NewVal;
		} catch(e){}
	}
}

function getCSSClass(className){
	// Note: if style change is not working, try sending "" as default.

	/* first get the keyword for accessing stylesheets
	 * which is cssRules if not IE and rules if IE
	 */ var Rules = ((document.all)?"rules":"cssRules");
	/* now loop through each of the attached stylesheets
	 * looking at all of it's classes until the class is found
	 */
	var i=0, ii=0;
	var sheet;
	var sheets = document.styleSheets;
	var thisclass;
	for(;i<sheets.length;i++){
		sheet = sheets[i][Rules];
		for(;ii<sheet.length;ii++){
			if(sheet[ii].selectorText==className){
				return(sheet[ii]);
			}
		}
	}
}

function getCSSClassValue(className,style){
	var theClass = getCSSClass(className);
	if(theClass){
		try{
			return(theClass.style[style])
		} catch(e){}
	}
}

function DecodeToHtml(text){
	text = replaceall(text,"\n","<br/>");
	return(text);
}


/** { [lib.functions.window.replaceall]
* @edit :: [Friday, March 20, 2009] fixed logic where it would remove the last item in the string before returning
**/
function replaceall(_string, _what, _with) {
	var typename = "lib.functions.window.replaceall";
	try {
		if (!_string) return;
		var $string = new String(_string);
		var $what = new String(_what);
		var $with = new String(_with);
		while ($string.indexOf($what) != -1) {
			$string = $string.replace($what, $with);
		}
		return ($string);
	} catch (e) { Catch(typename, e, true); };
};
/** } [lib.functions.window.replaceall] **/


	String.prototype.chunk = function(partLength, reverse){
		if(this.length<=partLength){
			return(Array(this))
		} else {
			var RETURN = new Array()
			var thisVal;
			if(reverse){
				for(var i =this.length; i > 0 ; i-=partLength){
					thisVal = this.substring(i-3, i-3+partLength);
					RETURN[RETURN.length] = thisVal;
				}
				RETURN = RETURN.reverse()
				return(RETURN);
			}
		}
	}

/** { [function.window.AddListener]
* @purpose crossbrowser method to add event handlers to objects
* @param o as object - element to attach event to
* @param l as string - event to register
* @param f as function - method to call on event capture
* @param t as bool - something about trickle... it's in the mozella DOM Docs... but i havn't payed attention. it's there if needed
* @revision Wednesday, June 13, 2007 : creation
* @dependency :: [function.window.Catch]
* /---/
* @author :: Scott McDonald;
* @license :: Lowen Corporation Use Only [Proprietary Script]
* /---/
*/
function AddListener(o, l, f, t){
	if(!f){return;}
	try{
		if(o.addEventListener){ /* set for non ie */
			o.addEventListener(l,f,t);
		} else if(o.attachEvent) { /* set for ie */
			o.attachEvent(((l.substr(0,2).toLowerCase()=="on")?"":"on") + l,f);
		};
		return(true);
	} catch(e) {
		Catch("window.function.AddListener",e,true);
		return(false);
	}
	return(true);
}
/** } [function.window.AddListener] **/


// Saturday, February 02, 2008
function RemoveListener(_Object, _Listener, _Function, t){
	 		try{
				if(_Object.removeEventListener){
						// set for non ie
						_Object.removeEventListener(_Listener,_Function,t)
				} else if(_Object.detachEvent) {
						// set for ie
						success = _Object.detachEvent(((_Listener.substr(0,2).toLowerCase()=="on")?"":"on") + _Listener,_Function)
				}
				return(true);
			} catch(e) {
				return(false);
			}
	 	}

function KillGoogleColorsStart(){setTimeout("KillGoogleColors()",1000);}
function KillGoogleColors(isLooped){
	var Thing, thing, me
	for(Thing in document.forms){
		if(typeof(document.forms[Thing])=="object"){
			for(thing in document.forms[Thing].elements){
				me = document.forms[Thing].elements[thing];
				try{
						if(me.type=="text" || me.type == "select" || me.type == "select-one" || me.type == "select-multiple"){
							me.style.backgroundColor = "";
						}
				} catch(e) {}
			}
		}
	}
}


function removeChildren(o, parent){
	if(o){
		try {
			if(o.childNodes.length>0){
				try {
					for(var i = 0; i < o.childNodes.length; i++ ){
						try {
							removeChildren(o.childNodes[i], o);
						} catch(e) {}
					}
				} catch(e){}
			}
			try{
				parent.removeChild(o);
				o = undefined;
			} catch(e){}
		} catch(e){}
	}
} //Tuesday, June 19, 2007


function SetSelect(o, value){
	if(o.type=="select-one" || o.type=="select-multiple"){
		var i = 0;
		var l = o.options.length;
		for(i;i<l;i++){
			if(o.options[i].value == value){
				o.selectedIndex = i;
				try{
					o.onchange(); // trigger on change, just in case there is script for that.
				} catch(e){"common.js->1438->"+ e.message}
			}
		}
	}
} // Tuesday, June 19, 2007




function getQueryString(dilim){
	var Q = new oQueryString();
	return(Q.get(dilim));
}

function oQueryString(cQueryString){
	this.id = this.name = "oQueryString";
	if(cQueryString==undefined || cQueryString == null){
		var l = unescape(document.location.toString());
		if(l.indexOf("#")!=-1){l = l.substr(0,l.indexOf("#"))}
		var a = l.split("?");
		var q = ((a.length==2)?a[1]:"").split("&");
		this.querystring = q
	} else {
		this.querystring = cQueryString;
	}

	this.get = oQueryString_Get;
}

function oQueryString_Get(dilim){
	var t; for(var o = 0; o<this.querystring.length;o++){
		t = this.querystring[o].split("=");
		if(t[0]==dilim){return(t[1]);}
	}
	return(null)
}

// QueryString Name Value Pair Object
function Q(name, value){
	this.name = name;
	this.value = value;
}


// like insertBefore and appendChild, this method inserts AFTER a passed element
// Monday, February 11, 2008
// param target :: as object. this is the object which will receive the new node
// param value :: new node to insert
// param node :: html node to insert after

function insertAfter(target,value, node){
	try {
		if(node.nextSibling){
			target.insertBefore(value, node.nextSibling);
		} else {
			target.appendChild(value);
		}
	} catch(e) {Catch("/inc/js/common.js->insertAfter",e);}
}

function getElem(id){
	return(document.getElementById(id));
}

function addSpace(elem){
	if(elem){
		try{
			elem.appendChild(document.createTextNode(" "));
		} catch(e){}
	}
}

function setElem(elem, type){
	if(elem=="input"){
		return(createInput(type))
	} else {
		try{
			var newElem = document.createElement(elem)
		} catch(e){
			trace("common.js->1492->"+ e.message);
			showProperties(e);
		}
		return(newElem);
	}
}

	function GetElementByTagId(xml, name){
		if(xml.childNodes.length>0){
			for(var i=0;i<xml.childNodes.length;i++){
				if(xml.childNodes[i].nodeName == name){
					return(xml.childNodes[i]);
				}
			}
		}
	}


String.prototype.toXml = function(){
	return(loadXml(this));
}
function loadXml(xml){
	if (document.implementation && document.implementation.createDocument){
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = createTable;
	} else if (window.ActiveXObject) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
 	}
 	if(xmlDoc){
		xmlDoc.loadXML(xml);
		return(xmlDoc)
	}
}

function subdomain(){
	try {
		var url = document.location.toString();
		var arr = url.split("/");
		var domain = arr[2];
		return(domain.split(".")[0]);
	} catch(e){}
}


	function isChild(o,c){
		try {
			if(o.childNodes.length){
				for(var i=0;i<o.childNodes.length;i++){
					if(o.childNodes[i]==c){
						return(true);
					}
				}
			}
		} catch(e){}
		return(false);
	}



// June, 2008
// adds encoding for the plus sign when using escape function for URL... use this when
// you need to be able to pass the + in the querystring
String.prototype.escapeSpecial = function(){
	return(this.replace(new RegExp( "\\+", "g" ),"%2B"));
}

function submitSiteFeedBack(f, cSiteName, CallBack) {
	try {
		f.submitButton.value = "validating ...";
		f.submitButton.disabled = true;
	} catch (e) { }
	var r = "";
	try {r+=validateFeedBackName(f.contactName);} catch(e){}
	try {r+=validateFeebBackContactBy(f.contactBy);} catch(e){}
	try {r+=validateFeedBackComments(f.comments);} catch(e){}
	if (r == "") {
		try{
		f.submitButton.value = "sending ...";
		} catch(e){};
		var sBody = "";
		sBody += "\nName: " + f.contactName.value + "<br />";
		sBody += "\nReply By: " + f.contactBy.value + "<br />";
		sBody += "\nComments: <div style=\"padding:10px;width:500px;border:1px solid #cccccc;margin-left:20px;\">" + f.comments.value.replace(/\n/gi,"<br />") + "</div>";
		var e1 = "webmaster"
		var e2 = "lowen.com"
		var e3 = "comments"
		var e4 = "lowensign.com"
		SendAjaxMail(e1 + "@" + e2 + ((cSiteName.indexOf("lowensign.com")!=-1)?";sales@lowensign.com":""),((isEmail(f.contactBy.value))?f.contactBy.value:e3+"@"+e4),"Comments from " + cSiteName,sBody,((CallBack)?CallBack:submitSiteFeedBackSuccess));
	} else {
		alert("The form could not be submitted, please correct the following items and resend.\n\n" + r);
		f.submitButton.value = "send";
		f.submitButton.disabled = false;
	}
	return(false);
}

function submitSiteFeedBackSuccess(x,t){
	var pageContent = document.getElementById("ContactFormSection");
	if(pageContent){
		pageContent.innerHTML = "<p align=\"center\">Your comments has been sent. Thank you for your interest.</p>";
	}
}




function validateFeedBackName(o){
	try {markIt(o.name,(o.value==""))} catch(e){"common.js->1590->"+e.message}
	return((o.value=="")?"\n\t• Please enter your name":"");
};

function validateFeebBackPhone(o){
	var args = new Object();
		args.allowAreaCode = "force";
	var v = validPhone(o.value,args);
	o.value = v.value;
	try {markIt(o.name,!v.valid)} catch(e){trace("validatePhone");showProperties(e);}
	if(o.value==""){return("\n\t• Please enter your daytime phone number");}
	if(v.valid==false){return("\n\t• The entered phone number is invalid" + ((v.error!="")?": " + v.error:""));};
	return("");
}
function validateFeebBackEmail(o){
	var v = isEmail(o.value);
	try {markIt(o.name,!v)} catch(e){trace("validateEmail");showProperties(e);}
	if(o.value==""){return("\n\t• Please enter your email address");}
	if(v==false){return("\n\t• The entered email address is invalid");};
	return("");
}

/* validates either phone or email based on what the user has entered
 */ function validateFeebBackContactBy(o){
 			/* first check to see if it's empty, if so, return an error
 			 */ if(o.value==""){
 			 			markIt(o.name,true);
 			 			return("\n\t• Please enter an Email address, or Phone number");
 			 		}
 			/* check to see if it appears to be an email address
 			 * this will be done by looking for 2 basic elements which is must have
 			 * @ and .
 			 */ if(o.value.toLowerCase().indexOf("@")!=-1){
 			 			/* we're looking at an email address... validate it as such */
 			 			return(validateFeebBackEmail(o))
 			 		}
 			 /* if it doesn't resolve as an email address, check to see if it fits as a phone number
 			 */

 			 if(numOnly(o.value,"-. ()")==o.value){
				 o.value = validPhone(o.value).value;
 			 	return(validateFeebBackPhone(o));
 			 }

 			return("\n\t• The entered Phone number or Email address is unrecognizable");

		/* first check to see if it qualifies as a phone number */
		var args = new Object();
			args.allowAreaCode = "force";
		var v = validPhone(o.value,args);
		if(v.valid){
			o.value = v.value;
			return("");
		}
}

function validateFeedBackComments(o){
	markIt(o.name, o.value=="");
	return((o.value=="")?"\n\t• No comment has been entered":"");
}

function DiagArea(o, HTMLFormat, depth){
	depth = (depth)?depth:0;
	try {
		var r = ""
		if(depth==0){r += "Object{\n"}
		for(var me in o){
			if(typeof(o[me])!="function" && me != "depth"){
				trace(typeof(o[me]));
				if(typeof(o[me])=="object"){
					r += strpad(" ",((depth+1)*2),"\t",true) + "[" + me + "] {\n"
					r += DiagArea(o[me],HTMLFormat,depth+1) + "" + strpad(" ",((depth+1)*2),"\t",true);
					r+= "}\n";
				} else {
					r += strpad(" ",((depth+1)*2),"\t",true) + "[" +  me + "] {\t" +  o[me] + "\t" + "}\n";
				}
			}
		}
		if(depth==0){r+= "}"}
		return((HTMLFormat)?StringToHTML(r):r);
	} catch(e){
		trace("DiagArea Failed", e);
	}
	return("")
};

//8/17/2007:2:29 PM
function XmlToObject(o){
	var r = new O_XmlToObject(o, 0);
	return(r)
}

function O_XmlToObject(o, depth){
	this.depth = (depth==undefined)?0:depth;
	this.toString = DiagArea;
	var thisName, thisType
	try {
		try{
			if(o.nodeName=="#document"){
				o = o.childNodes[0];

			}
		} catch(e){
			return;
		}

		try {
			if(o.childNodes){
				var previousNodeName = ""
				try {
					for(var i = 0 ; i < o.childNodes.length ; i++){
						try{
							if(o.childNodes[i].nodeType==1){
								this.length = o.childNodes.length;
								try {
									if(!o.childNodes[i].firstChild){
										this["_" + o.childNodes[i].nodeName] = undefined;
									} else if(o.childNodes[i].firstChild.nodeType==3){
										try {
											this["_" + o.childNodes[i].nodeName] = o.childNodes[i].firstChild.nodeValue;
										} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
									} else {
										try {
											if(o.childNodes[i+1]){
												if(o.childNodes[i+1].nodeName==o.childNodes[i].nodeName || previousNodeName == o.childNodes[i].nodeName ){
													this[i] = new O_XmlToObject(o.childNodes[i], this.depth+1);
												}
											} else if(previousNodeName==o.childNodes[i].nodeName){
												this[i] = new O_XmlToObject(o.childNodes[i], this.depth+1);
											} else {
												this["_" + o.childNodes[i].nodeName] = new O_XmlToObject(o.childNodes[i], this.depth+1);
											}
										} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
									}
								} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
							}
						} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
					}
				} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
			}
		} catch(e){Catch("/js/common.js/O_XmlToObject()/",e);}
	} catch (e){Catch("/js/common.js/O_XmlToObject()/",e);}
}

function TimeoutRedirect(cUrl, nTime){
	if(nTime>0){
		setTimeout("TimeoutRedirect('" + cUrl + "', 0)", nTime);
	} else {
		document.location = cUrl;
	}
}

Object.prototype.toXml = function(cRoot) {
	var me, littleme
	cRoot = (cRoot) ? cRoot : "xml";
	var r = "<" + cRoot + ">"
	for (me in this) {
		if (me == "id" && r.indexOf("<" + cRoot + " id=") == -1) {
			//r = r.replace("<" + cRoot + ">", "<" + cRoot + " id=\"" + this[me] + "\">");
			continue;
		}
		if (typeof (this[me]) == "string" || typeof (this[me]) == "number") {
			r += "<" + me + ">" + this[me] + "</" + me + ">";
		} else if (typeof (this[me]) == "object") {
			if (this[me].length) { // this is an array
				r += "<" + me + ">";
				for (littleme in this[me]) {
					if (typeof (this[me][littleme]) != "function") {
						r += this[me][littleme].toXml(this[me][littleme].id);
					}
				}
				r += "</" + me + ">";
			} else { // this is an object
				r += this[me].toXml(me);
			}
		}
	}
	r += "</" + cRoot + ">"
	return (r)
}

function ifEmpty(val, elseVal, finallyVal){
	if(val!=undefined && (_trim(val)!="" || val=="0")){
		return(val)
	} else if(elseVal!=undefined && (_trim(elseVal)!="" || elseVal=="0")){
		return(elseVal);
	} else {
		return(finallyVal);
	}
}

Date.prototype.getFirstDay = function(){
	var firstDate = new Date(this.getFullYear(), this.getMonth(), 1);
	return(firstDate.getDay()+1);
}
Date.prototype.getDaysInMonth = function(){
	var oneHour = 1000*60*60;
	var oneDay = oneHour*24;
	var thisMonth = new Date(this.getFullYear(), this.getMonth(), 1);
	var nextMonth = new Date(this.getFullYear(), this.getMonth()+1, 1)
	return(Math.ceil((nextMonth.getTime()-thisMonth.getTime()-oneHour)/oneDay));
}

Object.prototype.isDate = function(){
	try {
		return(typeof(this)=="object" && this.getTime()!=undefined);
	} catch(e){return(false);}
}

Date.prototype.aDay = (1000*60*60*24);
Date.prototype.DateDiff = function(From){
	if(!From.isDate()){
		try{
			From = new Date(From);
		} catch(e){
			return(nan);
		}
	}
	return(Math.ceil(((From.getTime()-this.getTime())/this.aDay)))
}

Date.prototype.TimeDiff = function(h,m,s,year,month,day){
		var d = this;
		if(h.isDate()){
			t = h;
		} else {
			var t = new Date()
			t.setHours(h)
			t.setMinutes(m);
			t.setSeconds(0);
			if(year) t.setYear(year);
			if(month) t.setMonth(month);
			if(day) t.setDate(day);
		}


		var o = new Object()
		o.seconds = Math.ceil((t.getTime()-d.getTime())/(1000));
		o.minutes = Math.floor(o.seconds/60);
		o.hours = Math.floor(o.minutes/60);
		o.toString = function(){
			return(this.hours + ":" + this.minutes + ":" + this.seconds);
		}

		return(o)
	}


	function Echo_secondsToReadable($seconds){
		var $years = 0;
		var $months = 0;
		var $days = 0;
		var $hours = 0;
		var $mins = 0;

		var $secondsInYear = 31536000;
		var $secondsInMonth = 2592000;
		var $secondsInDay = 86400;
		var $secondsInHour = 3600;
		var $secondsInMin = 60;

		if($seconds>$secondsInYear){
			$years = parseInt($seconds/$secondsInYear);
			$seconds = parseInt($seconds%$secondsInYear);
		}

		if($seconds>$secondsInMonth){
			$months = parseInt($seconds/$secondsInMonth);
			$seconds = parseInt($seconds%$secondsInMonth);
		}

		if($seconds>$secondsInDay){
			$days = parseInt($seconds/$secondsInDay);
			$seconds = parseInt($seconds%$secondsInDay);
		}

		if($seconds>$secondsInHour){
			$hours = parseInt($seconds/$secondsInHour);
			$seconds = parseInt($seconds%$secondsInHour);
		}

		if($seconds>$secondsInMin){
			$mins = parseInt($seconds/$secondsInMin);
			$seconds = parseInt($seconds%$secondsInMin);
		}

		if($seconds<=$secondsInMin){
			$seconds = parseInt($seconds.toString());
		}

		$return = "";
		$return += ($years>1)?" " + $years + " years":($years==1)?" " + $years + " year":"";
		$return += ($months>1)?" " + $months + " months":($months==1)?" " + $months + " month":"";
		$return += ($days>1)?" " + $days + " days":($days==1)?" " + $days + " day":"";
		$return += ($hours>1)?" " + $hours + " hours":($hours==1)?" " + $hours + " hour":"";
		$return += ($mins>1)?" " + $mins + " minutes":($mins==1)?" " + $mins + " minute":"";
		$return += ($seconds>1)?" " + $seconds + " seconds":($seconds==1)?" " + $seconds + " second":"";


		return  $return;
}

function SortSelect(o, bAlpha, bOnText){
	var t,v, ctitle;
	for(var i = 0 ; i < o.length ; i++){
		if(i+1<o.length){
			if((!bOnText && o.options[i].value>o.options[i+1].value) || (bOnText && o.options[i].text>o.options[i+1].text)){
				t = o.options[i].text;
				v = o.options[i].value;
				ctitle = o.options[i].title;
				o.options[i].value = o.options[i+1].value;
				o.options[i].text = o.options[i+1].text;
				o.options[i].title = o.options[i+1].title;
				o.options[i+1].value = v;
				o.options[i+1].text = t;
				o.options[i+1].title = ctitle;
				i = -1;
			}
		}
	}
}


// 12/6/2007:11:09 AM
function LogEnv(){
	try{
	var ajax = new Ajax()
	ajax.method = "POST";
	ajax.url = "/inc/ajaxmethods/logResolution.asp";
	ajax.add("height", screen.height);
	ajax.add("width", screen.width);
	ajax.add("hascookies", navigator.cookieEnabled==true)
	ajax.onSuccess = function(x, t){this.close()}
	ajax.onFailed = function(){}
	ajax.send();
} catch(e){}
} 
/*AddListener(window,"load", LogEnv,false);*/


//
function isParentNode(objectToCheck, parentObjectToCheckAgainst){
	try {
		var x = objectToCheck.parentNode;
		while(x != undefined) {
			if(x==parentObjectToCheckAgainst){return(true);}
			x = x.parentNode;
		}
		return(false);
	} catch(e){trace(e.message);}
}

function timeStamp(type){
	var d = new Date();
	if(type.toLowerCase()=="mysql"){
		return(d.getFullYear() + "-" + strpad((d.getMonth()+1).toString(), 2, "0", true) + "-" +  strpad(d.getDate(), 2, "0", true) + " " +  strpad(d.getHours(), 2, "0", true) + ":" +  strpad(d.getMinutes(), 2, "0", true) + ":" +  strpad(d.getSeconds(), 2, "0", true) );
	}
}

function strpad($string,$len,$padString,$left){
	if(!$len) return $string;
	$string = ($string)?_trim(" " + $string) :"";
	$padString = ($padString)?$padString:" ";
	for(var $i=$string.length;$i < $len;$i++){
		$string = ($left)?$padString + $string:$string + $padString;
		$i = $string.length;
	}
	return $string;
}

function asString(t){
	return(""+t);
}



function ToDo(){
	this.list = new Array();
	this.add = function(x){
		this.list[this.list.length] = x;
	}
	this.report = function(bAlert){
		if(bAlert){
			return(this.list.join("\n"));
		} else {
			return(replaceall(this.list.join("<br />")," ", "&nbsp;"));
		}
	}
}
window.todo = new ToDo();


// Tuesday, February 05, 2008
// returns the event object based on the browser - and makes some vars common
function fixE(e){
	if(typeof(e)==undefined){e = window.event}
	if(typeof(e.layerX)==undefined){e.layerX = e.offsetX}
	if(typeof(e.layerY)==undefined){e.layerY = e.offsetY}
	return(e);
}


// Tuesday, February 05, 2008
// returns the source element of an event object
function getSourceFromEvent(e){
	e = fixE(e);
	if(e.target){
		try{
			if(source.nodeType==3){return(source.parentNode)} // safari bug
		} catch(e){}
		return(e.target);
	} else if(e.srcElement){
		return(e.srcElement);
	}
}

	function cleanDim(o){
		try{
			if(o){
				return(o.toString().replace("px","")/1);
			}
		} catch(e){trace(e.message);}
	}



function checkRatio(o){
	var _width = o.width;
	var _height = o.height;
	var _ratio = o.ratio;

	if(_ratio<1){
		if(_width>_height){
			_width = _height*_ratio;
		} else {
			_height = _width/_ratio;
		}
	} else if(_ratio>1){
		if(_height > _width){
			_height = _width/_ratio;
		} else {
			_width = _height*_ratio;
		}
	} else {
		if(_height>_width){
			_height = _width/_ratio;
		} else {
			_width = _height*_ratio;
		}
	}

	o.height = _height;
	o.width = _width;
	o.toString = function(){
		return("Object::Ratio{\nwidth:" + o.width +"\nheight:" + o.height +"\n}\n");
	}
	return(o);

}

/** { [function.window.PositionElementToElement]
* @dependency :: [function.window._vscroll]
* @dependency :: [object.window.kPosition]
* @dependency :: [function.window.height]
* @dependency :: [function.window.width]
* @edit :: Tuesday, February 10, 2009 - added args object option
* @edit :: Tuesday, February 10, 2009 - added offsetTop & offsetBottom to args object - use to manually change the location of the item
**/
	function PositionElementToElement(ElementOne, ElementTwo,args){
		if(!args){args = {};};
		try {
			ElementOne.style.position = "absolute";
			var pos = window.kPosition.get(ElementTwo);
			if(((pos.y*1)+(ElementOne.offsetHeight*1))>((window.height()/1) + (window._vscroll()/1))){
				if(args.offsetTop){
					ElementOne.style.top = (pos.y*1) - (ElementOne.offsetHeight*1) + (args.offsetTop*1);
				} else {
					ElementOne.style.top = pos.y - 10 - (((pos.y*1)+(ElementOne.offsetHeight*1))-((window.height()/1) + (window._vscroll()/1))) + "px";
				};
			} else {
				ElementOne.style.top = (pos.y + ((args.offsetBottom)?args.offsetBottom:0)) + "px";
			};

			if(args.alignToElementLeft){
				ElementOne.style.left = pos.x;
			} else {
				if(pos.x > (window.width()*.5)){
					ElementOne.style.left = pos.x - ElementOne.offsetWidth - 10;
				} else {
					ElementOne.style.left = pos.x + ElementTwo.offsetWidth + 10;
				};
			};
		} catch(e){Catch("PositionElementToElement[ElementOne:" + ElementOne.id + ", ElementTwo:" + ElementTwo.id + "]",e,true);};
	};
	/** } [function.window.PositionElementToElement] **/



String.prototype.count = function(needle){
	return(indexOfCount(this, needle));
}
function indexOfCount(haystack, needle){
	var i = haystack.split(needle);
	return(i.length);
}


function decodeHTMLChars(text){
	try {
		if(!text){return("")}// new Array(" ","&nbsp;"),
		var list = new Array(
			new Array("\"","&quot;"),
			new Array("&","&amp;"),
			new Array("<","&lt;"),
			new Array(">","&gt;"),
			new Array("©","&copy;"),
			new Array("®","&reg;"),
			new Array("™","&tm;") ,
			new Array("´","&acute;"),
			new Array("«","&laquo;"),
			new Array("»","&raquo;"),
			new Array("¡","&iexcl;"),
			new Array("¿","&iquest;") //,


/*
		Removed Tuesday, May 06, 2008 because IE6 didn't like them
		even went so far as to ignore the try catch
			new Array("À","&Agrave;"),
//		new Array("à","&agrave;"),
			new Array("Á","&Aacute;"),
			new Array("á","&aacute;"),
			new Array("Â","&Acirc;"),
			new Array("â","&acirc;"),
			new Array("Ã","&Atilde;"),
			new Array("ã","&atilde;"),
			new Array("Ä","&Auml;"),
			new Array("ä","&auml;"),
			new Array("Å","&Aring;"),
			new Array("å","&aring;"),
			new Array("Æ","&AElig;"),
			new Array("æ","&aelig;"),
			new Array("Ç","&Ccedil;"),
			new Array("ç","&ccedil;"),
			new Array("Ð","&ETH;"),
			new Array("ð","&eth;"),
			new Array("È","&Egrave;"),
			new Array("è","&egrave;"),
			new Array("É","&Eacute;"),
			new Array("é","&eacute;"),
			new Array("Ê","&Ecirc;"),
			new Array("ê","&ecirc;"),
			new Array("Ë","&Euml;"),
			new Array("ë","&euml;"),
			new Array("Ì","&Igrave;"),
			new Array("ì","&igrave;"),
			new Array("Í","&Iacute;"),
			new Array("í","&iacute;"),
			new Array("Î","&Icirc;"),
			new Array("î","&icirc;"),
			new Array("Ï","&Iuml;"),
			new Array("ï","&iuml;"),
			new Array("Ñ","&Ntilde;"),
			new Array("ñ","&ntilde;"),
			new Array("Ò","&Ograve;"),
			new Array("ò","&ograve;"),
			new Array("Ó","&Oacute;"),
			new Array("ó","&oacute;"),
			new Array("Ô","&Ocirc;"),
			new Array("ô","&ocirc;"),
			new Array("Õ","&Otilde;"),
			new Array("õ","&otilde;"),
			new Array("Ö","&Ouml;"),
			new Array("ö","&ouml;"),
			new Array("Ø","&Oslash;"),
			new Array("ø","&oslash;"),
			new Array("Ù","&Ugrave;"),
			new Array("ù","&ugrave;"),
			new Array("Ú","&Uacute;"),
			new Array("ú","&uacute;"),
			new Array("Û","&Ucirc;"),
			new Array("û","&ucirc;"),
			new Array("Ü","&Uuml;"),
			new Array("ü","&uuml;"),
			new Array("Ý","&Yacute;"),
			new Array("ý","&yacute;"),
			new Array("ÿ","&yuml;"),
			new Array("Þ","&THORN;"),
			new Array("þ","&thorn;"),
			new Array("ß","&szlig;"),
			new Array("§","&sect;"),
			new Array("¶","&para;"),
			new Array("µ","&micro;"),
			new Array("¦","&brvbar;"),
			new Array("±","&plusmn;"),
			new Array("·","&middot;"),
			new Array("¨","&uml;"),
			new Array("¸","&cedil;"),
			new Array("ª","&ordf;"),
			new Array("º","&ordm;"),
			new Array("¬","&not;"),
			new Array("­","&shy;"),
			new Array("¯","&macr;"),
			new Array("°","&deg;"),
			new Array("¹","&sup1;"),
			new Array("²","&sup2;"),
			new Array("³","&sup3;"),
			new Array("¼","&frac14;"),
			new Array("½","&frac12;"),
			new Array("¾","&frac34;"),
			new Array("×","&times;"),
			new Array("÷","&divide;"),
			new Array("¢","&cent;"),
			new Array("£","&pound;"),
			new Array("¤","&curren;"),
			new Array("¥","&yen;")*/
		);
		var i = 0;
		for(i;i<list.length;i++){
			if(text.toString().indexOf(list[i][1])!=-1){
				text = replaceall(text, list[i][1],list[i][0]);
			}
		}
		return(text);
	} catch(e){}
}


function capLock(e){
	var kc = e.keyCode?e.keyCode:e.which;
	var sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);
	return(((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk))
}

function date($date) {
	var d = new Date($date);
	if(d == "NaN") {
		// find out what the dilim for the date string is.
		var $dilim = numOnly($date,"",true);
		var $arrDate = $date.split($dilim.substr(0,1));
		$arrDate.uBound = $arrDate.length-1;
		var $year, $month, $day;
		if($arrDate.uBound==0) { $year = $arrDate[0]; $month = 1; $day = 1; }
		if($arrDate.uBound==1) {
			if($arrDate[0]<=12) {
				$year = $arrDate[1];
				$month = $arrDate[0];
				$day = 1;
			} else {
				$year = $arrDate[0];
				$month = $arrDate[1];
				$day = 1;
			}
			//alert($year+":"+$month+":"+$day);
		}
		d = new Date($year,$month-1,$day);
	}
	var result = new Object();
	result.name = "date()";
	result.valid = (d!="NaN");
	result.month = d.getMonth() + 1;
	result.day = d.getDate();
	result.year = d.getFullYear();
	result.second = d.getSeconds();
	result.hour = d.getHours();
	result.minute = d.getMinutes();
	result.toString = d.toLocaleString().replace(" 12:00:00 AM","");
	result.date = strpad(result.month,2,"0",true) + "-" + strpad(result.day,2,"0",true) + "-" + result.year;
	result.mysql = result.year + "-" + strpad(result.month,2,"0",true) + "-" + strpad(result.day,2,"0",true);
	result.futuredate = futureDate(result.year,result.month,result.day);
	return result;
}

function futureDate($y,$m,$d){
	var $objD = new Date($y,$m-1,$d);
	var $objT = new Date();
	return ($objD>$objT);
}



window.GetCustomObjectName = function(typename){
	var objRef = "ECHO__OBJECT__LIST__" + typename;
	try{
		if(window[objRef]==undefined){
			window[objRef]=new Array();
		}
		return(window[objRef][window[objRef].length]=typename+"_"+window[objRef].length)
	} catch(e){
		Catch("window.GetCustomObjectName",e,true);
	}
}


window.getSWF = function(movieName) {
	try {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			if(document[movieName].length != undefined){
				return document[movieName][1];
			}
			return document[movieName];
		}
	} catch(e){
		Catch("getSWF",e,true);
	}
}


// Monday, January 14, 2008
/* todo
 * - support for missing constants... see php documentation
 * - edit Tuesday, July 22, 2008 :: added check on the year to make sure it's 4 digit. assumes 2000 date if not 4 digit which is different from default action which would assume 1900
 */
function phpDate(format, _timestamp){
	// check Saved_the date
	if(_timestamp){
		var dilim = numOnly(_timestamp, "","returnNoneNumeric=true").charAt(0);
		if(dilim){
			var arr = _timestamp.split(dilim)
			if(dilim!="-" && dilim!="/"){dilim="-";}
			if(arr.length==3){
				arr[2] = strpad(arr[2],4,"20",true);
				_timestamp = arr.join(dilim);
			}
		}
	}
	_timestamp = (_timestamp)?new Date(_timestamp):new Date();
	if(_timestamp=="NaN"){return;}
	format = addEscapeStrings(format);
	format = replaceall(format, "d", strpad(_timestamp.getDate(), 2, "0", true)); // day of month
	format = replaceall(format, "j", _timestamp.getDate());
	format = replaceall(format, "D", addEscapeStrings(escapeAll(DayOfWeek(_timestamp).substring(0,3))))
	format = replaceall(format, "l", addEscapeStrings(escapeAll(DayOfWeek(_timestamp))))
	format = replaceall(format, "N", (_timestamp.getDay()+1))
	format = replaceall(format, "w", (_timestamp.getDay()))
	format = replaceall(format, "S", addEscapeStrings(escapeAll((readableNumber(_timestamp.getDay()+1)))))
	format = replaceall(format, "M", addEscapeStrings(escapeAll(MonthOfYear(_timestamp).substring(0,3))))
	format = replaceall(format, "F", addEscapeStrings(escapeAll(MonthOfYear(_timestamp).substring(0,3))))
	format = replaceall(format, "m", strpad(_timestamp.getMonth()+1, 2, "0", true))
	format = replaceall(format, "n", _timestamp.getMonth()+1)
	format = replaceall(format, "t", getDaysInMonth(_timestamp))
	format = replaceall(format, "y", strpad(_timestamp.getYear(), 2, "0", true))
	format = replaceall(format, "Y", _timestamp.getFullYear())

	format = replaceall(format, "a", addEscapeStrings(escapeAll((_timestamp.getHours()>11)?"pm":"am")));
	format = replaceall(format, "A", addEscapeStrings(escapeAll((_timestamp.getHours()>11)?"pm":"am").toUpperCase()));
	format = replaceall(format, "G", _timestamp.getHours());
	format = replaceall(format, "g", (_timestamp.getHours()>11)?(_timestamp.getHours()-12):_timestamp.getHours());
	format = replaceall(format, "H", strpad(_timestamp.getHours(), 2,"0",true));
	format = replaceall(format, "h", strpad((_timestamp.getHours()>11)?(_timestamp.getHours()-12):_timestamp.getHours(), 2,"0",true));
	format = replaceall(format, "i", strpad(_timestamp.getMinutes(), 2,"0",true));
	format = replaceall(format, "s", strpad(_timestamp.getSeconds(), 2,"0",true));
	format = replaceall(format, "u", strpad(_timestamp.getMilliseconds(), 2,"0",true));
	format = replaceall(format, "U", (_timestamp.getTime()/1000))


	format = _trim(removeEscapeStrings(format));
	return(format)
}

// Monday, January 14, 2008
function removeEscapeStrings(format){
	var dilim = "|~¿Ö|"
	var dilim2 =  "|Ö¿Ö|"
	arr = format.split(dilim)
	var i = 0;
	var l = arr.length;
	var arr2;
	format = "";
	for(i;i<l;i++){
		arr2 = arr[i].split(dilim2);
		if(arr2.length>1){
			arr2[0] = String.fromCharCode(arr2[0]);
			format+= arr2.join("");
		} else {
			format += arr2[i];
		}
	}
	return(format);
}
// Monday, January 14, 2008
/* todo
	- support for \\ to allow \'s in return string
*/
function addEscapeStrings(format){
	var dilim = "|~¿Ö|"
	var dilim2 =  "|Ö¿Ö|"
	// find any escaped charictors and convers them to their Ascii Code
	var arr = format.split("\\");
	var i=0;
	var l=arr.length
	var alpha, beta
	for(i;i<l;i++){
		if(i>0){
			alpha = arr[i].substring(0,1)
			beta = arr[i].substring(1);
			format += ( dilim + alpha.charCodeAt(0) + dilim2 + beta) ;
		} else {
			format = arr[i];
		}
	}
	return(format)
}


function escapeAll(string){
	var arr = string.split("");
	return("\\" + arr.join("\\"));
}

function DayOfWeek(_timestamp){
	var a = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	_timestamp = (_timestamp)?new Date(_timestamp):new Date();
	return(a[_timestamp.getDay()])
}

function MonthOfYear(_timestamp){
	var a = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	_timestamp = (_timestamp)?new Date(_timestamp):new Date();
	return(a[_timestamp.getMonth()])
}

function getDaysInMonth(_timestamp){
	_timestamp = (_timestamp)?new Date(_timestamp):new Date();
	var nextMonth = new Date(_timestamp.getFullYear(), _timestamp.getMonth()+1, 1)
	var oneHour = 1000*60*60;
	var oneDay = oneHour*24;
	return(Math.ceil((nextMonth.getTime()-_timestamp.getTime()-oneHour)/oneDay));
}



function readableNumber(n){
	var _return = ""
	n = ""+n+"";
	n = n.substr(0,(n.length)-3)
	if(n == ""){return("");}
	if(n==1||n%10==1){_return = n + "st"};
	if(n==2||n%10==2){_return = n + "nd"};
	if(n==3||n%10==3){_return = n + "rd"};
	if(n==4||n%10==4){_return = n + "th"};
	if(n==5||n%10==5){_return = n + "th"};
	if(n==6||n%10==6){_return = n + "th"};
	if(n==7||n%10==7){_return = n + "th"};
	if(n==8||n%10==8){_return = n + "th"};
	if(n==9||n%10==9){_return = n + "th"};
	if(n==10||n%10==0){_return = n + "th"};
	if(n >= 4 && n<=20){_return = n + "th"};
	if(n=="0"){_return = "none"}
	return(_return);
}

function setIp(){
	try {
		if(window.remote_addr==undefined){
			if(Ajax){
				ajax = new Ajax();
				ajax.url = "/inc/ajaxmethods/method.getvariable.asp";
				ajax.method = "POST";
				ajax.add("VarName","remote_addr")
				ajax.onSuccess = function(x,t){
					if(x.hasChildNodes){
						if(x.childNodes[0].hasChildNodes){
							for(i=0;i<x.childNodes[0].childNodes.length;i++){
								if(x.childNodes[0].childNodes[0].hasChildNodes){
									window[x.childNodes[0].childNodes[0].nodeName] = x.childNodes[0].childNodes[0].firstChild.nodeValue;
								}
							}
						}
					}
				}
				ajax.debug = false;
				ajax.send();
			}
		}
	} catch(e){}
	return(true)
}

/** { [function.window.formatCurrancy]
* @dependency :: [function.window.Catch]
* @dependency :: [prototype.string.chunk]
* ///
* @author :: Scott McDonald;
* @license :: Lowen Corporation Use Only [Proprietary Script]

	* @purpose returns given value into a string "money" representation. where any amount above 1 will be shown
	* 	as dollars and anything below 1 will be shown  as cents.
	* @param num as Number
	* @author Scott McDonald
	* @created Friday, June 01, 2007
	*/
		function formatCurrancy(num){return(formatCurrency(num));}
		function formatCurrency(num){
			if(typeof(num)=="string"){num = new Number(num);}
			if(!num.toFixed){return(num);}
			try {
				if(num>0){
					if(num<1){
						try {
							return((num*100).toFixed(0) + "¢");
						} catch(e){Catch("function.window.formatCurrancy(25)",e,true);}
					} else {
						try {
							var arrNum = num.toFixed(2).split(".");
							if(arrNum.length==2){
								var dollar = arrNum[0];
								var cents = arrNum[1];
								if(dollar.length>3){
									try {
										return("$" + arrNum[0].chunk(3,true).join(",") + "." + cents);
									} catch(e){Catch("function.window.formatCurrancy(35)",e,true);}
								} else {
									return("$" + dollar + "." + cents);
								}
							}
						} catch(e){Catch("function.window.formatCurrancy(40)",e,true);}
					}
				} else {
					return(num);
				}
			} catch(e){Catch("function.window.formatCurrancy(45)",e,true);}
		}

/** } [function.window.formatCurrancy] **/








































/** { [object.window.imgDisplay]
* Scott McDonald
* 06/08
* param o as object :: holder for all params
* param o->anchor :: pointer to link which opened the image
* param o->path :: path to image
* @dependency :: [function.window.AddListener]
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.DOM.isParentNode]
* @dependency :: [function.window.DOM.setElem]
* @dependency :: [function.window.getPepper]
* @dependency :: [function.window.getSourceFromEvent]
* @dependency :: [function.window.PositionElementToElement]
* @dependency :: [function.window.RemoveListener]
* @dependency :: [function.window.trace]
* @dependency :: [variable.window.tooltip]
*
* @edit :: Wednesday, January 14, 2009 - logic to autosize on height too large to fit window;
**/
function imgDisplay(o){

	try {
		if(window.IMGDISPLAY_OUTPUTLAYER){
			window.IMGDISPLAY_OUTPUTLAYER.close();
		};
		var target = this;
		this.image = undefined;
		this.ImgLayer = undefined;
		this.ONCLICK = undefined;

		try{
			this.anchor = o.anchor;
			this.path = o.path;
			this.design = o.design;
			if(!this.path || !this.anchor){return;};

			this.ONCLICK = this.anchor.onclick;
			if(this.ONCLICK==undefined){this.ONCLICK = this.anchor.href;};

			if(this.ONCLICK != undefined){
				this.anchor.onclick = function(){
					window.tooltip.show("please wait for image to load...");
				};
			};
		} catch(e){};

		if(this.path){
			var img = this.image = new Image();
			img.id = "imgDisplayImage";
			img.onload = function(){
				try {




					var imgLayer = target.ImgLayer = setElem("div");
					imgLayer.id = "imgDisplayLayer";
					imgLayer.style.position = "absolute";
					imgLayer.style.top = 0;
					imgLayer.style.left = 0;
					imgLayer.style.textAlign = "center";
					imgLayer.style.border = "1px solid #CCCCCC"
					imgLayer.style.width = this.width + 10 + "px";
					imgLayer.style.height = this.height + 40 + "px";
					imgLayer.style.padding="5px";
					imgLayer.style.backgroundColor = "#FFFFFF";
					imgLayer.style.verticalAlign = "middle";
					imgLayer.appendChild(this);
					window.document.body.appendChild(imgLayer);
					imgLayer.appendChild(setElem("br"));
				} catch(e){};

				try {
					var imgClose = setElem("a");
					imgClose.id = "imgDisplay_closeLink";
					imgClose.href="javascript:;";
					imgClose.onclick = function(){target.close();};
				} catch(e){};

				imgClose.innerHTML = "Click To Close";
				imgLayer.appendChild(imgClose);

				window.IMGDISPLAY_OUTPUTLAYER = target;
				window.IMGDISPLAY_OUTPUTLAYER_ONRESIZE = function(){
					try {
						target.position();
					} catch(e){Catch(this.cFilePath + "->IMGDISPLAY_OUTPUTLAYER_ONRESIZE(0)", e,true);}
				};
				window.IMGDISPLAY_OUTPUTLAYER_ONCLICK = function(e){
					try {
						if(!isParentNode(getSourceFromEvent(e),target.ImgLayer)){
							if(getSourceFromEvent(e)!=target.anchor){
								target.close();
							};
						};
					} catch(e){Catch(this.cFilePath + "->IMGDISPLAY_OUTPUTLAYER_ONCLICK(0)", e,true);};
				};
				AddListener(window,"scroll",window.IMGDISPLAY_OUTPUTLAYER_ONRESIZE);
				AddListener(window,"resize",window.IMGDISPLAY_OUTPUTLAYER_ONRESIZE);
				AddListener(document,"click",window.IMGDISPLAY_OUTPUTLAYER_ONCLICK);
				target.position();
				target.anchor.onclick = target.ONCLICK;
			};
			img.onerror = function(){trace("Could Not Load: " + this.src);}
			img.src = this.path + "?getPepper="+getPepper();
		}
	} catch(e){Catch("imgDisplay->class",e,true);};

	this.position = function(){
		try {
			if(this.image){
				if((this.image.height+40)>window.height()){
					var per = (window.height()-40)/this.image.height;
					this.image.height = this.image.height*per;
					this.image.width = this.image.width*per;
					this.ImgLayer.style.width = this.image.width + 10 + "px";
					this.ImgLayer.style.height = this.image.height + 40 + "px";
				};
			};
			PositionElementToElement(this.ImgLayer,this.anchor);
		} catch(e){Catch("imgDisplay->position",e,true);};
	};

	this.close = function(){
		try {
			RemoveListener(window,"scroll",window.IMGDISPLAY_OUTPUTLAYER_ONRESIZE);
			RemoveListener(window,"resize",window.IMGDISPLAY_OUTPUTLAYER_ONRESIZE);
			RemoveListener(document,"click",window.IMGDISPLAY_OUTPUTLAYER_ONCLICK);
			this.ImgLayer.parentNode.removeChild(this.ImgLayer)
			window.IMGDISPLAY_OUTPUTLAYER = undefined;
		} catch(e){Catch("imgDisplay->close",e,true);};
	};
};
/** } [function.window.imgDisplay] **/


/** { [function.window.trim]
* @purpose :: php trim functon
* @param :: str as string to trim
* @param :: charlist as string items to trim out if not white space
* @return ::string
* ///
* @author :: Kevin van Zonneveld;
* @license :: http://kevin.vanzonneveld.net
* ///
   *     example 1: trim('    Kevin van Zonneveld    ');
   *     returns 1: 'Kevin van Zonneveld'
   *     example 2: trim('Hello World', 'Hdle');
   *     returns 2: 'o Wor'
   *     example 3: trim(16, 1);
   *     returns 3: 6
*/
function trim (str, charlist) {
    var whitespace, l = 0, i = 0;
    str += '';

    if (!charlist) {
        whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";
    } else {
        charlist += '';
        whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');
    }

    l = str.length;
    for (i = 0; i < l; i++) {
        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(i);
            break;
        }
    }

    l = str.length;
    for (i = l - 1; i >= 0; i--) {
        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(0, i + 1);
            break;
        }
    }

    return(whitespace.indexOf(str.charAt(0)) === -1 ? str : '');
}
	String.prototype.trim = function(){return(trim(this));}
/** } [function.window.trim] **/


/** { [function.window.isUrl]
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.trim]
* @dependency :: [function.window.inArray]
* @dependency :: [function.window.isPhone]
 * @purpose returns if the passed address is a valid URL. This will only be able to check for
 * 	a valid DOMAIN, anything after that is really beyond the scope of this function
 *
 * @edit :: Thursday, January 15, 2009 - added patch to handle leading and trailing illegal chars which would otherwise be legal elseware in the string
 */
 function isUrl(URL,args){
	 	this.typename = "function.window.isUrl";
	 		try {
				if(!args){args = new Object();}
				args.allowProtocall = (args.allowProtocall==true);
				args.forceProtocall = (args.forceProtocall==true);

				/** allowSubdomain :: As Boolean [default true]
				* if set to false then no further check is needed on SubDomain
				* else we will have to check the restrict and allow lists
				*/
				args.allowSubdomain = (args.allowSubdomain!=false);

				/**
				* restrictedSubDomains :: As Array
				* if set then the SubDomains in this list are not allowed
				*/
				if(!args.restrictedSubDomains){args.restrictedSubDomains = new Array();}

				/**
				* allowedSubDomains :: as Array
				* If set then only SubDomains in list are allowed
				*/
				if(!args.allowedSubDomains){args.allowedSubDomains = new Array();}


				var $return = new Object();
					$return.origonal = URL;
					$return.valid = false;
					$return.empty = (URL=="");
					$return.value = URL;
					$return.error = "";
					$return.warning = "";
					 var $proto = "";
					if(URL=="" || URL==undefined){
						$return.error = "Web Address is Empty";
						return($return);
					}


					if((qPos = URL.indexOf("?"))!=-1){URL = URL.substr(0,qPos);}

					if(URL==""){return($return);}
					/* remove the http: / /
					 */
					 var colonwhackwhack = URL.indexOf("://");
							if(colonwhackwhack!=-1){
								$proto = ((args.allowProtocall)?"http://":"");
								URL = URL.replace(URL.substr(0,colonwhackwhack+"://".length),"");
							}

					$proto = ((args.forceProtocall)?"http://":$proto);

					/* extract the domain portion of the address from the remaining string
					 */
					 var sDomain = URL.split("/")[0];
					/* build a list of valid (or preferred) charictors for a URL)
					 */
					var $validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-._0123456789";
					/* loop through the charictors in the domain, if any are illegal, return invalid
					 */

					/**
					* The Following List of top-level domains was retrieved from
					* http://data.iana.org/TLD/tlds-alpha-by-domain.txt - Thursday, January 15, 2009
					* so if you ever want to force real top level domains... there you go
					* var TopLevelDomains = "AC,AD,AE,AERO,AF,AG,AI,AL,AM,AN,AO,AQ,AR,ARPA,AS,ASIA,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BIZ,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CA,CAT,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,COM,COOP,CR,CU,CV,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EDU,EE,EG,ER,ES,ET,EU,FI,FJ,FK,FM,FO,FR,GA,GB,GD,GE,GF,GG,GH,GI,GL,GM,GN,GOV,GP,GQ,GR,GS,GT,GU,GW,GY,HK,HM,HN,HR,HT,HU,ID,IE,IL,IM,IN,INFO,INT,IO,IQ,IR,IS,IT,JE,JM,JO,JOBS,JP,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LT,LU,LV,LY,MA,MC,MD,ME,MG,MH,MIL,MK,ML,MM,MN,MO,MOBI,MP,MQ,MR,MS,MT,MU,MUSEUM,MV,MW,MX,MY,MZ,NA,NAME,NC,NE,NET,NF,NG,NI,NL,NO,NP,NR,NU,NZ,OM,ORG,PA,PE,PF,PG,PH,PK,PL,PM,PN,PR,PRO,PS,PT,PW,PY,QA,RE,RO,RS,RU,RW,SA,SB,SC,SD,SE,SG,SH,SI,SJ,SK,SL,SM,SN,SO,SR,ST,SU,SV,SY,SZ,TC,TD,TEL,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TP,TR,TRAVEL,TT,TV,TW,TZ,UA,UG,UK,US,UY,UZ,VA,VC,VE,VG,VI,VN,VU,WF,WS,XN--0ZWM56D,XN--11B5BS3A9AJ6G,XN--80AKHBYKNJ4F,XN--9T4B11YI5A,XN--DEBA0AD,XN--G6W251D,XN--HGBK6AJ7F53BBA,XN--HLCJ6AYA9ESC7A,XN--JXALPDLP,XN--KGBECHTV,XN--ZCKZAH,YE,YT,YU,ZA,ZM,ZW";
					*/

					for(var i=0;i<sDomain.length;i++){
						if($validChars.indexOf(sDomain.charAt(i))==-1 || sDomain.indexOf(".")==-1){
							$return.error = "Web Address has an Invalid Domain Name";
							$return.valid = false;
							return($return);
						};
					};

				 if(sDomain.indexOf("..")!=-1){
						$return.valid = false;
						$return.error = "\"..\" not allowed in Domain Name";
						return($return);
				 };


				var theRest = URL.split("/").slice(1).join("/");
				/* there are few rules of what can NOT be in a url after the domain name, in general they are the same as
				 * items that can not be in a file name... so we will look for those
				 */

				 var $invalidList = "\\:*\"<>|";
				 for(i=0;i<theRest.length;i++){
					if($invalidList.indexOf(theRest.charAt(i))!=-1){
						$return.valid = false;
						$return.error = "Web Address has Invalid Characters in Url String";
						return($return);
					};
				 };

				/** SubDomain check
				* allowSubdomain
				* restrictedSubDomains
				* allowedSubDomains
				*/

				if(args.allowSubDomain==false){
					/** TODO: Logic for this will probably be tricky since there is no real way of
					* knowing the differance between www.lowen.com and lowen.co.uk - not wanting to
					* attempt yet :\
					*/
				} else {
					/** first check restricted
					*/
					var arrSDomain = sDomain.split(".");
					var startLength = arrSDomain.length;
					if(arrSDomain.length>2){
						if(args.restrictedSubDomains.length>0){
							var i = 0;
							var l = args.restrictedSubDomains.length;
							var me;
							for(i;i<l;i++){
								me = trim(args.restrictedSubDomains[i]);
								if(arrSDomain[0].toLowerCase() == me.toLowerCase()){
									/* allowed domains will always trump restricted so we're going to check in the allowed array before
									* we remove any found from the restricted
									*/
									if(!inArray(args.allowedSubDomains, me)){
										arrSDomain.splice(0,1);
										i=(l+1);
									};
								};
							};
						};

						if(arrSDomain.length==startLength){
							if(args.allowedSubDomains.length>0){
								if(arrSDomain[0]!=""){
									if(!inArray(args.allowedSubDomains, arrSDomain[0])){
										arrSDomain.splice(0,1);
									};
								};
							};
						};
					};
					if(arrSDomain.length!=startLength){
						sDomain = arrSDomain.join(".");
					};
				};

				/* remove any trailing non Alpha chars (since all top level domains end with a letter
				*/

					try {
						while(alphaOnly(sDomain.charAt(sDomain.length-1))==""){
							sDomain = sDomain.substr(0,sDomain.length-1);
						}
					} catch(e){Catch(this.typename + ".validate",e,true);}

				/* remove any leading non Alpha/Num chars (since all top level domains end with a letter
				*/

					try {
						while(alphaOnly(sDomain.charAt(0),"0123456789")==""){
							sDomain = sDomain.substr(1,sDomain.length);
						}
					} catch(e){Catch(this.typename + ".validate",e,true);}


				 /* as a last step, check to see if the URL will translate into a phone number */
				 if(isPhone(URL)){
					 $return.valid = false;
					 $return.error = "Web Address appears to be a Phone Number";
					 return($return);
				 };

				$return.value = $proto + sDomain + ((theRest.length>0)?"/" + theRest:"");
				$return.valid = true;
				$return.altered = ($return.origonal!=$return.value);

				return($return);
			} catch(e){Catch("function.window.isUrl", e, true);}
 		};
/** } [function.window.isUrl] **/

/** { [function.window._int]
* FUNCTION: _int( numaric value $num)
*	PURPOSE: alias to the javascript parseInt function. returns 0 if the value doesn't resulve to a number
*
*	ARGUMENTS: $num as string/int
*	RETURNS: INT
* EXAMPLE: _int("123")// 123; _int("abc") // 0
*	AUTHOR: Scott McDonald : echo@voxecho.com
*	VERSION: 1.0
**/
	function _int($num){return (!parseInt($num))?0:parseInt($num);}
/** } [function.window._int] **/



/** { [function.window.isYelling]
* @purpose :: checks a given string and determens if it is an all uppercase
* @param ::
* @return :: Object{
		percentcaps as number
		percentlower as number
*	}
* @creation ::
* @edit :: Thursday, January 15, 2009 - Added Error Catching
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.replaceall]
* @dependency :: [function.window.alphaOnly]
* @dependency :: [function.window._int]
* ///
* @author :: Scott McDonald;
* @license :: Lowen Corporation Use Only [Proprietary Script]
* ///
*/
function isYelling(cValue){
	try {
		/* multiple spaces can confuse the count of word to caps, so strip them out */
		if(cValue!=""){cValue = replaceall(cValue, "  "," ");};
		/* cut the string into individual words */
		try {
			var result = new Object();
			result.id = "isYelling";
			result.length = cValue.length;
			result.basevalue = cValue;
			result.array = cValue.split(" ");
			result.wordcount = (result.length>0)?result.array.length:0;
			result.charcount = cValue.length;
			result.alphatext = (cValue)?alphaOnly(cValue):"";
		} catch(e){Catch("isYelling(1)",e,true);};

		/* and lets find out how many chars in the string
		* are uppercase and how many lowercase
		*/

		result.capcount = 0; /* set the counter for the number of cap letters found */
		result.lowercount = 0; /* set the counter for the number of lowercase letters found */
		try {
			for(var $i=0;$i<result.alphatext.length;$i++){
				var $char = result.alphatext.charCodeAt($i);
				if(($char>=65)&&($char<=90)){result.capcount++;}else{result.lowercount++;};
				var $val = ($i>0)?(100-((result.alphatext.length - $i)/result.alphatext.length)*100):0;
			};
		} catch(e){Catch("isYelling(2)",e,true);};

		try {
			result.percentcaps = _int(result.capcount/result.alphatext.length*100);
		} catch(e){Catch("isYelling(3)",e,true);};

		try {
			result.percentlower = _int(result.lowercount/result.alphatext.length*100);
		} catch(e){Catch("isYelling(4)",e,true);};
		return(result);
	} catch(e){Catch("isYelling(base)",e,true);};
};
/** } [function.window.isYelling] **/



/** { [function.window.eightThree]
* @purpose :: returns string containing valid DOS 8.3 charictors only
* this function does NOT reformat the length of the string, only removes
* any none DOS filename charictors - infact the name is a bit of a misnomar
* as alot of chars are valid in a DOS name that this strips out. maybe it should
* have been called "validDomainName"
* @param :: text value
* @return :: string
* @creation :: Friday, January 16, 2009
* @edit :: Friday, March 20, 2009 - assigned variable to hold checkfor so it didn't need to be pulled 4 times
* @dependency :: [function.window.Catch]
* ///
* @author :: Scott McDonald;
* @license :: Lowen Corporation Use Only [Proprietary Script]
* ///
*/
function eightThree(val) {
	try {
		var valid = "-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0987654321._";
		var i, l = val.length;
		var checkfor;
		for (i = 0; i < val.length; i++) {
			checkfor = val.charAt(i);
			if (valid.indexOf(checkfor) == -1) {
				val = replaceall(val, checkfor, "");
			};
		};
	} catch(e){Catch("function.window.eightThree",e,true);};
	return(val);
};
/** } [function.window.eightThree] **/


/** { [function.window.getElemValue]
* @purpose ::
* @param ::
* @return ::
* @creation ::
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.selectedRadio]
* /---/
* @author :: Scott McDonald;
* @license :: Lowen Corporation Use Only [Proprietary Script]
* /---/
*/
function getElemValue(o){
	if (o.type == "radio") {
		var _selectedIndex = selectedRadio(o);
		if (!o.form[o.id].length) {return(o.value);}
		if (_selectedIndex >-1) {
			if (o.form[o.id][_selectedIndex]) {
				return (o.form[o.id][_selectedIndex].value);
			} else {return ("");};
		} else {return("");}
	} else if(o.type=="checkbox"){
		return((o.checked)?o.value:"");
	} else if(o.type=="text" || o.type=="hidden"){
		return(o.value);
	} else if(o.type=="select-one"){
		return(o.value);
	} else if(o.type=="select-multiple"){
		var r = new Array();
		var i = 0;
		var l = o.options.length;
		for(i;i<l;i++){
			if(o.options[i].selected){
				r[r.length] = o.options[i].value;
			};
		};
		return(r.join(","));
	};
};

/** } [function.window.getElemValue] **/


function RGB(v){
	this.typename = "object.window.RGB";
	this.hex = "";
	this.dec = "";
	this.html = "";


	this.init = function(v){
		try {
			if(v.indexOf(",")!=-1){
				var a = v.split(",");
				if(a.length!=3){
					Catch(this.typename + ".init",{message:"malformed RGB as Dec value"},true);
				} else {
					this.dec = v;
				};
			} else {
				if(v.indexOf("0x")==0 || v.indexOf("#")==0){
					v = v.replace(/0x/gi,"");
					v = v.replace(/#/gi,"");
					trace(v);
				};
			} ;
		} catch(e){Catch(this.typename + ".init(base)",e,true);};
	};

	this.toDec = function(v){
		trace("not implemented");
	};

	this.toHex = function(v){
		try {
			var c = {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};
			if(v){this.init(v);}
			if(this.dec){
				var a = this.dec.split(",");
				var i = 0;
				var l = 3;
				var o = "";
				for(i;i<l;i++){
					try {
							o += (c[parseInt(a[i]/16,10)]) + "" + (c[a[i]%16]);
					} catch(e){
						Catch(this.typename + ".toHEx(1) " +  ((a[i]/16) + " : " + (a[i]%16)),e,true);
					};
				};
				this.hex = "0x" + o;
				this.html = "#" + o;
				return({hex:this.hex,html:this.html,dec:this.dec});
			};
		} catch(e){Catch(this.typename + ".toHEx(base)",e,true);}
	};
	if(v){this.init(v);};
};


/** { [function.window.CCCheckNumWithMod10]
* @dependency :: [function.window.Catch]
**/
function CCCheckNumWithMod10(cardNum) {
	try {
		var i;
		var cc = new Array(16);
		var checksum = 0;
		var validcc;

		/* assign each digit of the card number to a space in the array */
		for (i = 0; i < cardNum.length; i++) {
			cc[i] = Math.floor(cardNum.substring(i, i + 1));
		};

		/* walk through every other digit doing our magic
		* if the card number is sixteen digits then start at the
		* first digit (position 0), otherwise start from the
		* second (position 1)
		*/
		for (i = (cardNum.length % 2); i < cardNum.length; i += 2) {
			var z = cc[i];
			var a = z * 2;

			if (a >= 10) {
				var aStr = a.toString();
				var b = aStr.substring(0, 1);
				var c = aStr.substring(1, 2);
				cc[i] = Math.floor(b) + Math.floor(c);
			} else {
				cc[i] = a;
			};
		};


		/* add up all of the digits in the array */
		for (i = 0; i < cardNum.length; i++) {
			checksum += Math.floor(cc[i]);
		};

		/* if the checksum is evenly divisble by 10
		* then this is a valid card number
		*/
		validcc = ((checksum % 10) == 0);
		return (validcc);
	} catch (e) {
	Catch("CCCheckNumWithMod10", e, true);
	};
};
/** } [function.window.CCCheckNumWithMod10] **/

/** { [function.window.CCCheck]
* @dependency :: [function.window.CCCheckNumWithMod10]
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.inArray]
* @dependency :: [function.window.numOnly]
**/
function CCCheck(cardNum, cardType) {
	try {
		cardType = cardType.toUpperCase();
		var allowedCC = ["VISA", "M/C", "AMEX"];
		var validCard;
		var cardLength;
		var cardLengthOK;
		var cardStart;
		var cardStartOK;

		var r = new Object();
		r.value = cardNum;
		r.valid = false;
		r.error = "";
		if (cardNum == "424242424242") {
			r.valid = true;
			return (r);
		};
		try {
			if (cardType=="") {
				r.error = "Please select a credit card type.";
				return (r);
			};
		} catch (e) { Catch("CCCheck(3737)", e, true); };

		/* check if the card type is valid */
		try {
			if (inArray(allowedCC, cardType)==-1) {
				r.error = "Unknown CreditCard Type.";
				return (r);
			};
		} catch (e) { Catch("CCCheck(3739)", e, true); };

		/* clean up any spaces or dashes in the card number */
		validCard = numOnly(cardNum, "");
		if (validCard != "") {
			/* check the first digit to see if it matches the card type */
			cardStart = validCard.substring(0, 1);
			cardStartOK = (((cardType == "VISA") && (cardStart == "4")) ||
				((cardType == "M/C") && (cardStart == "5")) ||
				((cardType == "AMEX") && (cardStart == "3")));
			if (!(cardStartOK)) {
				r.error = "Please make sure the credit card number you've entered matched the card type you selected.";
				return (r);
			};

			/* the card number is good now, so check to make sure
			* it's a the right length
			*/
			cardLength = validCard.length;
			cardLengthOK = (((cardType == "VISA") && ((cardLength == 13) || (cardLength == 16))) ||
				 ((cardType == "M/C") && (cardLength == 16)) ||
				 ((cardType == "AMEX") && (cardLength == 15)));
			if (!(cardLengthOK)) {
				r.error = "Please make sure you've entered all of the digits on your credit card.";
				return (r);
			};

			/* card number seems OK so do the Mod10 */
			if (CCCheckNumWithMod10(validCard)) {
				r.error = "";
				r.valid = true;
				return (r);
			} else {
				r.error = "Please make sure you've entered your credit card number correctly.";
				return (r);
			};
		} else {
			r.error = "";
			r.valid = true;
			r.value = "";
			return (r);
		};
	} catch (e) {
		Catch("CCCheck", e, true);
	};
};
/** } [function.window.CCCheck] **/

/** { [function.window.CCVCheck]
* @purpose :: returns if CCV number is correct
* @param :: CCVNumber as string
* @param :: CCType as string
* @return :: Object {valid, value, error}
* @creation :: Friday, February 20, 2009
* @dependency :: [function.window.Catch]
* @dependency :: [function.window.numOnly]
*/
function CCVCheck(CCVNumber, CCType) {
try {
	var val = numOnly(CCVNumber);
	var r = new Object();
	r.valid = false;
	r.error = "";
	r.value = val;

	if (val == "") {
		r.error = "Card CCV Number is Empty";
		return (r);
	} else if (val != "") {
		if (val != CCVNumber) {
			r.error = "Card CCV Number is Invalid";
			return (r);
		} else if (CCType == "AMEX" && val.length != 4) {
			r.error = "Card CCV Number must be 4 digits";
			return (r);
		} else if (CCType != "AMEX" && val.length != 3) {
			r.error = "Card CCV Number must be 3 digits";
			return (r);
		};
	};
	} catch (e) { Catch("CCVCheck(base)", e, true); };
	r.valid = true;
	return (r);
};
/** } [function.window.CCVCheck] **/



/** { [lib.functions.window.selectAdd]
**/
function selectAdd(args){
	var selectObject = args.o;
	var label = args.label;
	var value = args.value;
	if( selectObject && ( selectObject.type=="select-one" || selectObject.type == "select-multiple")){
		var option = setElem("option");
		option.label = label;
		option.value = value;
		try{selectObject.options.add(option,null);} catch(e){selectObject.options.add(option);};
	};
};
/** } [lib.functions.window.selectAdd] **/


function bullseyeQueryEncode(text) {
	try {
		text = replaceall(text, "=", "#61;");
		text = replaceall(text, "&amp;", "[AMPERSAND]");
		text = replaceall(text, "&", "[AMPERSAND]");
		text = replaceall(text, "%", "[PERCENT]");
		text = replaceall(text, "<br>", "");
		text = replaceall(text, "''", "'");
	} catch (e) { };
	if (typeof (text) == "object") {
		return (text.toString());
	} else {
		return (text);
	};
};
