//<--쿠기 관련 함수--
function Cookie() {
	var a = arguments ;
	this.prefix_     = ( a[0] ? a[0] + "_" : "" ) ;
	this.expiration_ = ( a[1] ? new Date( new Date( ).getTime( ) + a[1]*24*60*60*1000 ) : null ) ;
	this.path_       = ( a[2] ? a[2]       : null ) ;
	this.domain_     = ( a[3] ? a[3]       : null ) ;
	this.secure_     = ( a[4] ? a[4]       : false ) ;
	this.document_   = ( a[5] ? a[5]       : document ) ;
}
Cookie.prototype.remove = function ( key ) {
	var cookie  = this.prefix_ + key + "=" ;
	    cookie += "; expires=Fri, 02-Jan-1970 00:00:00 GMT" ;
	if( this.path_ )   cookie += "; path="   + this.path_ ;
	if( this.domain_ ) cookie += "; domain=" + this.domain_ ;
	if( this.secure_ ) cookie += "; secure=" + this.secure_ ;
	this.document_.cookie = cookie ;
}
Cookie.prototype.get = function ( key ) {
	var tmp1, tmp2, xx1, xx2, xx3, len ;
	tmp1 = " " + this.document_.cookie + ";" ;
	xx1 = xx2 = 0 ;
	len = tmp1.length ;
	while( xx1 < len ) {
		xx2  = tmp1.indexOf( ";", xx1 ) ;
		tmp2 = tmp1.substring( xx1 + 1, xx2 ) ;
		xx3  = tmp2.indexOf( "=" ) ;
		if( tmp2.substring( 0, xx3 ) == ( this.prefix_ + key ) ) {
			return( unescape( tmp2.substring( xx3 + 1, xx2 - xx1 - 1 ) ) ) ;
		}
		xx1 = xx2 + 1 ;
	}
	return( "" ) ;
}

Cookie.prototype.set = function ( key, value ) {
	var cookie = this.prefix_ + key + "=" + escape( value ) ;
	if( this.expiration_ ) cookie += "; expires=" + this.expiration_.toGMTString( ) ;
	if( this.path_ )       cookie += "; path="    + this.path_ ;
	if( this.domain_ )     cookie += "; domain="  + this.domain_ ;
	if( this.secure_ )     cookie += "; secure="  + this.secure_ ;
	this.document_.cookie = cookie ;
}

Cookie.prototype.setObject = function ( name, obj ) {
	var pairs = [], cookie, value = "";
	if(!cookie) { cookie = {}; }
	for(var prop in obj) {
		if(prop == null) {
			delete cookie[prop];
		} else if(typeof obj[prop] == "string" || typeof obj[prop] == "number") {
			cookie[prop] = obj[prop];
		}
	}
	prop = null;
	for(var prop in cookie) {
		pairs.push(escape(prop) + "=" + escape(cookie[prop]));
	}
	value = pairs.join("&");
	this.set(name, value);
}

Cookie.prototype.getObject = function ( name ) {
	var values = null;
	var cookie = this.get(name);
	if(cookie) {
		values = {};
		var pairs = cookie.split("&");
		for(var i = 0; i < pairs.length; i++) {
			var pair = pairs[i].split("=");
			var value = pair[1];
			if( isNaN(value) ) { value = unescape(pair[1]); }
			values[ unescape(pair[0]) ] = value;
		}
		return values;
	} else {
		return null;
	}
}
//--쿠기 관련 함수-->