
var countryString = ' , ,Select your country,';
countryString += 'english,United States – English,Select your country,';
countryString += 'spanish,United States - Español,Seleccione su país,';
countryString += ',---------------------,Select your country,';
countryString += 'ar,Argentina - Español,Seleccione su país,';
countryString += 'english,Australia - English,Select your country,';
countryString += 'german,Austria - Deutsch,Wählen Sie ein Land,';
countryString += 'dutch,Belgium – Nederlands,Selecteer uw land,';
countryString += 'french,Belgium – Français,Choisissez vôtre pays,';
countryString += 'bo,Bolivia – Español,Seleccione su país,';
countryString += 'english,Botswana – English,Select your country,';
countryString += 'br,Brazil – Português,Selecione seu país,';
countryString += 'english,Canada – English,Select your country,';
countryString += 'cafr,Canada – Français,Choisir son pays,';
countryString += 'ci,Chile – Español,Seleccione su país,';
countryString += 'co,Colombia – Español,Seleccione su país,';
countryString += 'cr,Costa Rica – Español,Seleccione su país,';
countryString += 'hr,Croatia – Hrvatski,Odaberite državu,';
countryString += 'greek,Cyprus – Ελληνικά,Επιλέξτε χώρα,';
countryString += 'cz,Czech Republic – Čeština,Zvolte svou zem,';
countryString += 'dk,Denmark – Dansk,Vælg dit land,';
countryString += 'spanish,Dominican Republic – Español,Seleccione su país,';
countryString += 'ec,Ecuador - Español,Seleccione su país,';
countryString += 'ee,Estonia – Eesti,Valige asukohariik,';
countryString += 'fi,Finland – Suomi,Valitse maa,';
countryString += 'fr,France – Français,Choisissez vôtre pays,';
countryString += 'german,Germany - Deutsch,Wählen Sie ein Land,';
countryString += 'greek,Greece – Ελληνικά,Επιλέξτε χώρα,';
countryString += 'hk,Hong Kong - 粵語,選擇你的國家,';
countryString += 'hu,Hungary – Magyar,Válassza ki az országát,';
countryString += 'is,Iceland – Íslenska,Veldu land,';
countryString += 'english,India – English,Select your country,';
countryString += 'id,Indonesia – Bahasa Indonesia,Pilih negara Anda,';
countryString += 'uk,Ireland - English,Select your country,';
countryString += 'il,Israel - עברי,בחר במדינה שלך,';
countryString += 'it,Italy – Italiano,Seleziona il tuo paese,';
countryString += 'english,Jamaica – English,Select your country,';
//countryString += 'jp,Japan - 日本語,国を選択してください,';
countryString += 'kp,Korea – 한국어,국가 선택,';
countryString += 'lv,Latvia – Latviešu,Select your country,';
countryString += 'english,Lesotho – English,Select your country,';
countryString += 'lt,Lithuania – Lietuvių,Pasirinkite savo šalį,';
//countryString += 'mo,Macao - 中文,Select your country,';
countryString += 'english,Malaysia – English,Select your country,';
countryString += 'myba,Malaysia - Bahasa Melayu,Pilih negara anda,';
countryString += 'mych,Malaysia - 中文,選擇你的國家,';
countryString += 'mx,Mexico – Español,Seleccione su país,';
countryString += 'english,Namibia – English,Select your country,';
countryString += 'dutch,Netherlands – Nederlands,Selecteer uw land,';
countryString += 'english,New Zealand – English,Select your country,';
countryString += 'no,Norway – Norsk,Velg landet ditt,';
countryString += 'pa,Panama – Español,Seleccione su país,';
countryString += 'pe,Peru – Español,Seleccione su país,';
countryString += 'english,Philippines – English,Select your country,';
countryString += 'pl,Poland – Polski,Wybierz swój kraj,';
countryString += 'pt,Portugal – Português,Seleccione o seu país,';
countryString += 'spanish,Puerto Rico – Español,Seleccione su país,';
countryString += 'russian,Russian Federation – Русский,Выберите страну,';
countryString += 'english,Singapore – English,Select your country,';
countryString += 'sk,Slovak Republic – Slovenčina,Vyberte si vašu krajinu,';
countryString += 'english,South Africa – English,Select your country,';
countryString += 'spanish,Spain – Español,Seleccione su país,';
countryString += 'english,Swaziland – English,Select your country,';
countryString += 'se,Sweden - Svenska,Välj land,';
countryString += 'sz,Switzerland - Français,Choisissez vôtre pays,';
countryString += 'german,Switzerland - Deutsch,Wählen Sie ein Land,';
countryString += 'tw,Taiwan - 中文,選擇你的國家,';
countryString += 'english,Thailand – English,Select your country,';
countryString += 'th,Thailand – ไทย,เลือกประเทศของคุณ,';
countryString += 'tr,Turkey – Türkçe,Dil seçimi,';
countryString += 'russian,Ukraine – Україна,Выберите страну,';
countryString += 'uk,United Kingdom – English,Select your country,';
countryString += 've,Venezuela – Español,Seleccione su país,';
countryString += 'english,Zambia – English,Select your country,';

