var utils = {};
var HOST = '';
utils.cookie = (function() {
    return{get:function(name) {
            var prefix = name + '=';
		    var c = document.cookie;
		    var nullstring = '';
		    var cookieStartIndex = c.indexOf(prefix);
		    if (cookieStartIndex == -1)
		        return nullstring;
		    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
		    if (cookieEndIndex == -1)
		        cookieEndIndex = c.length;
		    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
    },set:function(name, value, expires, path, domain, secure) {
		var today = new Date();
		today.setTime( today.getTime() );
		if ( expires ) {
			expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		var tempCookie = name+"="+( value ) +
			( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
			( ( path ) ? ";path=" + path : "" ) +
			( ( domain ) ? ";domain=" + domain : "" ) +
			( ( secure ) ? ";secure" : "" );
		//alert('setting cookie:\n'+tempCookie);
		document.cookie = tempCookie;
    },remove:function( name, path, domain ) {
		if ( this.get( name ) ) document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
	}
}());