/*  ##########################################################################
'	##########################################################################

' 	cookieManager.js

'	Author(s)
' 	Ian Causton, IC, ian.causton@akqa.com

' 	Copyright 2004 AKQA.  All rights reserved.

'	Version 1.00
'	Created: 28/05/2004
'	Last modified: 28/05/2004

'	Versions:
' 	1.00 - Initial version - IC

	##########################################################################
	##########################################################################
*/

// Constructor
function CookieManager()
{
  	// public properties
	
	// create public functions
	this.setCookie = function (name, value){
		var exp = new Date();
		var sixmonthslater = exp.getTime() + (180 * 24 * 60 * 60 * 1000);
		exp.setTime(sixmonthslater);
		document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/;";
	}

	this.getCookieValue = function (strCookieName) {
		var pos = document.cookie.indexOf(strCookieName + '=');
		if (pos != -1) {
			var startpos = pos + strCookieName.length + 1;
			var endpos = document.cookie.indexOf(";",startpos);
			if(endpos == -1){
				endpos = document.cookie.length;
			}
			var cookieValue = document.cookie.substring(startpos, endpos);
			return cookieValue;
		} else {
			return '';
		}
	}

	// Use this function to delete a cookie.
	// not needed on the live site. Purely used for testing purposes
	this.delCookie = function (name) {
		document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
	}
}

// private functions

