
// ** BEGIN (c) Copyright 2002 Mozilla
var browserVersion = parseInt(navigator.appVersion);
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
              && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
              && (agt.indexOf('webtv')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4only = (is_nav && (is_major >= 4) && (is_minor < 5));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) ||
                             (agt.indexOf("; nav") != -1)));
var is_nav5 = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie = (agt.indexOf("msie") != -1);
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")== -1 && agt.indexOf("msie 5.5") == -1) && agt.indexOf("msie 6.0") == -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
var is_ie55 = (is_ie && !is_ie3 && !is_ie4 && (is_major == 4) && (agt.indexOf("msie 5.5") != -1));
var is_ie55up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && (is_major == 4));
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0")!=-1));
var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie55);
var is_aol = (agt.indexOf("aol") != -1);
var is_aol3 = (is_aol && is_ie3);
var is_aol4 = (is_aol && is_ie4);
var is_aol8 = (is_aol && is_ie6up)
var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);
var is_js;
if(is_nav2 || is_ie3) is_js = 1.0
else if(is_nav3 || is_opera) is_js = 1.1
else if((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2
else if((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3
else if(is_nav5) is_js = 1.4
else if(is_nav && (is_major > 5)) is_js = 1.4
else if(is_ie && (is_major > 5)) is_js = 1.3
else if(is_ie && (is_major >= 4)) is_js = 1.1
else is_js = 0.0;
var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
var is_win16 = ((agt.indexOf("win16")!=-1) ||
                (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) ||
                (agt.indexOf("windows 16-bit")!=-1) );
var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                (agt.indexOf("windows 16-bit")!=-1));
var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));


var is_win32 = (is_win95 || is_winnt || is_win98 ||
                ((is_major >= 4) && (navigator.platform == "Win32")) ||
                (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
var is_os2 = ((agt.indexOf("os/2")!=-1) ||
              (navigator.appVersion.indexOf("OS/2")!=-1) ||
              (agt.indexOf("ibm-webexplorer")!=-1));
var is_mac = (agt.indexOf("mac")!=-1);
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) ||
                            (agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) ||
                            (agt.indexOf("powerpc")!=-1)));
