﻿var countries=["N/A|请选择国家","AL|Albania 阿尔巴尼亚","AR|Argentina 阿根廷","AU|Australia 澳大利亚","AT|Austria 奥地利","AZ|Azerbaijan 阿塞拜疆","BS|Bahamas 巴哈马群岛","BH|Bahrain 巴林","BD|Bangladesh 孟加拉国","BB|Barbados 巴巴多斯岛","BY|Belarus 白俄罗斯","BE|Belgium 比利时","BM|Bermuda 百慕大群岛","BO|Bolivia 玻利维亚","BA|Bosnia Herzegovina 波斯尼亚黑塞哥维那","BW|Botswana 博茨瓦纳","BR|Brazil 巴西","VG|British Virgin Islands 英属维尔京群岛","BN|Brunei Darussalam 文莱达鲁萨兰国","BG|Bulgaria 保加利亚","KH|Cambodia 柬埔寨","CM|Cameroon 喀麦隆","CA|Canada 加拿大","KY|Cayman Islands 开曼群岛","CL|Chile 智利","CN|China 中国","CO|Colombia 哥伦比亚","CG|Congo 刚果","CK|Cook Islands 科克岛","CR|Costa Rica 哥斯答黎加","HR|Croatia 克罗地亚","CU|Cuba 古巴","CY|Cyprus 塞浦路斯","CZ|Czech Republic 捷克共和国","DK|Denmark 丹麦","DO|Dominican Republic 多米尼加共和国","EC|Ecuador 厄瓜多尔","EG|Egypt 埃及","EE|Estonia 爱沙尼亚","ET|Ethiopia 埃塞俄比亚","FJ|Fiji 斐济","FI|Finland 芬兰","FR|France 法国","PF|French Polynesia 玻利尼西亚","GA|Gabon 加蓬","GM|Gambia 冈比亚","GE|Georgia 乔治亚州","DE|Germany 德国","GI|Gibraltar 直布罗陀","GR|Greece 希腊","GL|Greenland 格陵兰","GD|Grenada 格林纳答","GP|Guadeloupe 瓜德罗普岛","GU|Guam 关岛","GT|Guatemala 危地马拉","HT|Haiti 海地","HN|Honduras 洪都拉斯","HK|Hong Kong 中国香港","HU|Hungary 匈牙利","IS|Iceland 冰岛","IN|India 印度","ID|Indonesia 印尼","IR|Iran 伊朗","IQ|Iraq 伊位克","IE|Ireland(Republic of) 爱尔兰共和国","IL|Israel 以色列","IT|Italy 意大利","JM|Jamaica 牙买加","JP|Japan 日本","JO|Jordan 约旦","KZ|Kazakhstan 哈萨克斯坦共和国","KE|Kenya 肯尼亚","KW|Kuwait 科威特","KG|Kyrgyzstan 吉尔吉斯斯坦","LA|Laos 老挝","LV|Latvia 拉脱维亚","LB|Lebanon 黎巴嫩","LY|Libya 利比亚","LI|Liechtenstein 列支敦士登","LT|Lithuania 立陶宛","LU|Luxembourg 卢森堡","MO|Macau 中国澳门","MK|Macedonia 马其顿","MY|Malaysia 马来西亚","MV|Maldives 马尔代夫","ML|Mali 马里","MT|Malta 马耳地","MU|Mauritius 毛里求斯","MX|Mexico 墨西哥","FM|Micronesia 密克罗尼西亚","MD|Moldova 摩尔多瓦","MN|Mongolia 蒙古","MA|Morocco 摩洛哥","MZ|Mozambique 莫桑比克","MM|Myanmar 缅甸","NA|Namibia 纳米比亚","NP|Nepal 尼泊尔","AN|Netherlands Antilles 荷属安的列斯群岛","NL|Netherlands 荷兰","NC|New Caledonia 新喀里多尼亚","NZ|New Zealand 新西兰","NI|Nicaragua 尼加拉瓜","NG|Nigeria 尼日利亚","NF|Norfolk Island 诺福克岛","KP|North Korea 朝鲜","MP|Northern Mariana Island 北马里亚那群岛","NO|Norway 挪威","OM|Oman 阿曼","PK|Pakistan 巴基斯坦","PW|Palau 帕劳","PA|Panama 巴拿马","PY|Paraguay 巴拉圭","PE|Peru 秘鲁","PH|Philippines 菲律宾","PL|Poland 波兰","PT|Portugal 葡萄牙","PR|Puerto Rico 波多黎各","QA|Qatar 卡塔尔","RO|Romania 罗马尼亚","RU|Russia 俄罗斯","SH|Saint Barthelemy 圣巴特勒米","WS|Samoa 萨摩亚","XX|San Martin (F) 桑河","SA|Saudi Arabia 沙特阿拉伯","SN|Senegal 塞内加尔","CS|Serbia 塞尔维亚","SC|Seychelles 塞舌尔","SG|Singapore 新加坡","SK|Slovakia 斯洛伐克","SI|Slovenia 斯洛文尼亚","ZA|South Africa 南非","KR|South Korea 韩国","ES|Spain 西班牙","LK|Sri Lanka 斯里兰卡","KN|St Kitts & Nevis 圣基茨和尼维斯","LC|St Lucia 露西娅","VC|St Vincent & Grenadines 圣文森特和格林纳丁斯","SZ|Swaziland 斯威士兰","SE|Sweden 瑞典","CH|Switzerland 瑞士","SY|Syria 叙利亚","TJ|Tadjikistan 塔吉克斯坦","TW|Taiwan 中国台湾","TZ|Tanzania 坦桑尼亚","TH|Thailand 泰国","TG|Togo 多哥","TO|Tonga 汤加","TT|Trinidad & Tobago 特立尼达岛和多巴哥岛","TN|Tunisia 突尼斯","TR|Turkey 土耳其","TM|Turkmenistan 土库曼斯坦","TC|Turks & Caicos Island 特克斯和凯科斯群岛","UG|Uganda 乌干达","UA|Ukraine 乌克兰","AE|United Arab Emirates 阿拉伯联合酋长国","GB|United Kingdom 英国","US|United States 美国","UY|Uruguay 乌拉圭","UZ|Uzbekistan 乌兹别克斯坦","VU|Vanuatu 瓦努阿图","VE|Venezuela 委内瑞拉","VN|Vietnam 越南","VI|Virgin Islands (USA) 美国维尔京群岛","YE|Yemen Republic 也门","CD|Zaire 扎伊尔","ZM|Zambia 赞比亚","ZW|Zimbabwe 津巴布韦"];
var cities=new Array();
function addOptions(optionList,optionMenu)
{
n=optionList.length;
for (var i=0; i < n; i++) {
var arrCodeName=optionList[i].split("|");
optionMenu[i]=new Option(arrCodeName[1],arrCodeName[0]);}}
function removeOptions(optionMenu){
for(var i=optionMenu.options.length-1; i>=0; i--){
optionMenu.remove(i);}}
function addCountries(){
optionCountry=document.searchForm.country;
addOptions(countries,optionCountry);}
function addCities(){
countryCode=document.searchForm.country.options[document.searchForm.country.selectedIndex].value;
optionCity=document.searchForm.destination;
optionCur=document.searchForm.currency;
rmbValue=document.getElementById('rmbNum');
removeOptions(optionCity);
if (countryCode==null || !cities[countryCode]) {return;}
addOptions(cities[countryCode],optionCity);
if (optionCur!==null){
setCur();
if (rmbValue!==null){
setRmbValue();}}}
addCountries();

