// JavaScript Document

function createCookie(country,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = country+"="+value+expires+"; path=/; domain=gioteck.com;";
	
	if (value=="uk") {
	parent.location = "http://www.gioteck.com";
	} else if (value=="usa") {
	parent.location = "http://usa.gioteck.com";	
	} else if (value=="world") {
	parent.location = "http://www.gioteck.com";	
	}
}

function supportCookie(country,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = country+"="+value+expires+"; path=/; domain=gioteck.com;";
	
	if (value=="uk") {
	window.location = "http://www.gioteck.com/wordpress/?page_id=850";
	} else if (value=="usa") {
	window.location = "http://usa.gioteck.com/?page_id=850";	
	} else if (value=="world") {
	window.location = "http://www.gioteck.com/wordpress/?page_id=850";	
	}
}

function readCookie(country) {
	var countryEQ = country + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(countryEQ) == 0) return c.substring(countryEQ.length,c.length);
	}
	return null;
}

function eraseCookie(country) {
	createCookie(country,"",-1);
}

