searchcountries = new Array (
["Select your Location (Language)",""], // 00
["Africa - Choose one:",""],			// 01
["\xA0Algeria (French)","http://www.richco.fr/"],	// 02
["\xA0Morocco (French)","http://www.richco.fr/"],	// 03
["\xA0Tunisia (French)","http://www.richco.fr/"],	// 04
["\xA0Other Countries (English)","http://www.richco.co.uk/"], //05
["----------",""], // 06
["North America - Choose one:",""], // 07
["\xA0Canada (English)","http://www.richco-inc.com/default_usa.php"], // 08
["\xA0Mexico (Spanish)","http://www.richco.com.mx"], // 09
["\xA0USA (English)","http://www.richco-inc.com/default_usa.php"], // 10
["South America - Choose one:",""], // 11
["\xA0South America (English)","http://www.richco-inc.com/default_usa.php"], // 12
["\xA0South America (Spanish)","http://www.richco.com.mx/"], //13
["----------",""], // 14
["Asia - Choose One:",""], // 15
["\xA0China (Chinese)","http://www.richco.cn/"], // 16
["\xA0Korea (English)","http://www.richco.com.sg/"], // 17
["\xA0Japan (Japanese)","http://www.richco.co.jp/"],  // 18
["\xA0India (English)","http://www.richco.com.sg/"], // 19
["\xA0Indonesia (English)","http://www.richco.com.sg/"], // 20
["\xA0Malaysia (English)","http://www.richco.com.sg/"], // 21
["\xA0Philippines (English)","http://www.richco.com.sg/"], // 22
["\xA0Singapore (English)","http://www.richco.com.sg/"], // 23
["\xA0Thailand (English)","http://www.richco.com.sg/"], // 24
["\xA0Other Countries (English)","http://www.richco.com.sg/"], // 25
["----------",""], // 26
["Europe - Choose One:",""], // 27
["\xA0Austria (German)","http://www.richco-plastic.de/"], // 28
["\xA0Belarus (Russian)","http://www.richco.ru/"], // 29
["\xA0Belgium (English)","http://www.richco.nl/"], // 30
["\xA0Bulgaria (English)","http://www.richco-inc.com/sites/de-en/"], // 31
["\xA0Croatia (English)","http://www.richco-inc.com/sites/de-en/"], // 32
["\xA0Czech Republic (English)","http://www.richco-inc.com/sites/de-en/"], //33
["\xA0Denmark (English)","http://www.richco.co.uk/"], // 34
["\xA0Estonia (English)","http://www.richco.fi/"], // 35
["\xA0Finland (English)","http://www.richco.fi/"], // 36
["\xA0France (French)","http://www.richco.fr/",], // 37
["\xA0Germany (German)","http://www.richco-plastic.de/"], // 38
["\xA0Greece (English)","http://www.richco.co.uk/"], // 39
["\xA0Hungary (English)","http://www.richco-inc.com/sites/de-en/"], // 40
["\xA0Italy (Italian)","http://www.richco.it/"], // 41
["\xA0Latvia (English)","http://www.richco.fi/"], // 42
["\xA0Lithuania (English)","http://www.richco.fi/"], // 43
["\xA0Netherlands (English)","http://www.richco.nl/"], // 44
["\xA0Norway (English)","http://www.richco.co.uk/"], // 45
["\xA0Poland (English)","http://www.richco-inc.com/sites/de-en/"], // 46
["\xA0Portugal (Spanish)","http://www.richco.es/"], // 47
["\xA0Romania (English)","http://www.richco-inc.com/sites/de-en/"], // 48
["\xA0Russia (Russian)","http://www.richco.ru/"], // 49
["\xA0Slovakia (English)","http://www.richco-inc.com/sites/de-en/"], // 50
["\xA0Slovenia (English)","http://www.richco-inc.com/sites/de-en/"], // 51
["\xA0Spain (Spanish)","http://www.richco.es/"], // 52
["\xA0Sweden (English)","http://www.richco.se/"], // 53
["\xA0Switzerland (German)","http://www.richco-plastic.de/"], // 54
["\xA0Turkey (English)","http://www.richco.co.uk/"], // 55
["\xA0Ukraine (Russian)","http://www.richco.ru/"], // 56
["\xA0United Kingdom (English)","http://www.richco.co.uk/"], // 57
["\xA0Yugoslavia (English)","http://www.richco-inc.com/sites/de-en/"], // 58
["\xA0Other Countries (English)","http://www.richco.co.uk/"], // 59
["----------",""], // 60
["Middle East - Choose One:",""], // 61
["\xA0Israel (English)","http://www.richco-inc.com/default_usa.php"], // 62
["\xA0Kingdom of Saudi Arabia (English)","http://www.richco.co.uk/"], // 63
["\xA0Other Countries (English)","http://www.richco.co.uk/"], // 64
["----------",""], // 65
["Oceania - Choose One:",""], // 66
["\xA0Australia (English)","http://www.richco.com.sg/"], // 67
["\xA0New Zealand (English)","http://www.richco.com.sg/"], // 68
["\xA0Other Countries (English)","http://www.richco.com.sg/"] // 69
);