var rates=["GBP","HKD","USD","SGD","YEN","EUR","THB"];
function loadCurRates(){
var js=document.createElement("script");
js.type="text/javascript";
js.src="http://www.gta-china.com/promotion/curRates/curRates.js";
document.body.appendChild(js);}
function curRatesLoaded(){
rates["GBP"]=curRates["GBP"][2];
rates["HKD"]=curRates["HKD"][2];
rates["USD"]=curRates["USD"][2];
rates["SGD"]=curRates["SGD"][2];
rates["YEN"]=curRates["JPY"][2];
rates["EUR"]=curRates["EUR"][2];
rates["THB"]=curRates["THP"][2];
setRmbValue();}
function setRmbValue(){
optionCur=document.searchForm.currency;
curCode=optionCur.options[optionCur.selectedIndex].value;
curName=optionCur.options[optionCur.selectedIndex].text;
curValue=document.searchForm.curNum.value;
if (curValue=='无') {
curValue=1;
document.searchForm.curNum.value=1;
}
rmbValue=Math.round(rates[curCode]*curValue)/100;
document.getElementById('cur').innerHTML=curName;
if (rates[curCode]===undefined){
document.searchForm.rmbNum.value="无";}
else{
document.searchForm.rmbNum.value=rmbValue}}
function setCurValue(){
optionCur=document.searchForm.currency;
curCode=optionCur.options[optionCur.selectedIndex].value;
curName=optionCur.options[optionCur.selectedIndex].text;
rmbValue=document.searchForm.rmbNum.value;
curValue=Math.round(rmbValue*100/rates[curCode]*100)/100;
document.getElementById('cur').innerHTML=curName;
if (rates[curCode]===undefined){
document.searchForm.curNum.value="无";}
else{
document.searchForm.curNum.value=curValue}}