var today = new Date();
var the_day = today.getDate();
var the_month = today.getMonth();

the_month = the_month + 1;
var the_year = today.getYear();
the_year = (the_year < 1000) ? the_year + 1900 : the_year;
today.setYear(++the_year);

var ImageSwitch = 0;

function getSwitch()
{
	var newswitch = 1;
	
	if(document.cookie != '') {
		var CookieSwitch = "Switch";
		var firstChar, lastChar;
		var theCookie = document.cookie;
		firstChar = theCookie.indexOf(CookieSwitch);
		var NN2Hack = firstChar + CookieSwitch.length;
		if((firstChar != -1) && (theCookie.charAt(NN2Hack) == '=')) {
			firstChar += CookieSwitch.length + 1;
			lastChar = theCookie.indexOf(';',firstChar);
			if(lastChar == -1) lastChar = theCookie.length;
			ImageSwitch = unescape(theCookie.substring(firstChar, lastChar));
		}
	}

	if(ImageSwitch == 0) newswitch = 1;
	else newswitch = 0;

	var the_cookie = "Switch=" + escape(newswitch) + ";path=/" + ";expires=" + today.toGMTString();
	document.cookie = the_cookie;
	
	return(ImageSwitch);
}