var countryArray = countryString.split(",");   
var countryc;

function PageQuery(q) {
	if(q.length > 1){
		this.q = q.substring(1, q.length);
	} else {
		this.q = null;
	}
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }	
}

function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}

var strCCtxt;
var strSelectTxt = 'Select your country &nbsp;<select name="lstCountry" id="lstCountry" style="font-size:11px; border:1px solid #999999;" tabindex="1" onChange="select_language(this.value)"><option value="" >Select your country</option>';

//selectCountry('cc','cname');

function selectCountry(key,name){
if(queryString(key)=='false') 
{
	if(queryString('pg') == 'false')
	{
		strCCtxt = 'Select your country &nbsp;<select name="lstCountry" id="lstCountry" style="font-size:11px; border:1px solid #999999;" tabindex="1" onChange="select_language(this.value)"><option value="" selected="selected">Select your country</option>';

		for(i=3;i<=countryArray.length-2;i=i+3) {
			strCCtxt = strCCtxt + '<option value="'+ countryArray[i] +'" ' + '>' + countryArray[i+1] + '</option>'+ '\n';
		}
		strCCtxt = strCCtxt + '</select>';
		return;
	} else {
		countryc = get_cookie("hids_countrycode");
		//alert('getting cookie: ' + countryc);
		if (!countryc) {
			//alert('no cookie');
			strCCtxt = 'Select your country &nbsp;<select name="lstCountry" id="lstCountry" style="font-size:11px; border:1px solid #999999;" tabindex="1" onChange="select_language(this.value)"><option value="" selected="selected">Select your country</option>';
	
			for(i=3;i<=countryArray.length-2;i=i+3) {
				strCCtxt = strCCtxt + '<option value="'+ countryArray[i] +'" ' + '>' + countryArray[i+1] + '</option>'+ '\n';
			}
			strCCtxt = strCCtxt + '</select>';
			return;
		} else {
			//alert('got cookie: ' + countryc);
			for(i=3;i<=countryArray.length-2;i=i+3) {
				isSelected = '';
				if(countryc == countryArray[i+1]) {
					isSelected = 'selected="selected"';
					strSelectTxt = countryArray[i+2]+'&nbsp;<select name="lstCountry" id="lstCountry" style="font-size:11px; border:1px solid #999999;" tabindex="1" onChange="select_language(this.value)"><option value="">'+countryArray[i+2]+'</option>';
				}
				strCCtxt = strCCtxt + '<option value="'+ countryArray[i] +'" '+ isSelected + '>' + countryArray[i+1] + '</option>'+ '\n';
			}
			strCCtxt = strCCtxt + '</select>';
			strCCtxt = strSelectTxt + strCCtxt;
		}
	}
}else{
	cCode = queryString(key);
	cName = queryString(name);
	set_cookie ("hids_countrycode", cName,'/',0);
	
	for(i=3;i<=countryArray.length-2;i=i+3) {
		isSelected = '';
		if(cName == countryArray[i+1]) {
			isSelected = 'selected="selected"';
			strSelectTxt = countryArray[i+2]+'&nbsp;<select name="lstCountry" id="lstCountry" style="font-size:11px; border:1px solid #999999;" tabindex="1" onChange="select_language(this.value)"><option value="">'+countryArray[i+2]+'</option>';
		}
		strCCtxt = strCCtxt + '<option value="'+ countryArray[i] +'" '+ isSelected + '>' + countryArray[i+1] + '</option>'+ '\n';
	}
	strCCtxt = strCCtxt + '</select>';
	strCCtxt = strSelectTxt + strCCtxt;
	//alert(strCCtxt);

}
}

