// thanks to http://www.netkontoret.dk/jscookies.htm
// cookies

var cookieDefault = {};
cookieDefault.domain = 'www.kinkylogic.com';
cookieDefault.path = '/';


function getCookie(cname){
	if (document.cookie.length > 0){
		begin = document.cookie.indexOf(cname+"="); 
		if (begin != -1) begin += cname.length+1; 
		end = document.cookie.indexOf(";", begin);
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(begin, end));
	} 
	return false; 
}

function setCookie(cname, value, expiredays){
	var c,ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	c = cname + "=" + escape(value);
	c += ((expiredays) ? "; expires=" + ExpireDate.toGMTString() : '') +
	'domain='+cookieDefault.domain+'; path='+cookieDefault.path;
	document.cookie = c;
}

function delCookie (cname){
	if (getCookie(cname)) {
		document.cookie = cname + '=' +
		'domain='+cookieDefault.domain+'; path='+cookieDefault.path +
		'; expires=Thu, 01-Jan-70 00:00:01 GMT';
	}
}

// --------------------

changeFormat = function(changeTo){
	setCookie('siteVersion',changeTo,30);
//	alert('changed cookie to ' + changeTo);
	if(js11) window.location.replace('../index_detect.html');
	else window.location = '../index_detect.html';
}

changeFormatFlash = function(changeTo){
	setCookie('siteVersion',changeTo,30);
	if(js11) window.opener.location.replace('../index_detect.html');
	else window.opener.location = '../index_detect.html';
	window.opener.focus();
	window.close();
}