function get_cookie (cookie_name)
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return ( unescape ( results[2] ) );
else
return null;
}
//пример
var user = get_cookie('name');
document.write("Привет, "+user+");