/*
' **************************************************
' © VWA Software Development 2006
' Release: 1.01.0001
' Changed: Aug 17, 2006
' Author : Berco Wassink
' **************************************************
*/

// Get cookie value
function getCookie(sName, sDefault) {
	// Set cookie name
	var sArg = sName + "=";
	var iArgLength = sArg.length;
	
	// Check if cookie exists
	var sCookies = document.cookie;
	var iCookieStart = sCookies.search(new RegExp(sArg, "i"));
	if (iCookieStart >= 0) {
		var iCookieValueBegin = iCookieStart + iArgLength;
		var iCookieValueEnd = sCookies.indexOf(';', iCookieValueBegin);
		if (iCookieValueEnd == -1)
			iCookieValueEnd = sCookies.length;
		
		// Return cookie value
		return unescape(sCookies.substring(iCookieValueBegin, iCookieValueEnd));
	}
	
	// Return null if cookie not exists
	return sDefault;
}

// Write cookie value
function setCookie(sName, sValue, iExpiryDate) {
	// Set expiry date (1 year from now)
	var dCookieExpiry = new Date();
	//dCookieExpiry.setFullYear(dCookieExpiry.getFullYear() + 1);
	var dCookieExpiry = new Date(dCookieExpiry.getTime() + iExpiryDate * 24 * 60 * 60 * 1000); // plus n days
	
	// Set cookie
	document.cookie = sName + "=" + escape(sValue) + "; path=/; expires=" + dCookieExpiry.toGMTString() + ";";
}

// Delete cookie
function deleteCookie(sName) {
	// Cookie expires immediatly
	document.cookie = sName + "=; path=/; expires=Tue, 01-Jan-1980 00:00:00 GMT;";
}


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded()
