
var blnIsStaging = false;

if(document.location.href.indexOf("stage") != -1)
{
	//blnIsStaging = true;
}

function redirectMe(whereTo)
{
	switch(whereTo)
	{
		case "fr" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.fr/index.htm?lc=fr";
				break;
			}
			else
			{
				document.location.href = "http://gamenextfr.stage.oberon-media.com/index.htm?lc=fr";
				break;
			}
		case "us" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.com/index.htm?lc=en";
				break;
			}
			else
			{
				document.location.href = "http://mstage10.oberon-media.com/index.htm?lc=en";
				break;
			}
		case "uk" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.co.uk/index.htm?lc=en";
				break;
			}
			else
			{
				document.location.href = "http://gamenext.stage.oberon-media.com/index.htm?lc=en";
				break;
			}
		case "de" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.de/index.htm?lc=de";
				break;
			}
			else
			{
				document.location.href = "http://gamenextde.stage.oberon-media.com/index.htm?lc=de";
				break;
			}
		case "nl" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.nl/index.htm?lc=nl";
				break;
			}
			else
			{
				document.location.href = "http://gamenextnl.stage.oberon-media.com/index.htm?lc=nl";
				break;
			}
		case "it" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.it/index.htm?lc=it";
				break;
			}
			else
			{
				document.location.href = "http://gamenextit.stage.oberon-media.com/index.htm?lc=it";
				break;
			}
		case "es" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.es/index.htm?lc=es";
				break;
			}
			else
			{
				document.location.href = "http://gamenextes.stage.oberon-media.com/index.htm?lc=es";
				break;
			}
		case "se" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.se/index.htm?lc=sv";
				break;
			}
			else
			{
				document.location.href = "http://gamenextse.stage.oberon-media.com/index.htm?lc=sv";
				break;
			}
		case "ch" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.ch/index.htm?lc=de";
				break;
			}
			else
			{
				document.location.href = "http://gamenextch.stage.oberon-media.com/index.htm?lc=de";
				break;
			}
		case "pl" :
			if(!blnIsStaging)
			{
				document.location.href = "http://www.gamenext.pl/index.htm?lc=en";
				break;
			}
			else
			{
				document.location.href = "http://gamenextpl.stage.oberon-media.com/index.htm?lc=en";
				break;
			}
		default :
			break;
	}
}

if (typeof (strCountryCode) == "undefined" || strCountryCode==undefined) {
    var domainRegexp = new RegExp(".*?\\.([^\\.]*?)/.*");
    var m = domainRegexp.exec(document.location.href);
    if (m != null && m.length >= 1) {
        strCountryCode = m[1];
        if (strCountryCode == "com")
            strCountryCode = "us";
    }
    else
        strCountryCode = "us";
}


var objCountrySelection = new Object();

objCountrySelection.fr = "";  if(strCountryCode == "fr"){objCountrySelection.fr = " selected"};
objCountrySelection.de = "";  if(strCountryCode == "de"){objCountrySelection.de = " selected"};
objCountrySelection.nl = "";  if(strCountryCode == "nl"){objCountrySelection.nl = " selected"};
objCountrySelection.it = "";  if(strCountryCode == "it"){objCountrySelection.it = " selected"};
objCountrySelection.es = "";  if(strCountryCode == "es"){objCountrySelection.es = " selected"};
objCountrySelection.se = "";  if(strCountryCode == "se"){objCountrySelection.se = " selected"};
objCountrySelection.pl = "";  if(strCountryCode == "pl"){objCountrySelection.pl = " selected"};
objCountrySelection.ch = "";  if(strCountryCode == "ch"){objCountrySelection.ch = " selected"};
objCountrySelection.us = "";  if(strCountryCode == "us"){objCountrySelection.us = " selected"};
objCountrySelection.uk = "";  if(strCountryCode == "uk"){objCountrySelection.uk = " selected"};

function writeSelector()
{
	document.write('			<select name="language" id="language" onChange="redirectMe(this.value);">');
	document.write('			<option value="fr"'+objCountrySelection.fr+'>French</option>');
	document.write('			<option value="de"'+objCountrySelection.de+'>German</option>');
	document.write('			<option value="nl"'+objCountrySelection.nl+'>Dutch</option>');
	document.write('			<option value="it"'+objCountrySelection.it+'>Italian</option>');
	document.write('			<option value="es"'+objCountrySelection.es+'>Spanish</option>');
	document.write('			<option value="se"'+objCountrySelection.se+'>Swedish</option>');
	document.write('			<option value="us"'+objCountrySelection.us+'>United States</option>');
	document.write('			<option value="uk"'+objCountrySelection.uk+'>United Kingdom</option>');
	document.write('			<option value="pl"'+objCountrySelection.pl+'>Poland</option>');
	document.write('			<option value="ch"'+objCountrySelection.ch+'>Switzerland</option>');
	document.write('			</select>');	
}
