// value : "property:value;property2:value2" 
// attribute : property
function getCookieAttribute(value, attribute) {
  var myPropertyList = value.split(";");
  for(var i=0;i<myPropertyList.length;i++) {
    var myProperty = myPropertyList[i];
    var separatorIndex = myProperty.indexOf(':');
    var property = myProperty.substring(0, separatorIndex);
    if (property == attribute) {
      var value = myProperty.substring(separatorIndex+1, myProperty.length);
      return value;
    }
  }
}

function getCookieValue(offset)
{
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function readCookie(nom)
{
var arg=nom+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen)
{
var j=i+alen;
if (document.cookie.substring(i, j)==arg) return getCookieValue(j);
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;
}
return null;
}
