// JavaScript Document
window.onload = getChoice();

var saveChoice = 0;

function clickChoice () {
	if (saveChoice == 1) {
		saveChoice = 0;
		document.getElementById("saveImg").src = "img/bewaar_niet.png";
	} else {
		saveChoice = 1;
		document.getElementById("saveImg").src = "img/bewaar.png";
	}
}
function setChoice(country) {
	if (saveChoice == 1) {
		var myDate=new Date();
		myDate.setFullYear(2100,0,14);
		document.cookie = "st100_country=" + country + "; expires=" + myDate;
	}
	return true;
}
function getChoice () {
	var cookies = document.cookie;
	var startCountry;
	var endCountry;
	var country;
	
	startCountry = cookies.indexOf("st100_country=");
	if (startCountry > -1) {
		startCountry = cookies.indexOf("=", startCountry) + 1;
		endCountry = cookies.indexOf(";", startCountry);
		if (endCountry == -1) {
			endCountry = cookies.length;	
		}
		country = unescape(cookies.substring(startCountry, endCountry));
		switch (country) {
			case "BE":
				window.location = "http://www.studio100.be/index2.html";
				break;
			case "WAL":
				window.location = "http://www.plopsa.tv";
				break;
			case "NL":
				window.location = "http://subsites.studio100.be/st100nl/";
				break;
		}
	}
}