	/**
	 * Where qsParams is a simple (key, value) object 'array'. e.g. {'page': 3, 'price': 15}... 
	 **/
	function getModQS(qsParams)
	{
		var qs = getDataRowObject(getQS());
		for (var key in qsParams)
			qs[key] = qsParams[key];
		
		return objectToString(qs);
	}

	/**
	 * getQS() just abstracts away a little work in getting the actual qs string -- necessary for isapi rewrite environment.
	 **/
	function getQS()
	{
		var qs = document.location.href;
		return ((/\?/.test(qs)) ? qs.replace(/.*\?/, "") : "");
	}
	function getPageURL()
	{
		return window.location.href.replace(/https?:\/\//ig, "").replace(window.location.host, "").replace(/(default|index)\.aspx?/i, "").replace(/\?.*$/, "").replace(/\/+/, "/");
	}

	//  some of this logic was taken from the jquery cookie plugin: @author Klaus Hartl/klaus.hartl@stilbuero.de (http://stilbuero.de/jquery/cookie/)
	function saveCookie(name, value, kwargs)
	{
		value = value || "";
		kwargs = kwargs || {};

		var expires = kwargs.expires || "";
		if (expires)
		{
			var expDate = new Date();
			expDate.setTime(expDate.getTime() + (kwargs.expires * 24 * 60 * 60 * 1000));
			expires = '; expires=' + expDate.toUTCString();
		}
		//var path = ((kwargs.path) ? '; path=' + kwargs.path : '');
		var path = '; path=' + (kwargs.path || "/");
		var domain = ((kwargs.domain) ? '; domain=' + kwargs.domain : '');
		var secure = ((kwargs.secure) ? '; secure' : '');
		document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
	}

	function fromCookie(cookieName, returnIfNull)
	{
		var cookies = (document.cookie || "").split(";");
		var retVal = "";
		returnIfNull = returnIfNull || "";
		for (var i = 0; i < cookies.length; i ++)
		{
			var tmp = cookies[i].split(/[=]/);
			if (tmp[0].replace(/^\s+|\s+$/, "") == cookieName)
			{
				retVal = decodeURIComponent(tmp[1]);
				break;
			}
		}
		return testNullString(retVal, returnIfNull)
	}
	
	// Returns a SIMPLE decoding of encoded strings.
	function simpleDecode(input){ return testNullString(input, "").replace(/&amp;/ig, "&").replace(/&lt;/ig, "<").replace(/&gt;/ig, ">").replace(/&nbsp;/ig, " "); }
	function simpleEncode(input){ return testNullString(input, "").replace(/&/g, "&amp;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;"); }

	// Simple focus/blur helpers for preserving 'help' text in an input or textarea
    inputMsgHash = {};
    function focusInput(domElement)
    {
        if (!inputMsgHash[domElement.id])
            inputMsgHash[domElement.id] = domElement.value;

        if (domElement.value == inputMsgHash[domElement.id])
        {
            $(domElement).removeClass("ghost");
            domElement.value = "";
        }
    }

    function blurInput(domElement)
    {
        if (domElement.value == "" || domElement.value == inputMsgHash[domElement.id])
        {
            domElement.value = inputMsgHash[domElement.id];
            $(domElement).addClass("ghost");
        }
    }


