function setH3Lang(c_name,value,expiredays,url)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
window.location.replace(url);
}

function getH3Lang(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function checkH3Lang()
{
he3langselect=getH3Lang('h3lang');
if (he3langselect!=null && he3langselect!="")
  {
	switch (he3langselect)
	{
	case 'english':
	window.location.replace("http://www.discoverychannel.co.uk/games/helium3/");
	break;
	case 'deutsch':
	window.location.replace("http://www.dmax.de/games/helium3/");
	break;
	case 'espanol':
	window.location.replace("http://www.tudiscovery.com/juegos/helium3/");
	break;
	case 'portugues':
	window.location.replace("http://www.discoverybrasil.com/jogos/helium3/");
	break;
	}
  }
}