function getCookieVal( offset ) {
	var endstr = document.cookie.indexOf( ";", offset );
	if( endstr == -1 )
	{
		endstr = document.cookie.length;
	}
	return unescape( document.cookie.substring( offset, endstr ) );
}

function GetCookie( name ) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while( i < clen ) {
		var j = i + alen;
		if( document.cookie.substring( i, j ) == arg ) {
			return getCookieVal( j );
		}
		i = document.cookie.indexOf(" ", i ) + 1;
		if( i == 0 ) {
		break;
		}
	}
	return null;
}

function FixCookieDate( date ) {
	var base = new Date( 0 );
	var skew = base.getTime(); // dawn of( Unix) time - should be 0
	if( skew > 0 )  // Except on the Mac - ahead of its time
	{
		date.setTime( date.getTime() - skew );
	}
}

function SetCookie( name, value, expires, path, domain, secure ){
	document.cookie = name + "=" + escape( value ) +
	( ( expires ) ? "; expires=" + expires.toGMTString() : "" ) +
	( ( path ) ? "; path=" + path : "" ) +
	( ( domain ) ? "; domain=" + domain : "" ) +
	( ( secure ) ? "; secure" : "" );
}

function setCookies(locn){
	expiry=60*60*24*365*1000;
	var expDate=new Date();
	FixCookieDate(expDate);
	expDate.setTime(expDate.getTime()+expiry);
	SetCookie("RCcom",locn,expDate,'/',null,null);
}

function setupCookie() {
	var pers_locationText="";
	thisForm = document.forms[0];
	pers_location = thisForm.countrySelect.options[thisForm.countrySelect.selectedIndex].value;
	pers_locationText = thisForm.countrySelect.options[thisForm.countrySelect.selectedIndex].text;
	expdate = new Date ();
	FixCookieDate (expdate); 
	expdate.setTime (expdate.getTime() + (365 * 86400000 * 3));
	cookieVal = "" + "!" + "" + "!" + pers_location + "!" + pers_locationText + "!" + 
				"" + "!" + "" + "!" + ""  + "!" + null + "!" + null + "!" + "" + "!" + 
				null + "!" + null + "!" +"" + "!" + "" + "!" + "" ;
	SetCookie("RCuserDetails", cookieVal,expdate,'/');
}

function fnShowAllCtry(field,formName) {
	var tmpVal;
	var tmpLoc;
	formName = 'countryOptions';
	var totalElements = searchcountries.length;
  optElm = document.forms[formName].elements[field];
	for( j = 0 ; j < totalElements ; j++ )
	{
		tmpVal = searchcountries[j][1];
		optElm.options[j] = new Option( searchcountries[j][0], tmpVal );
		if (searchcountries[j][0] == ("Select your Location"))
		{
			optElm.options[j].selected = "true";
		}
		
	}
	tmpLoc = GetCookie("RCuserDetails");
	if (tmpLoc > 0) { optElm.options[tmpLoc].selected = "true"; }
	
}