<!--
/*******************************************************************************************
	(c) 2003 spot-media AG
	Lange Reihe 2
	20099 Hamburg
	
	All rights reserved
	
 *******************************************************************************************/
 
/*******************************************************************************************
	Set browser cookie
	
 *******************************************************************************************/
function setCookie(strCookieName, vCookieValue, strCookieExpires, strCookiePath, strCookieDomain, bCookieSecure) {
	var strCookieCmd 		 = String(strCookieName) + "=";
	var objDateCookieExpires = new Date(strCookieExpires);
	
	// set cookie value
	strCookieCmd += escape(vCookieValue) + ";";
	
	// set expiry date
	strCookieCmd += ((typeof(strCookieExpires) != "undefined") ? "; expires=" + objDateCookieExpires.toGMTString() : "") + ";";
	
	// set path and domain
	strCookieCmd += ((String(strCookiePath) > 0) ? "; path=" + strCookiePath : "") + ";";
	strCookieCmd += ((String(strCookieDomain) > 0) ? "; domain=" + strCookieDomain : "") + ";";

   // is cookie secure
   strCookieCmd += ((bCookieSecure) ? "; secure" : "");

   // set cookie
   document.cookie = strCookieCmd;
}


/*******************************************************************************************
	Get browser cookie
	
 *******************************************************************************************/
function getCookie(strCookieName) {
    var strPrefix = String(strCookieName) + "=";
    var nBegin = document.cookie.indexOf("; " + strPrefix);
    
	// check if cookie name is known
	// if not return null
	if (nBegin == (-1)) {
		nBegin = document.cookie.indexOf(strPrefix);
		
		if (nBegin == (-1)) {
	     	return (null);
		}
    }
    else {
        nBegin += 2;
    }
    
	// get end of cookie
	var nEnd = document.cookie.indexOf(";", nBegin);
	
    if (nEnd == (-1)) {
        nEnd = document.cookie.length;
    }
	
	// return cookie valie
    return (unescape(document.cookie.substring(nBegin + strPrefix.length, nEnd)));
}

/*******************************************************************************************
	Delete browser cookie
	
 *******************************************************************************************/
function deleteCookie(strCookieName, strCookiePath, strCookieDomain) {
	// cookie must exist
    if (getCookie(strCookieName)) {
        document.cookie = String(strCookieName) + "=" + 
            ((String(strCookiePath).length > 0) ? "; path=" + strCookiePath : "") +
            ((String(strCookieDomain).length > 0) ? "; domain=" + strCookieDomain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

/* end */
//-->