<!--
/* ---------------------------------------------
 * Created:		20.02.2007
 * Revision:		11.03.2007
 * Author:		Philippe Jos
 * Copyrights:		Philippe Jos
 * Email:		jos.philippe@wanadoo.fr
 * ---------------------------------------------
 */

function Cookie(name) {
	this._name = name;								

	var cookies = document.cookie;							
	if (cookies == "") return;							
    	cookies = cookies.split(';');							

	var cookie = null;
	for(var i = 0; i < cookies.length; i++) {					
        	if ( cookies[i].substring(0, name.length+1) == (name + "=")) {		
            		cookie = cookies[i];						
            		break;								
        	}
	}

	if (cookie == null) return;							

	var value = cookie.substring( name.length+1 );					

	var arr = value.split('&');							
	for( var i=0; i < arr.length; i++ ) arr[i] = arr[i].split(':');			

											
	for( i=0; i < arr.length; i++)							
		this[arr[i][0]] = decodeURIComponent(arr[i][1]);			
}


Cookie.Enabled = function( ) {
    
    if (navigator.cookieEnabled != undefined) return( navigator.cookieEnabled );		

    if (Cookie.Enabled.Cache != undefined) return( Cookie.Enabled.Cache );			

    document.cookie = "dummy=test; max-age=10000";						

    
    var cookies = document.cookie;								
    if (cookies.indexOf("dummy=test") == -1) return(Cookie.Enabled.Cache=false);		
    else {											
        document.cookie = "dummy=test; max-age=0"; 					
        return( Cookie.Enabled.Cache = true );							
    }
}

Cookie.prototype.Store = function( daysToLive, path, domain, secure ) {
	var value = new Array();
												
	for(var prop in this) {									
		if ( prop.charAt(0) == "_" || typeof this[prop] == "function" ) continue;		
		value.push( prop + ":" + encodeURIComponent(this[prop]) );			
 	}
															
	var cookie = new Array();									
	cookie.push( this._name + "=" + value.join("&") );				

	if(daysToLive!=null){
		var expires = new Date();
		expires.setTime( expires.getTime() + (daysToLive*24*60*60*1000) );					
		cookie.push("expires=" + expires.toUTCString() );				
	}

	if (path) cookie.push( "path=" + path );
	if (domain) cookie.push( "domain=" + domain );
	if (secure) cookie.push( "secure" );
    
	document.cookie = cookie.join("; ");							
}

Cookie.prototype.Remove = function( path, domain, secure ) {
    
    for(var prop in this)									
        if (prop.charAt(0) != "_" && typeof this[prop] != "function") delete this[prop];	
   
    this.Store(0, path, domain, secure);							
}

//-->