function createCookie(name, value, hours)
{
    if (hours)
    {
	var date = new Date();
	date.setTime(date.getTime() + (hours * 3600 * 1000));
	var expires = "; expires=" + date.toGMTString();
    }else
    {
	var expires = '';
    }
    
    document.cookie = name + '=' + value + expires + '; path=/';
}

function readCookie(name)
{
    var ca = document.cookie.split(';');
    
    for (i = 0; i < ca.length; i++)
    {
	var tmp = ca[i].split('=');
	while (tmp[0].charAt(0) == ' ') tmp[0] = tmp[0].substring(1, tmp[0].length);
	if (tmp[0] == name) return tmp[1];
    }
    
    return null;
}

function eraseCookie(name)
{
    createCookie(name, '', -1)
}