var is_sun = (agt.indexOf("sunos")!=-1);
var is_sun4 = (agt.indexOf("sunos 4")!=-1);
var is_sun5 = (agt.indexOf("sunos 5")!=-1);
var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
var is_irix = (agt.indexOf("irix") !=-1);
var is_irix5 = (agt.indexOf("irix 5") !=-1);
var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
var is_hpux = (agt.indexOf("hp-ux")!=-1);
var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
var is_aix = (agt.indexOf("aix") !=-1);
var is_aix1 = (agt.indexOf("aix 1") !=-1);
var is_aix2 = (agt.indexOf("aix 2") !=-1);
var is_aix3 = (agt.indexOf("aix 3") !=-1);
var is_aix4 = (agt.indexOf("aix 4") !=-1);
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1);
var is_mpras = (agt.indexOf("ncr")!=-1);
var is_reliant = (agt.indexOf("reliantunix")!=-1);
var is_dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) ||
              (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) ||
              (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux ||
               is_sco ||is_unixware || is_mpras || is_reliant ||
               is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
var is_vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
var is_safari = ((agt.match(/safari/)) ? true : false);
// ** END (c) Copyright 2002 Mozilla
// ** BEGIN (c) Copyright 2003-2005 Intuition Studio
is_jsValid = false;
is_detectJS = true;
if(is_detectJS) document.write("<scr" + "ipt language=\"Jav" + "aScr" + "ipt1.2\" type=\"text/javascript\"><!--" + "\/\/" + "\n" + "is_jsValid = true;" + "\n" + "\/\/" + "-->" + "</scr" + "ipt>");

window.is_dataLoaded = false;
window.initCalc = true;

if((is_mac && is_ie) && ((window.location + "").toLowerCase().indexOf("cartridge_list.php") > -1))
{
    window.top.location.replace("browser_msg.php?msg=Sorry,%20the%20page%20you%20reqested%20is%20not%20available%20for%20viewing%20in%20the%20Mac%20Internet%20Explorer%20browser.%3Cbr%3E%3Cbr%3EAs%20an%20alternative,%20please%20try%20one%20of%20the%20following%20browsers");
}

window.onerror = function () { if(getObjRef('bod')) { getStyRef('bod').background = '#ffffff url(\'images/error.gif\') no-repeat 602px 39px'; }; return ((document.all) ? false : true); };
/* END ---------------------------------- PLATFORM, ENVIRONMENT & BROWSER DETECT ---------------------------- */

// Copyright 2003-2005 Intuition Studio
if(!is_safari && !(is_mac && is_ie))
{
    var tNm = new Number(0.1);
	Number.localeThousandth = tNm.toLocaleString().match(/,/) ? '.' : ',';
	Number.prototype.commify = function () {
		var nS = (this + "").toString();
        nS = ((nS != "") && (nS.indexOf(".") > -1) && (nS.indexOf(".") == (nS.length - 2))) ? nS + "0" : nS;
		var nm = nS.split('');
		if ( nS.match(/[^\d\.]/) || nm.length < 3 ) return nS;
		nm.reverse();
		nS = nm.join('').replace(/(\d\d\d)/g, "$1_marker_").replace(/_marker_$/g, '').replace(/_marker_/g, Number.localeThousandth);
		nm = nS.split('').reverse();
		return nm.join('');
	}
	Number.prototype.currency = function(is_useDollarSign,is_useCommas,centsVal)
	{
		centsVal = ((centsVal && centsVal != "") ? centsVal.toString() : "00");
		is_useDollarSign = (is_useDollarSign) ? is_useDollarSign : false;
		is_useCommas = (is_useCommas) ? is_useCommas : false;
		baseValue = (isNaN(parseFloat(this))) ? 0 : this;
		retValue = ((is_useCommas) ? baseValue.commify() : baseValue.commify().toString().replace(/,/g,""));
		currencyVal = ((is_useDollarSign) ? "$" : "") + ((retValue.toString().indexOf(".") > -1) ? (((retValue.toString().indexOf(".")) - (retValue.toString().length - 2) == 0) ? retValue + "0" : retValue) : retValue + "." + centsVal);
		return currencyVal;
	}
}
function getCurrency(strVal,is_useDollarSign,is_useCommas,centsVal)
{
		centsVal = ((centsVal && centsVal != "") ? centsVal.toString() : "00");
		is_useDollarSign = (is_useDollarSign) ? is_useDollarSign : false;
		is_useCommas = (is_useCommas) ? is_useCommas : false;
		baseValue = (isNaN(parseFloat(strVal))) ? 0 : strVal;
		retValue = ((is_useCommas && !is_mac) ? baseValue.commify() : baseValue);
		currencyVal = ((is_useDollarSign) ? "$" : "") + ((retValue.toString().indexOf(".") > -1) ? (((retValue.toString().indexOf(".")) - (retValue.toString().length - 2) == 0) ? retValue + "0" : retValue) : retValue + "." + centsVal);
		return currencyVal;
}
// ** BEGIN (c) Copyright 2002 Adobe// ** BEGIN (c) Copyright 2002 Adobe
function findObj(n, ly)
{
	if(is_major < 4) return document[n];
	var curDoc = ly ? ly.document : document;
	var elem = curDoc[n];
	if(!elem)
	{
		for(var i=0;i<curDoc.layers.length;i++)
		{
			elem = findObj(n,curDoc.layers[i]);
			if(elem) return elem;
		}
	}
	return elem;
}
// ** END Copyright 2002 Adobe
/* END -------------------------------------------- ADOBE IMAGEREADY OBJECT REFERENCE SCRIPT -------------------------------------------- */
/* START -------------------------------------------- INTUITION STUDIO OBJECT/OBJECT STYLE REFERENCING SCRIPT -------------------------------------------- */
	function getObjRef(objId)
	{
		objRef = false;
		objRef = (document.layers) ? findObj(objId) : (document.getElementById) ? eval("document.getElementById(\"" + objId + "\")") : (document.all) ? eval("document." + objId) : false;
		if(document.layers && !objRef) { objRef = (typeof document[objId] != "undefined") ? document[objId] : false; };
		return objRef;
	}
	function getStyRef(objId)
	{
		styRef = false;
		styRef = (document.layers) ? findObj(objId) : (document.getElementById) ? eval("document.getElementById(\"" + objId + "\").style") : (document.all) ? eval("document." + objId + ".style") : false;
		if(document.layers && !styRef) { styRef = (typeof document[objId] != "undefined") ? document[objId] : false; };
		return styRef;
	}
	function setContent(layerRef,content,is_unicode)
    {
        if(!layerRef || typeof layerRef != "object")
            return false;
        content = (content) ? content : null;
        if(content)
        {
            is_unicode = (is_unicode) ? is_unicode : false;
            if(is_unicode)
            {
                if(document.layers)
                {
                    with(layerRef.document)
                    {
                        open();
                        write(unescape(content));
                        close();
                    }
                }
                else if(typeof layerRef.innerHTML != "undefined")
                {
                    layerRef.innerHTML = unescape(content);
                }
            }
            else if(!is_unicode)
            {
                if(document.layers || (layerRef.innerHTML == "undefined"))
                {
                    with(layerRef.document)
                    {
                        open();
                        write(content);
                        close();
                    }
                    return layerRef;
                }
                else if(typeof layerRef.innerHTML != "undefined")
                {
                    layerRef.innerHTML = content;
                    return layerRef;
                }
            }
        }
        return;
    }
	// Array for validInputByRegExp
	presetRE =
	{
		phone: /[0-9\-\.\(\)extmb\#]/i,
		notphone: /[^0-9\-\.\(\)extmb\#]+/gi,
		phonealpha: /[0-9\-\. \(\)a-z\#]/i,
		notphonealpha: /[^0-9\-\. \(\)a-z\#]+/gi,
		zip: /[0-9\-]/,
		notzip: /[^0-9\-]+/g,
		address: /[^<>%\!\?\~\^\\\{\}\[\]]/,
		notaddress: /[<>%\!\?\~\^\\\{\}\[\]]+/g,
		alphanumeric:  /[^<>\?\~\^\\\{\}\[\]]/,
		notalphanumeric: /[<>\?\~\^\\\{\}\[\]]+/g,
		name: /[^<>%\#\!\@\?\~\^\\\{\}\[\]]/,
		notname: /[<>%\#\!\@\?\~\^\\\{\}\[\]]+/g,
		emailaddress: /[^ <>\\%]/,
		notemailaddress: /[ <>\\%]+/g,
		notes: /[^<>\^\{\}]/,
		notnotes: /[<>\^\{\}]+/g,
        contiguous: /[a-zA-Z0-9\!\@\$\^\&\*\(\)\+\-\=\_\'\:\;\?\/\.\,\\\>\<\~\`]/g
	}

	function initKeyPress()
	{
		if(document.layers)
		{
			document.captureEvents(Event.KEYPRESS);
			document.onkeypress = getKeyPress;
		}
	}
	function getKeyPress(e)
	{
		e = (e && e != "") ? e : (window.event) ? window.event : null;
		retKeyVal = (!e) ? null : (!document.all) ? String.fromCharCode(e.which) : String.fromCharCode(e.keyCode);
		if(document.layers && typeof e.target != "undefined" && typeof e.target.onkeypress != "undefined" && e.target.onkeypress != getKeyPress)
		{
			fS = e.target.onkeypress.toString().replace(/this[ ]*\,[ ]*event/,"e.target,e");
			fS = fS.substring((fS.indexOf("{") + 1),(fS.lastIndexOf("}") - 1));
			if(fS.indexOf("return") != -1) { fS = fS.replace(/return/,""); }
			eval(fS);
		}
		return retKeyVal;
	}
	function getKeyCode(e)
	{
		e = (e && e != "") ? e : (window.event) ? window.event : null;
		retKeyCode = (!document.all) ? e.which : e.keyCode;
		return retKeyCode;
	}
	function validInputByRegEx(obj, e, rE)
	{
		var key;
		var keychar;
        if(typeof window.autoCalc != "undefined" && window.autoCalc > 0) { clearTimeout(window.autoCalc); };
		e = (e) ? e : null;
		rE = (typeof rE == "string") ? ((rE != "" && typeof presetRE[rE] != "undefined") ? presetRE[rE] : "") : rE;
		if(!rE)
			return;
		key = getKeyCode(e);
		keychar = (document.layers) ? String.fromCharCode(key) : getKeyPress(e);
		// allow use of  control keys
		/*
		0 = null;
		8 = backspace;
		9 = horizontal tab/down arrow
		13 = carriage return/enter
		27 = esc
		*/
		if((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) || (key==189) || (key==191) || (key==190) || (key==187))
		{
			return true;
		}
		if((keychar + "").match(rE))
		{
			return true;
		}
		return false;
	}

	function calcVal(field)
	{   
        clearTimeout(window.autoCalc);
		rId = "v_" + field.id;
        fVO = (typeof field != "undefined" && typeof field.value != "undefined") ? field.value : "";
        fV = (fVO == "") ? 0 : fVO;
        rV = (getObjRef(rId) && typeof getObjRef(rId).value != "undefined") ? getObjRef(rId).value : 0;
        rV = ( Math.round( ( parseFloat(parseFloat(rV) * parseFloat(fV)) ) * Math.pow(10,2) )/Math.pow(10,2) );
        rV = (!is_mac) ? escape(rV.currency(true,true,'00')) : escape(getCurrency(rV,true,true,'00'));
        if(((typeof window.calcTm == "undefined") || (window.calcTm > 1.5)) && (((typeof window.initCalc != "undefined" && window.initCalc != true)))) { clearTimeout(window.autoCalc); window.autoCalc = setTimeout("viewToggle(document.forms['cartridge_form'],false,false,'get'); clearTimeout(window.autoCalc);",((is_mac && is_ie) ? 3333 : 1111)); };
        tId = "t_" + field.id;
        //document.title += ". ";
        setContent(getObjRef(tId),rV,true);
		return (((fVO == "" && rV == "%240.00")) ? "&nbsp;" : rV);
	}
    elsOffset = (typeof window.elsOffset != "undefined" && window.elsOffset != "") ? window.elsOffset : 6;
    function calcAll(formO,is_initialize)
    {
        is_initialize = (is_initialize) ? is_initialize : false;
        allEls = formO.elements;
        elL = (allEls.length - window.elsOffset);
        gT = 0;
        allChecked = true;
        allUnChecked = true;       
        viewToggle(formO,false,false,'get',false);
    }
    function doSub(formO,execStr,is_submitForm)
    {
        formO = (formO) ? formO : null;
        if(!formO)
            return;
        setContent(getObjRef("status_msg"),escape("Calculating, please wait..." + "<br />" + "(" + window.allR + " total rows)"),true);
        execStr = (execStr) ? execStr : (((execStr.charAt(execStr.length - 1) == ";") ? "" : ";"));
        if(execStr != "") { eval(execStr); };
        is_submitForm = (is_submitForm) ? is_submitForm : false;
        if(is_submitForm) { viewToggle(formO,false,false,'get',false,true); };
        return;
    }
    function clearChecked(form,is_clearAll,is_clearUnChecked,is_clearChecks)
    {
        is_clearAll = (is_clearAll) ? is_clearAll : false;
        is_clearUnChecked = (is_clearUnChecked) ? is_clearUnChecked : false;
        is_clearChecks = (is_clearChecks) ? is_clearChecks : false;
        allEls = form.elements;
        for(eI=0;eI<(allEls.length-elsOffset);eI++)
        {
            aId = allEls[eI].id.toString();
            if(allEls[eI].type.toString().toLowerCase() == "text")
            {
                if(!aId.substring(0,2).match(/[a-z]_/) && !aId.substring(0,4).match(/chk_/))
                {
                    chkR = getObjRef(("chk_" + aId));
                    if(((chkR && (chkR.checked == true) && !is_clearUnChecked) || (chkR && (chkR.checked == false) && is_clearUnChecked) || is_clearAll))
                    {
                        if(chkR && is_clearChecks)
                        {
                            chkR.checked = false;
                        }
                        if(typeof allEls[eI].value != "undefined" && allEls[eI].value != "" && !isNaN(parseFloat(allEls[eI].value)) && parseFloat(allEls[eI].value) > 0)
                        {
                            allEls[eI].value = 0;
                            setContent( getObjRef('t_' + aId),calcVal(allEls[eI]),true);
                            if(is_mac && is_ie)
                            {
                                getObjRef('cartridge_list_table').width = 700;
                                getStyRef('cartridge_list_table').width = "700px";
                            }
                        }
                    }
                }
            }
        }
        //allEls[0].className = (allEls[0].checked) ? "chk_all_on" : "chk_all_off";
        calcAll(form);
    }
    function checkToggle(chk,chkForm)
    {
        chkForm = (chkForm) ? chkForm : null;
        if(!chkForm)
            return;
        allEls = chkForm.elements;
        autoToggleElem = (chk.id.toString() != "chk_toggle_1") ? getObjRef(chk.id.replace(/_[0-9]+/,"_1")) : -1;
        if(autoToggleElem != -1)
        {
            autoToggleElem.className = (chk.className == "chk_all_on") ? "chk_all_off" : "chk_all_on";
            chkOn = (chk.className == "chk_all_off") ? false : true;
        }
        else
        {
            chk.className = (chk.className == "chk_all_off") ? "chk_all_on" : "chk_all_off";
            chkOn = (chk.className == "chk_all_on") ? false : true;
        }
        for(eI=0;eI<(allEls.length-elsOffset);eI++)
        {
            if(allEls[eI].type.toString().toLowerCase() == "checkbox")
            {
                aId = allEls[eI].id.toString();
                if(aId.substring(0,4).match(/chk_/))
                {
                    allEls[eI].checked = (chkOn) ? true : false;
                }
            }
        }
    }
    Array.prototype.getIndexByValue = function(value)
    {
    	tstVal = false;
    	tstVal = (value) ? value.toString() : "FAILED_tstVal_CHECK";
    	if(tstVal != "FAILED_tstVal_CHECK")
    	{
    		indexArray = new Array();
    		eval("baseArray = this");
    		baseLen = baseArray.length;
    		for(oP=0;oP<baseLen;oP++)
    		{
    			if(baseArray[oP] == value) indexArray[indexArray.length] = oP;
    		}
    		return indexArray;
    	}
    	return -1;
    }
    function scrollDoc(xP,yP)
    {
        xP = (xP && !isNaN(parseInt(xP))) ? parseInt(xP) : 0;
        yP = (yP && !isNaN(parseInt(yP))) ? parseInt(yP) : 0;
        if(window && window.scrollTo)
        {
            window.scrollTo(xP,yP);
        }
        else if(window.scroll)
        {
            window.scroll(xP,yP);
        }
    }
    stateVals = ["checked","unchecked","ic","lc","fc","nv","empty","filled","all","none","get"];
    function viewToggle(chkForm,is_viewAll,is_viewNone,viewState,viewSetting,is_submitForm)
    {
        chkForm = (chkForm) ? chkForm : null;
        if(!chkForm)
            return;
        is_viewAll = (is_viewAll) ? is_viewAll : false;
        is_viewNone = (is_viewNone) ? is_viewNone : false;
        viewState = (is_viewAll) ? "all" : ((is_viewNone) ? "none" : (viewState && window.stateVals.getIndexByValue(viewState) != "") ? viewState : "filled");
        is_viewMatching = (viewSetting == "view") ? true : false;
        is_hideMatching = (viewSetting == "hide") ? true : false;
        is_submitForm = (is_submitForm) ? is_submitForm : false;
        allEls = chkForm.elements;
        onI = 0;
        rtArr = [];
        rtS = "";
        tQ = 0;
        gTotal = "$0.00";
        gT = 0;
        rI = 0;
        window.allR = 0;
        tStart = new Date();
        if(viewState == "get")
        {
            chkForm.elements['cartridge_list'].value = "";
        }
        for(eI=0;eI<(allEls.length-elsOffset);eI++)
        {
            aId = (typeof allEls[eI].id != "undefined" && allEls[eI].id != "") ? allEls[eI].id.toString() : "";
            if(typeof allEls[eI].type != "undefined" && allEls[eI].type.toString().toLowerCase().match(/text|checkbox/))
            {
                switch(viewState) {
                    case "checked":
                        // show only checked
                        if((allEls[eI].type.toString().toLowerCase() == "checkbox") && (aId.substring(0,4).match(/chk_/)))
                        {
                           if(!is_hideMatching && !is_viewMatching)
                           {
                               getStyRef(allEls[eI].id.toString().replace(/chk_/,"row_")).display = (allEls[eI].checked) ? "" : "none";
                           }
                           else if((is_hideMatching || is_viewMatching) && (allEls[eI].checked))
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                           }
                           onI += ((allEls[eI].checked) ? 1 : 0);
                           getObjRef(allEls[eI].id.toString().replace(/chk_/,"row_")).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                        }
                    break;
                    case "unchecked":
                        // show only unchecked
                        if((allEls[eI].type.toString().toLowerCase() == "checkbox") && (aId.substring(0,4).match(/chk_/)))
                        {
                           if(!is_hideMatching && !is_viewMatching)
                           {
                               getStyRef(allEls[eI].id.toString().replace(/chk_/,"row_")).display = (!allEls[eI].checked) ? "" : "none";
                           }
                           else if((is_hideMatching || is_viewMatching) && (!allEls[eI].checked))
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                           }
                           onI += ((!allEls[eI].checked) ? 1 : 0);
                           getObjRef(allEls[eI].id.toString().replace(/chk_/,"row_")).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                        }
                    break;
                    case "empty":
                        // show only items without values
                        if((allEls[eI].type.toString().toLowerCase() == "text"))
                        {
                           cVal = parseFloat( unescape(calcVal(allEls[eI])).replace(/[^0-9\.]/g,"") );
                           if(!is_hideMatching && !is_viewMatching)
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (isNaN(cVal) || !(cVal > 0)) ? "" : "none";
                           }
                           else if((is_hideMatching || is_viewMatching) && (!isNaN(cVal) && (cVal > 0)))
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                           }
                           onI += ((isNaN(cVal) || !(cVal > 0)) ? 1 : 0);
                           getObjRef("row_" + allEls[eI].id.toString()).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                        }
                    break;
                    case "filled":
                    case "get":
                        // show only items with values
                        if((allEls[eI].type.toString().toLowerCase() == "text") && typeof allEls[eI].value != "undefined" && (viewState == "filled" || allEls[eI].value.toString() != ""))
                        {
                           window.allR++;
                           cValRaw = unescape(calcVal(allEls[eI]));
                           cVal = parseFloat( cValRaw.replace(/[^0-9\.]/g,"") );
                           if(viewState == "filled")
                           {
                               if(!is_hideMatching && !is_viewMatching)
                               {
                                   getStyRef("row_" + allEls[eI].id.toString()).display = (isNaN(cVal) || !(cVal > 0)) ? "none" : "";
                               }
                               else if((is_hideMatching || is_viewMatching) && (!isNaN(cVal) && (cVal > 0)))
                               {
                                   getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                               }
                               onI += ((isNaN(cVal) || !(cVal > 0)) ? 0 : 1);
                               getObjRef("row_" + allEls[eI].id.toString()).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                           }
                           if(viewState == "get" && (!isNaN(cVal) && cVal > 0))
                           {
                                gT += parseFloat(unescape(cValRaw).replace(/[^0-9\.]/g,""));
                                if(getObjRef("t_" + allEls[eI].id) && getObjRef("t_" + allEls[eI].id) != "") { setContent(getObjRef('t_' + aId),cValRaw,true); };
                                cartV =  (getObjRef("n_" + allEls[eI].id) && getObjRef("n_" + allEls[eI].id) != "") ? escape(getObjRef("n_" + allEls[eI].id).value) : "";
                                oemV = (getObjRef("o_" + allEls[eI].id) && getObjRef("o_" + allEls[eI].id) != "") ? escape(getObjRef("o_" + allEls[eI].id).value) : "";
                                rebV =  (getObjRef("v_" + allEls[eI].id) && getObjRef("v_" + allEls[eI].id) != "") ? ((!is_mac) ? escape(parseFloat(getObjRef("v_" + allEls[eI].id).value).currency(true,true,'00')) : escape(getObjRef("v_" + allEls[eI].id).value)) : "";
                                qtyV = escape(allEls[eI].value);
                                totV = escape(cValRaw);
                                //rtArr[rtArr.length] = { "cartridge": cartV, "oem": oemV, "rebate": rebV, "quantity": qtyV, "total": totV };
                                chkForm.elements['cartridge_list'].value += escape("[\"cartridge\": \"" + cartV + "\",\"oem\": \"" + oemV + "\",\"rebate\": \"" + rebV + "\",\"quantity\": \"" + qtyV + "\",\"total\": \"" + totV + "\"]" + ";");
                                tQ += ((!isNaN(parseInt(qtyV))) ? parseInt(qtyV) : 0);
                                rI++;
                           }
                        }                
                    break;    
                    case "ic":
                    case "lc":
                    case "nv":
                    case "fc":
                        // show only "fuser cores" (not currently implemented)
                        if(document.getElementsByTagName && (allEls[eI].type.toString().toLowerCase() == "text"))
                        {
                           if(!is_hideMatching && !is_viewMatching)
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (getObjRef("row_" + allEls[eI].id.toString()).getElementsByTagName("span").item(0).id.toString().indexOf(viewState) > -1) ? "" : "none";
                           }
                           else if((is_hideMatching || is_viewMatching) && (getObjRef("row_" + allEls[eI].id.toString()).getElementsByTagName("span").item(0).id.toString().indexOf(viewState) > -1))
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                           }
                           onI += ((getObjRef("row_" + allEls[eI].id.toString()).getElementsByTagName("span").item(0).id.toString().match(/ic|lc|nv|fc/)) ? 1 : 0);
                           getObjRef("row_" + allEls[eI].id.toString()).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                        }
                        break;
                    case "all":
                        // show all
                        if(allEls[eI].type.toString().toLowerCase() == "text")
                        {
                           if(!is_hideMatching && !is_viewMatching)
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = "";
                           }
                           else if((is_hideMatching || is_viewMatching))
                           {
                               getStyRef("row_" + allEls[eI].id.toString()).display = (is_hideMatching) ? "none" : "";
                           }
                           onI += (1);
                           getObjRef("row_" + allEls[eI].id.toString()).className = (onI % 2 == 0) ? "rowcolor1" : "rowcolor0";
                        }
                    break;
                    case "none":
                        // show none
                        if(allEls[eI].type.toString().toLowerCase() == "text")
                        {
                           getStyRef("row_" + allEls[eI].id.toString()).display = (!is_viewMatching) ? "none" : "";
                        }
                    break;
                }
            }
        }
        yTop = { "icTop": 266,"lcTop": 266,"nvTop": 266,"fcTop": 266 };
        if((!is_viewMatching && !is_hideMatching) && (rtArr.length == 0) && (viewState != "get")) { scrollDoc(0,((viewState.match(/ic|lc|nv|fc/)) ? yTop[(viewState + "Top")] : 0)); }
        else if(viewState && viewState == "get")
        {
            gTCurrency = (!is_mac) ? (Math.round( ( parseFloat(gT) * Math.pow(10,2) ) )/Math.pow(10,2)).currency(true,true,'00') : (Math.round( ( parseFloat(gT) * Math.pow(10,2) ) )/Math.pow(10,2));
			if(is_mac)
			{
				gTCurrency = getCurrency(gTCurrency,true,true,'00');
			}
		    chkForm.elements['grand_total'].value = gTCurrency;
            gTotal = escape(chkForm.elements['grand_total'].value.toString());
            chkForm.elements['cartridge_list'].value += escape(";[\"cartridge\": \"" + escape("<span class=\"smdktext\">" + "(" + (rI) + " types)" + "<\/span>") + "\",\"oem\": \"" + "<span></span>" + "\",\"rebate\": \"" + "<span></span>" + "\",\"quantity\": \"" + escape("<span class=\"smdktext\">" + "(" + (tQ) + " items)" + "<\/span>") + "\",\"total\": \"" + gTotal + "\"]");
            tStop = new Date();
            window.initCalc = -1;
            window.calcTm = parseFloat((tStop - tStart)/1000);
            //setContent(getObjRef("status_msg"),escape("Calculation completed in " + window.calcTm + " seconds."),true);
        }
        if(is_submitForm)
        {
            if(gT < 35)
            {
                alert("You must enter at least\n$35.00 worth of cartridges\nto submit this form.\n\n");
                setContent(getObjRef("status_msg"),escape("Please enter at least $35.00 worth of cartridges."),true);
            }
            else { chkForm.submit(); };
        }
    }
    is_useDelimiter = true;
    delimiterStr = (is_useDelimiter) ? "_" : "";
    imgStateKeys = new Array();
    imgStateKeys = ["on","o","a","off","over","out","up","down","active"];
    function flipIt()
    {
        flipTmr = setTimeout(" ",0);
        flipEv = "";
        imgNow = "";
        flipImgPath = (typeof imgPath != 'undefined') ? imgPath : "";
        var endIndx=arguments.length;
        evStr = false;
        for(indx=0; indx<endIndx; indx+=2)
        {
            if(document.images)
            {
                imgNow = (arguments[indx]);
                srcNow = (arguments[indx+1]) + "";
                imgNowObj = findObj(imgNow);
                srcB4 = imgNowObj.src + "";
                if(srcNow.indexOf("/") == -1)
                {
                    origSrcPath = '';
                    pathProtocol = srcB4.substring(0,srcB4.indexOf(":"));
                    origSrcPath = (srcB4.lastIndexOf("\/") != -1) ? srcB4.substring(0,(srcB4.lastIndexOf("\/")+1)) : srcB4;
                    imgFileName = (srcB4.lastIndexOf("\/") != -1) ? srcB4.substring((srcB4.lastIndexOf("\/") + 1),srcB4.length) : srcB4;
                    fileNameAbbr = imgFileName.substring(0,imgFileName.lastIndexOf("."));
                    imgFileType = imgFileName.substring(imgFileName.lastIndexOf("."),imgFileName.length);
                    flipImgPath = origSrcPath;
                    srcTmp = imgFileName;
                    keysLen = imgStateKeys.length;
                    for(ky=keysLen;ky>0;ky--)
                    {
                        kyMtch = delimiterStr + imgStateKeys[ky];
                        kyMtchLen = kyMtch.length;
                        if(fileNameAbbr.substring((fileNameAbbr.length - kyMtchLen),(fileNameAbbr.length)) == kyMtch)
                        {
                            fileNameAbbr = fileNameAbbr.substring(0,(fileNameAbbr.length - kyMtchLen));
                        }
                        if(srcNow == imgStateKeys[ky])
                        {
                            evStr = "srcNow = '" + fileNameAbbr + delimiterStr + imgStateKeys[ky] + imgFileType + "'; //alert('srcNow = " + srcNow + "');";
                        }
                    }
                    if(evStr) eval(evStr);
                }
                if(srcB4.substring((srcB4.length - srcNow.length), srcB4.length) != srcNow)
                {
                    if(flipImgPath != 'noPath' && flipImgPath != false)
                    {
                        flipEv = "imgNowObj.src = '" + flipImgPath + srcNow + "';";
                    }
                    else if(flipImgPath == 'noPath' || flipImgPath == false)
                    {
                        flipEv = "imgNowObj.src = '" + srcNow + "';";
                    }
                    flipEv += " imgNowObj.srcB4 = '" + srcB4 + "';";
                }
                eval(flipEv);
            }
        }
    }
    
    function preLoad()
    {
        // determine the number of argument pairs that have been passed to this function
        var indx, endIndx=arguments.length;
        // **************** BEGIN the loop through the arguments
        for(indx=0; indx < endIndx; indx+=1)
        {
            var imgSrc = (arguments[indx]);
            var temp = new Image();
            var imgPath = (typeof imgPath == "undefined") ? "" : imgPath;
            if(imgPath != 'noPath' && imgPath != false)
            {
                temp.src = imgPath + imgSrc;
            }
            else if(imgPath == 'noPath' || imgPath == false)
            {
                temp.src = imgSrc;
            }
            is_preloadDebug = (document.location.search.toString().length > 0 && document.location.search.toString().indexOf("is_PRELOADDEBUG") != -1) ? true : false;
            if(is_preloadDebug)
            {
                twEv = (document.layers) ? "alert('temp.src = " + temp.src + "')" : "var testWin = window.open('','testPreLoadWindow','width=200,height=200,scrollbars=0,status=0,toolbar=0,location=0,directories=0,menubar=0'); testWin.document.open(); testWin.document.write(\"<html><body style='font-family: Tahoma, Arial;'>\"); testWin.document.write(\"<img src=\'" + temp.src + "\'><p>" + temp.src + "</p><p>" + indx + "</p>\"); testWin.document.write(\"</body></html>\"); testWin.document.close();";
                eval(twEv);
            }
        }
    }
    
    unFlipTmr = setTimeout(" ",0);
    unFlipEv = "";
    function unFlipIt()
    {
        unImgNow = findObj(unFlipIt.arguments[0]);
        if(unImgNow.src != unImgNow.srcB4)
        {
            unImgNow.src = unImgNow.srcB4;
        }
        else if(unImgNow.src == unImgNow.srcB4) return false;
    }
    
    function navOn(imgName)
    {
        if(imgName && typeof imgName != "undefined" && findObj(imgName))
        {
            iO = findObj(imgName);
            if(!(iO.src.toString().match(/_o\./)))
            {
                flipIt(imgName,'o');
            }
        }
    }
    
    function navOff(imgName)
    {
        if(imgName && typeof imgName != "undefined" && findObj(imgName))
        {
            iO = findObj(imgName);
            if(iO.src.toString().match(/_o\./))
            {
                unFlipIt(imgName);
            }
        }
    }

    var da = (document.all) ? 1 : 0;
    var pr = (window.print) ? 1 : 0;
    var mac = (navigator.userAgent.indexOf("Mac") != -1);
    
    function printPage(frame, arg) {
      if (frame == window) {
        printThis();
      } else {
        link = arg; // a global variable
        printFrame(frame);
      }
      return false;
    }
    
    function printThis() {
      if (pr) { // NS4, IE5
        window.print();
      } else if (da && !mac) { // IE4 (Windows)
        vbPrintPage();
      } else { // other browsers
        alert("Sorry, your browser doesn't support this feature.");
      }
    }
    
    function printFrame(frame) {
      if (pr && da) { // IE5
        frame.focus();
        window.print();
        link.focus();
      } else if (pr) { // NS4
        frame.print();
      } else if (da && !mac) { // IE4 (Windows)
        frame.focus();
        setTimeout("vbPrintPage(); link.focus();", 100);
      } else { // other browsers
        alert("Sorry, your browser doesn't support this feature.");
      }
    }
    
    if (da && !pr && !mac) with (document) {
      writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
      writeln('<' + 'scr' + 'ipt LANGUAGE="VBscr' + 'ipt">');
      writeln('Sub window_onunload');
      writeln('  On Error Resume Next');
      writeln('  Set WB = nothing');
      writeln('End Sub');
      writeln('Sub vbPrintPage');
      writeln('  OLECMDID_PRINT = 6');
      writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
      writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
      writeln('  On Error Resume Next');
      writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
      writeln('End Sub');
      writeln('<' + '/scr' + 'ipt>');
    }

    window.origClass = {};
	function activateField(fieldO)
	{
		fieldO = (fieldO && typeof fieldO.value != "undefined") ? fieldO : null;
		if(!fieldO)
			return;
		fId = fieldO.id;
		fLid = getObjRef(fieldO.id + "_l");
		fRid = getObjRef(fieldO.id + "_r");
		if(typeof window.origClass[fId] == "undefined") { window.origClass[fId] = fieldO.className.toString(); };
		if(typeof window.origClass[fLid.id] == "undefined") { window.origClass[fLid.id] = fLid.className.toString(); };
		if(typeof window.origClass[fRid.id] == "undefined") { window.origClass[fRid.id] = fRid.className.toString(); };
		if(fieldO.className.toString().indexOf('_on') == -1) { fieldO.className = fieldO.className.toString() + "_on"; };
		if(fLid.className.toString().indexOf('_on') == -1) { fLid.className = fLid.className.toString() + "_on"; };
		if(fRid.className.toString().indexOf('_on') == -1) { fRid.className = fRid.className.toString() + "_on"; };
	}
	function deActivateField(fieldO)
	{
		fieldO = (fieldO && typeof fieldO.value != "undefined") ? fieldO : null;
		if(!fieldO)
			return;
		fId = fieldO.id;
		fLid = getObjRef(fieldO.id + "_l");
		fRid = getObjRef(fieldO.id + "_r");
		if(fieldO.className.toString().indexOf('_on') != -1) { fieldO.className = fieldO.className.toString().replace(/_on/,""); };
		if(fLid.className.toString().indexOf('_on') != -1) { fLid.className = fLid.className.toString().replace(/_on/,""); };
		if(fRid.className.toString().indexOf('_on') != -1) { fRid.className = fRid.className.toString().replace(/_on/,""); };
	}
	function chkEmptyField(fieldO)
	{
		fieldO = (fieldO && typeof fieldO.value != "undefined") ? fieldO : null;
		if(!fieldO)
			return;
		fId = fieldO.id;
		fLid = getObjRef(fieldO.id + "_l");
		fRid = getObjRef(fieldO.id + "_r");
		if((fieldO.value.toString().length <= 0) && (window.origClass[fId].toString().indexOf('_req') != -1))
		{
			if(fieldO.className.toString() != 'npt_m_err') { fieldO.className = 'npt_m_err'; };
			if(fLid.className.toString() != 'npt_l_err') { fLid.className = 'npt_l_err'; };
			if(fRid.className.toString() != 'npt_r_err') { fRid.className = 'npt_r_err'; };
		}
		else
		{
			fieldO.className = (typeof window.origClass[fId] != "undefined") ? window.origClass[fId] : 'npt_m';
			fLid.className =  (typeof window.origClass[fLid.id] != "undefined") ? window.origClass[fLid.id] : 'npt_l';
			fRid.className =  (typeof window.origClass[fRid.id] != "undefined") ? window.origClass[fRid.id] : 'npt_r';
		}
	}

    function goBack(depth)
    {
    	depth = (typeof depth != "undefined" && !isNaN(parseInt(depth)) && depth != 0) ? depth : -1;
    	if(depth < 0)
    	{
    		goForward((depth * -1));
    	}
    	if(!document.layers)
    	{
    		history.go((depth * -1));
    	}
    	if(document.layers)
    	{
    		history.back((depth * -1));
    	}
    }
    function goForward(depth)
    {
    	depth = (typeof depth != "undefined" && !isNaN(parseInt(depth)) && depth != 0) ? depth : -1;
    	if(depth < 0)
    	{
    		goBack(depth);
    	}
    	if(!document.layers)
    	{
    		history.go(1);
    	}
    	if(document.layers)
    	{
    		history.forward();
    	}
    }
    
    function go(depth)
    {
    	depth = (typeof depth != "undefined" && !isNaN(parseInt(depth)) && depth != 0) ? depth : -1;
    	if(depth > 0)
    	{
    		goForward(depth);
    	}
    	else if(depth < 0)
    	{
    		goBack(depth);
    	}
    }

     function getEditDate(selObj)
     { 
        if(!selObj)
        return false;
        selId = selObj.id.toString();
        selRep = selId.match(/year|month|day|hour|minute|second/);
        selForm = selObj.form;
        selForm_y = selForm.elements[selId.replace(selRep,"year")].options[selForm.elements[selId.replace(selRep,"year")].selectedIndex].value;
        selForm_m = selForm.elements[selId.replace(selRep,"month")].options[selForm.elements[selId.replace(selRep,"month")].selectedIndex].value;
        selForm_d = selForm.elements[selId.replace(selRep,"day")].options[selForm.elements[selId.replace(selRep,"day")].selectedIndex].value;
        selForm_hr = selForm.elements[selId.replace(selRep,"hour")].options[selForm.elements[selId.replace(selRep,"hour")].selectedIndex].value;
        selForm_mn = selForm.elements[selId.replace(selRep,"minute")].options[selForm.elements[selId.replace(selRep,"minute")].selectedIndex].value;
        selForm_sc = selForm.elements[selId.replace(selRep,"second")].options[selForm.elements[selId.replace(selRep,"second")].selectedIndex].value;
        dtStr = selForm_y + "" + ((selForm_m.toString().length == 1) ? "0" + selForm_m : selForm_m) + "" + ((selForm_d.toString().length == 1) ? "0" + selForm_d : selForm_d) + "" + ((selForm_hr.toString().length == 1) ? "0" + selForm_hr : selForm_hr) + "" + ((selForm_mn.toString().length == 1) ? "0" + selForm_mn : selForm_mn) + "" + ((selForm_sc.toString().length == 1) ? "0" + selForm_sc : selForm_sc);
        return dtStr;
     }

    initKeyPress();
    function showState(obj)
    {
        obj = (!obj) ? document : obj;
    }
    document.onreadystatechange = showState;
// Copyright 2003-2005 Intuition Studio
