    function is_cookie_enabled()
    {
        if(typeof navigator.cookieEnabled!='undefined')
            {
                return navigator.cookieEnabled;
            }
        
        set_cookie('testcookie','testwert',1);
        
        if(!document.cookie)
            {
                return false;
            }
        
        delete_cookie('testcookie');
        return true;        
    }
    
	function get_cookie( cookieName )
	{
	    strValue = false;
	    
	    if( strCookie = document.cookie )
	        {
	            if( arrCookie = strCookie.match( new RegExp( cookieName + '=([^;]*)', 'g')))
	                {
	                    strValue=RegExp.$1;
	                }
	        }
	    return(strValue);
	}

    function set_cookie(cookieName,cookieValue,intDays)
    {
        if(!is_cookie_enabled())
            {
                return false;
            }
            
        objNow = new Date();
        strExp = new Date( objNow.getTime() + ( intDays * 86400000) );
        document.cookie = cookieName + '=' + 
                          cookieValue + ';expires=' + 
                          strExp.toGMTString() + ';path=/;';
        return true;
    }

	// look for GET param 'plkey'
	
	s=location.search.substring(1, location.search.length).split('&');
	getVars = new Array();

	for(var i  = 0; i < s.length; i++) {

	        var parts = s[i].split('=');
        	getVars [unescape(parts[0])] = unescape(parts[1]);

    	}
	
	// set cookie
	if (getVars['plkey'] != undefined) {
		set_cookie('plkey', getVars['plkey'], 1);
	}
	
	// read cookie
	var plkey;
	var links;
	plkey= get_cookie('plkey');
	if (plkey!= false) {
	
	    // add GET param 'plkey' to all outgoing links
		links = document.getElementsByTagName("a");
		var count = 0;
		
		for (var i = 0; i < links.length; i++) {
			var link = links[i].href;
			if (link.indexOf(window.location.hostname) == -1) {
				count = count + 1;
				if (link.indexOf("?") > -1) {
				    links[i].href = link + '&plkey=' + plkey;
				} else {
				    links[i].href = link + '?plkey=' + plkey;
				}
			}
		}
	}
	