	/*
		*	Window Manager Class
		* 	Author: Ark Rozycki
	*/


	var cookieMgr = new function(){
		// local cookie store (e.g. cookieMgr.cookie['state'])
		this.cookie = [];
	
		// sets the global cookie array
		this.setCookie = function(){
			var ckie = document.cookie;
			
			var nvpair = ckie.split(";")
			for(var i = 0; i < nvpair.length; i++){
				var keyval = nvpair[i].split("=");
				if(keyval.length > 0)
					this.cookie[$.trim(keyval[0])] = $.trim(keyval[1]);
			}
		};		
				
		// save the passed in values to a cookie, overwriting
		this.save = function(arrData){
			
			var exdate=new Date();
			exdate.setDate(exdate.getDate() + 365);
			
			// loop over the array and add each value to the cookie
			for (key in arrData){
				document.cookie = $.trim(key + "=" + escape(arrData[key]) + ";expires="+exdate.toUTCString());
			}
			
			// set the local store also
			this.setCookie();
		};
		
	};	
