function JSAll() {
	this.objects=new Object(); this.unique=new Unique(); this.register=JSAll_register; this.clobberUID=JSAll_clobberUID;
	function JSAll_register(oObject) {
		if (!this.objects[oObject.oType]) { this.objects[oObject.oType]=new Array(); }
		regUID = this.unique.get(oObject.oType);
		if (oObject.oID!='') {
			for (var si in this.objects) {
				if (this.objects[si][oObject.oID]) { delete this.objects[si][oObject.oID]; this.objects[si][regUID]=oObject; }
			}
		}
		this.objects[oObject.oType][regUID]=oObject; return regUID;
	}
	function JSAll_clobberUID(oObject) {
		for (var si in this.objects) {
			for (var sObject in this.objects[si]) {
				if (this.objects[si][sObject]!=null) { if (this.objects[si][sObject].oID==oObject.oID) { delete this.objects[si][sObject]; } }
			}
		}
	}
}
function Unique() {
	var o = new Object();
	o.m_nVal = 0; o.m_nUnique = Unique.nUnique++; o.get = Unique_get; o.hexval = Unique_hexval; return o;
	function Unique_get(sType) {
		var rVal = new String();
		var newVal = new String();
		for (i = 0; i < sType.length; i++) { newVal += this.hexval(sType.charCodeAt(i)-65); }
		newVal = newVal.substring(0,24);
		for (i=newVal.length-1; i<=22; i++) { newVal="0"+newVal; }
		for (i=0; i<newVal.length; i+=6) { rVal += newVal.substring(i,i+6)+"_";	}
		rVal += this.hexval(65+(this.m_nVal%26))+this.hexval(this.m_nUnique)+"_"+this.hexval(this.m_nVal++);
		return rVal;
	}
	function Unique_hexval(c) { return String("0123456789ABCDEF").charAt((c/16)&0x0F)+String("0123456789ABCDEF").charAt((c/1)&0x0F); }
}
Unique.nUnique = 1;
function JSObj() {
	this.oType=new String("JSObj"); this.oID=new String();this.last_error= new String();this.create=JSObj_create;this.destroy=JSObj_destroy;
	function JSObj_create() { this.oID = jsAll.register(this); }
	function JSObj_destroy() { jsAll.clobberUID(this); }
}
function isIE() {
	var rVal = false;
	try {
		var oDOM = new ActiveXObject("Microsoft.XMLDOM");
		if ((document.all) && (oDOM)) { rVal = true; oDOM = null; }
	} catch(ex) { if (disable_debug_handler == true) { debug(ex); } }
	return rVal;
}
function isNS() {
	var rVal = false;
	try {
		var oNodes = document.getElementsByTagName("a");
		if (oNodes) {
			rVal = true;
			oNodes = null;
		}
	} catch(ex) { if (disable_debug_handler == true) { debug(ex); } }
	return rVal;
}
function addLinkBehaviors() {
	if (isIE()) {
		var oLinks=document.getElementsByTagName("a");
		var nLinkLen=oLinks.length; var si = 0;
		var sAttrib = "";
		while (si < nLinkLen) {
			if (oLinks[si].getAttribute("isData") == "true") {
				if (isIE()) {
					oDataA[oDataA.length] = oLinks[si];
				}
			} else if (oLinks[si].getAttribute("isRollover") == "true") {
				oLinks[si].bh=new LinkBehavior(oLinks[si], oDataA.length-1);
			}
			si++;
		}
	}
}
function hideall() { if (isIE()) { try { if ((jsAll) && (jsAll.objects) && (jsAll.objects['ContentObj'])) { var oObjs = jsAll.objects['ContentObj']; if (oObjs) { for (i in oObjs) { if (oObjs[i]) { oObjs[i].hide(); }}}}} catch(ex) { if (disable_debug_handler == true) { debug(ex); }}}}
function window_onunload() { try { for (var si in jsAll.objects) { for (var si2 in jsAll.objects[si]) { jsAll.objects[si][si2].destroy();} } CollectGarbage(); } catch(ex) { if (disable_debug_handler == true) { debug(ex); } } }
function window_onscroll() { hideall(); }

function XSL_load() {
	if ((!this.xml) && (!this.bLoading)) {
		try {
			this.bLoading = true;
			this.createXMLObject();
			this.object.load(this.url);
		} catch(ex) {
			if (disable_debug_handler == true) {
				debug(ex);
			}
		}
	} else {
		// already have data
	}
}
function debug(oError) {
	var oCaller = debug.caller.toString();
	oCaller = oCaller.substring(oCaller.indexOf(" "), oCaller.indexOf("{"));
	var sStr = "In function " + oCaller + " :\n" + oError.message + "\n";
	for (var i in oError)
	{
		sStr += i + ": " + oError[i].toString() + "\n";
	}
	//alert(sStr);

}

// list of images to preload
//
function PreloadImages()
{
	if (aImages[nIncr])
	{
		var oImg = new Image();
		oImg.src = sBaseUrl + aImages[nIncr++];
		setTimeout("PreloadImages()", 5);
	}

}

function parseXPath(oXMLDoc, sXPath)
{
        // if the doc hasn't been parsed correctly, or is invalid
        if (oXMLDoc)
        {
                if (!oXMLDoc.parsed)
                {
                        // document wasn't parsed (invalid xml?)
                        return null;
                }
        } else {
                // xmldocument doesn't exist (check referring function)
                return null;
        }
        var oNode;
        var aReturn             = new Array();                                          // used if we return a collection
        var nItems              = 0;                                                            // counter used when iterating through attributes
        var oNodeList   = oXMLDoc.selectNodes(sXPath);          // apply xpath against xml doc

        if (oNodeList.length == 0)
        {
                // invalid xpath or no nodes matched
                return "";
        }

        var oItems                      = new Enumerator(oNodeList);    // iterate through nodes
        var oItem                       = null;                                                 // used as the current element in the Enumeration
        var oAttributes         = null;                                                 // so that we can gather attribute collection
        // step through each node
        var nCount = 0;
        for (oItems.moveFirst(); !oItems.atEnd(); oItems.moveNext())
        {
                oItem = oItems.item();  // current item - assigned for performance reasons
                if (oItem.attributes)
                {
                        // step through attributes and assign to an array
                        oAttributes = new Enumerator(oItem.attributes);
                        aReturn[nItems] = new Object();
                        var count = 0;  // count the number of attributes

                        for (oAttributes.moveFirst(); !oAttributes.atEnd(); oAttributes.moveNext())
                        {
                                count++;
                                oAttribute = oAttributes.item();
                                aReturn[nItems][oAttribute.name.toLowerCase()] = oAttribute.value;
                        }
                        if ((count == 0) && (oItem.text != ""))
                        {
                                // item is a text node without attributes. (CDATA section)
                                return oItem.text;
                        }
                } else {
                        // text attribute
                        return oItem.text;
                }
                nItems++;
        }
        // return object
        return aReturn;
}
function formatComma(sStr)
{
	var sInStr = new String(sStr);
	var aThrees = new Array();
	for (var i = sInStr.length; i>0; i-=3)
	{
		aThrees[aThrees.length] = sInStr.substring(((i-3 > 0) ? i-3 : 0),i);
	}
	return aThrees.reverse().join(",");
}

function implement(cInterface, oObj) {
        var oInst = new cInterface();
        for (i in oInst) {
                oObj[i] = oInst[i];
        }
}


function getObjRef(oObj) {
	return "jsAll.objects."+oObj.oType+"['"+oObj.oID+"']";
}