﻿/// <reference path="~/Scripts/ByteStorm/_BSC_Interface.js" />
(function(){
	BSC.C = function()
    {
    	return {
			/// <summary>
			/// @Author		: Rasmus Tomi-Gottschau (rtg@beautifulpeople.com)
			/// @Created	: 2008-11-10
			/// @LastChange : 2008-11-10
			/// 
			/// @History
			///				2008-11-10	: (RTG) Created.
			/// @Description
			///				Constructor for ProfileRepository
    		/// </summary>
			Cookie:function()
		    {

		    },

		    /// <summary>
		    /// @Author		: Rasmus Tomi-Gottschau (rtg@beautifulpeople.com)
		    /// @Created	: 2008-11-10
		    /// @LastChange : 2008-11-10
		    /// 
		    /// @History
		    ///				2008-11-10	: (RTG) Created.
		    /// @Description
		    ///				Constructor for ProfileRepository
		    /// </summary>
		    Get: function(name)
		    {
                var nameEQ = name + "=";
	            var ca = document.cookie.split(';');
	            for(var i=0;i < ca.length;i++) {
		            var c = ca[i];
		            while (c.charAt(0)==' ') c = c.substring(1,c.length);
		            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	            }
	            return null;
		    },

		    /// <summary>
		    /// @Author		: Rasmus Tomi-Gottschau (rtg@beautifulpeople.com)
		    /// @Created	: 2008-11-10
		    /// @LastChange : 2008-11-10
		    /// 
		    /// @History
		    ///				2008-11-10	: (RTG) Created.
		    /// @Description
		    ///				Constructor for ProfileRepository
		    /// </summary>
		    Set: function(name, value, days)
		    {
		        if (days) {
		            var date = new Date();
		            date.setTime(date.getTime()+(days*24*60*60*1000));
		            var expires = "; expires="+date.toGMTString();
	            }
	            else var expires = "";
	            document.cookie = name+"="+value+expires+"; path=/";
		    },

		    /// <summary>
		    /// @Author		: Rasmus Tomi-Gottschau (rtg@beautifulpeople.com)
		    /// @Created	: 2008-11-10
		    /// @LastChange : 2008-11-10
		    /// 
		    /// @History
		    ///				2008-11-10	: (RTG) Created.
		    /// @Description
		    ///				Constructor for ProfileRepository
		    /// </summary>
		    Remove: function(name)
		    {
		        createCookie(name,"",-1);
		    }	
		};
    }();
})();    
/*
http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
*/
