function params(wut, qp, dflt) {
	dflt = dflt == null ? "" : dflt;
	try {
	    r = unescape(wut.match(new RegExp(qp + "=+([^&;]*)"))[1]);
	} catch (qp) {
	    r = dflt;
	}
	return r;
}


function addZero(vNumber) { 
	return (vNumber < 10 ? "0" : "") + vNumber; 
}

function gid(_id) { 
	return document.getElementById(_id); 
}


function inner(_gid, _text) {
	gid(_gid).innerHTML = _text;
}


    function $flash(ef) {
        ef.w = ef.w == null ? "590" : ef.w;
        ef.h = ef.h == null ? "450" : ef.h;
        ef.id = ef.id == null ? "flashmovie" : ef.id;
        //	ef.wmode = ef.wmode == null ? "opaque" : ef.wmode;
        sendback = {};
        flashstr = "<object id=\"" + ef.id + "\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + ef.w + "\" height=\"" + ef.h + "\"><param name=\"movie\" value=\"" + ef.movie + (ef.vars != null ? "?" + ef.vars : "") + "\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"false\"><param name=\"scale\" value=\"noscale\"><param name=\"allowScriptAccess\" value=\"always\"><param name=\"show\" value=\"#ffffff\">";
        if (ef.base != null) {
            flashstr += "<param name=\"base\" value=\"" + ef.base + "\">";
        }
        if (ef.salign != null) {
            flashstr += "<param name=\"salign\" value=\"" + ef.salign + "\">";
        }
        if (ef.bgcolor != null) {
            flashstr += "<param name=\"bgcolor\" value=\"" + ef.bgcolor + "\">";
        }
        if (ef.vars != null) {
            flashstr += "<param name=\"flashVars\" value=\"" + ef.vars + "\">";
        }
        flashstr += "<embed name=\"" + ef.id + "\" id=\"" + ef.id + "\" src=\"" + ef.movie + (ef.vars != null ? "?" + ef.vars : "") + "\" menu=\"false\" quality=\"high\" pluginspage=\"//www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + ef.w + "\" height=\"" + ef.h + "\" swLiveConnect=\"true\" scale=\"noscale\" allowScriptAccess=\"always\"";
        if (ef.base != null) {
            flashstr += " base=\"" + ef.base + "\"";
        }
        if (ef.salign != null) {
            flashstr += " salign=\"" + ef.salign + "\"";
        }
        if (ef.bgcolor != null) {
            flashstr += " bgcolor=\"" + ef.bgcolor + "\"";
        }
        if (ef.vars != null) {
            flashstr += " FlashVars=\"" + ef.vars + "\"";
        }
        flashstr += "></embed></object>";
        sendback.toString = function () {return flashstr;};
        sendback.render = function () {document.writeln(flashstr);};
        sendback.inner = function (targetgid) {gid(targetgid).innerHTML = flashstr;};
        return sendback;
    }

    isSafari = navigator.appVersion.match(/safari/gi) != null;

    function nval(_wut) {
        try {
            returnValue = isSafari ? _wut.childNodes.length > 0 ? _wut.firstChild.nodeValue : _wut.nodeValue : navigator.appName == "Netscape" ? _wut.textContent : _wut.text;
            return returnValue != null ? returnValue : "";
        } catch (nov) {
            return "";
        }
    }


    function gtn(_wut, _tag, index) {
        rt = _wut.getElementsByTagName(_tag);
        return rt.length > 1 ? index != null ? nval(rt[index]) : rt : rt.length == 0 ? "" : index != null ? rt : nval(rt[0]);
    }


    function gtn0(_wut, _tag) {
        tempgtn = gtn(_wut, _tag);
        if (typeof tempgtn == "string") {
            tempgtn = gtn(_wut, _tag, 0);
        }
        return tempgtn;
    }


    function importXML(xmlobj) {
        _xmlfile = xmlobj.url;
        _xmlRtn = xmlobj.obj;
        _act = xmlobj.action;
        if (window.XMLHttpRequest && !window.ActiveXObject) {
            xmlDoc = new XMLHttpRequest;
            xmlDoc.onreadystatechange = function () {
            	if (xmlDoc.readyState == 4) {
            		eval(_xmlRtn + "=xmlDoc.responseXML");
            		eval(_act);
            	}
            }  //;
            xmlDoc.open("GET", _xmlfile, true);
            xmlDoc.send(null);
        } else if (document.implementation &&
            document.implementation.createDocument) {
            xmlDoc = document.implementation.createDocument("", "", null);
            xmlDoc.onload = function () {
            	eval(_xmlRtn + "=xmlDoc");
            	eval(_act);
            };
            xmlDoc.load(_xmlfile);
        } else if (window.ActiveXObject) {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.onreadystatechange = function () {
            if (xmlDoc.readyState == 4) {
            	eval(_xmlRtn + "=xmlDoc");
            	eval(_act);
            }
           };
            xmlDoc.load(_xmlfile);
        } else {
            return;
        }
    }


    function getAtt(_wut, _att) {
        return _wut.getAttribute(_att);
    }


    function getIndexByAttribute(_wut, _att, _val) {
        ri = -1;
        if (_wut.length > 0) {
            for (i = 0; i < _wut.length; i++) {
                if (getAtt(_wut[i], _att) == _val) {
                    ri = i;
                    break;
                }
            }
        }
        return ri;
    }


    function AddEvent(obj, evType, fn) {
        if (obj.addEventListener) {
            obj.addEventListener(evType, fn, false);
            return true;
        } else if (obj.attachEvent) {
            var r = obj.attachEvent("on" + evType, fn);
            return r;
        } else {
            return false;
        }
    }


    function Joiterator(joey) {
        this.items = joey.items;
        this.count = joey.items.length;
        this.numshow = joey.numshow;
        this.currentItem = this.items[0];
        this.currentPage = 0;
        if (this.numshow == "all") {
            this.numshow = this.count;
        }
        try {
            this.pageCount = Math.floor(joey.items.length / joey.numshow) + 1;
        } catch (j) {
            this.pageCount = 1;
        }
        var jtp = [];
        var jtcp = -1;
        for (jj = 0; jj < this.count; jj++) {
            if (jj % this.numshow == 0 || isNaN(jj % this.numshow)) {
                jtcp++;
                jtp[jtp.length] = [];
            }
            this.items[jj].index = jj;
            jtp[jtcp][jtp[jtcp].length] = this.items[jj];
        }
        this.pages = jtp;
        this.pageCount = this.pages.length;
        this.isFirst = function () {return this.currentPage == 0 || this.count == 0;};
        this.isLast = function () {return this.currentPage == this.pageCount - 1 || this.count == 0;};
        this.next = function () {if (!this.isLast()) {this.currentPage++;this.currentItem = this.pages[this.currentPage][0];}};
        this.back = function () {if (!this.isFirst()) {this.currentPage--;this.currentItem = this.pages[this.currentPage][0];}};
        return this;
    }