function findCookie(name) {

        if (!document.cookie || document.cookie == '') {     
        return ''; // unescape("customCards=");
        } 
	
	else {
        	var firstChar, lastChar;
        	var theBigCookie = document.cookie;
        	firstChar = theBigCookie.indexOf(name);
        	if(firstChar != -1)  {                
        		lastChar = theBigCookie.indexOf(';', firstChar);            
            
        		if(lastChar == -1) 
			lastChar = theBigCookie.length;
            
        		return unescape(theBigCookie.substring(firstChar, lastChar));
        	} 
	
		else {                
		return; // unescape("customCards=");        
        	}
    	}
}

function splitTheCookie(the_info,cookieName){

	var the_cookie = findCookie(cookieName);
	var firstChar = the_cookie.indexOf("=");
	var lastChar = the_cookie.length;	
	var the_values = the_cookie.substring(firstChar+1,lastChar);
	var separated_values = the_values.split("|");
	var property_value = "";

	for (var loop = 0; loop < separated_values.length; loop++){
		property_value = separated_values[loop];
		var broken_info = property_value.split("¤");
		var the_property = broken_info[0];
		var the_value = broken_info[1];
		the_info[the_property] = the_value;
	}
}

function getCookieValue(name){

	var _cookie = findCookie(name);
	if (!_cookie || _cookie == '') {
	  return false;
	}
	var firstChar = _cookie.indexOf("=");
	var lastChar = _cookie.length;
	
	var value = _cookie.substring(firstChar+1,lastChar);
	return value;
}

