﻿// JavaScript Document
var lang = 'EN'

var tab_group = new Array();
var panel_group = new Array();
tab_group[0] = new Array("tab_newsvideos", "tab_newstext", "tab_newsmovies");
tab_group[1] = new Array("tab_whatson", "tab_tradevents");
tab_group[2] = new Array("tab_travel", "tab_overseasbiz");
tab_group[3] = new Array("tab_videos", "tab_images", "tab_music", "tab_horoscopes", "tab_games");
tab_group[4] = new Array("tab_choice", "tab_eshop");
tab_group[5] = new Array("tab_ECCE", "tab_EE");
tab_group[6] = new Array("tab_usefulhotlines", "tab_residendir");

panel_group[0] = new Array("panel_newsvideos", "panel_newstext", "panel_newsmovies");
panel_group[1] = new Array("panel_whatson", "panel_tradevents");
panel_group[2] = new Array("panel_holidays", "panel_transportation");
panel_group[3] = new Array("panel_videos", "panel_images", "panel_music", "panel_horoscopes", "panel_games");
panel_group[4] = new Array("panel_choice", "panel_eshop");
panel_group[5] = new Array("panel_ECCE", "panel_EE");
panel_group[6] = new Array("panel_usefulhotlines", "panel_residendir");

function swapPanel(tabgpID, tabID) {
var currTab = document.getElementById(tab_group[tabgpID][tabID]); 
//var currPanel = document.getElementById(panel_group[tabgpID][tabID]); 
var initTab="", initPanel=""
var showid

for (i=0; i<tab_group[tabgpID].length; i++) {

  initTab = document.getElementById(tab_group[tabgpID][i]);
  //initPanel = document.getElementById(panel_group[tabgpID][i])

  if (tabgpID == 3) {
	initTab.setAttribute("class", "leisure_menubtn leisure_menubtn_off");
	initTab.setAttribute("className", "leisure_menubtn leisure_menubtn_off");
  } else if (tabgpID == 5) {
	initTab.setAttribute("class", "dictionary_list");
	initTab.setAttribute("className", "dictionary_list");
  } else {
	initTab.setAttribute("class", "blk_tab blk_tab_off");
	initTab.setAttribute("className", "blk_tab blk_tab_off");
  }

  //initPanel.style.display = "none"
}

if (tabgpID == 3) {
  currTab.setAttribute("class", "leisure_menubtn");
  currTab.setAttribute("className", "leisure_menubtn");
} else if (tabgpID == 5) {
  currTab.setAttribute("class", "dictionary_list dictionary_list_hl");
  currTab.setAttribute("className", "dictionary_list dictionary_list_hl");
} else {
  currTab.setAttribute("class", "blk_tab");
  currTab.setAttribute("className", "blk_tab");
}

if (tabgpID != 2)
  currPanel.style.display = "block"
else {
  document.getElementById("travelobiz_menu").style.top = 0 + "px"

  document.getElementById("travelobiz_top").style.backgroundColor = "#ccc"
  document.images['travelobiz_up'].src = "images/arrow_up.gif"
  document.getElementById("travelobiz_top").style.cursor = "default"

  document.getElementById("travelobiz_btm").style.backgroundColor = "#a8c1db"
  document.images['travelobiz_down'].src = "images/arrow_down_o.gif"
  document.getElementById("travelobiz_btm").style.cursor = "pointer"

  if (tabID == 0) {
	swapTravelObizTab(travel_btnseq)
	document.getElementById("swiretravel").innerHTML = '<a class="bluelink overunder" href="http://www.swiretravel.com/en/leisure/vacationpackage/packageVisitorAction.do?action=visitorDestinationList" target="_blank">太古旅遊</a>'
  } else {
	swapTravelObizTab(obiz_btnseq)
	document.getElementById("swiretravel").innerHTML = '<a class="bluelink overunder" href="http://www.swiretravel.com/en/#business" target="_blank">太古旅遊</a>'
  }
}

return; 
}

function openWin(url) { 
  var option, filetoopen; 
  option = "width=800, height=600, left=20, top=20, location=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes, titlebar=yes, toolbar=yes"; 
  filetoopen = url; 
  window.open(filetoopen, "newwin", option) 
}

function popup_HKHolidays() {
  var option, filetoopen; 
  option = "width=500, height=600, left=20, top=20, location=no, menubar=no, resizable=no, scrollbars=yes, status=yes, titlebar=yes, toolbar=no"; 
  filetoopen = 'popup_HKholidays.html'; 
  window.open(filetoopen, "pop_HKHolidays", option) 
}

function setActiveTab(tabID) { // Swap Tabs in Search Box
//var srhTabs = new Array("srhtab1", "srhtab2", "srhtab3", "srhtab4", "srhtab5", "srhtab6", "srhtab7", "srhtab8")
var srhTabs = new Array("srhtab1", "srhtab2", "srhtab3")
var currTabElem = document.getElementById(tabID); 
var initTab;

for (i=0; i<srhTabs.length; i++) {
	initTab = document.getElementById(srhTabs[i]);
	initTab.setAttribute("class", "");
	initTab.setAttribute("className", "");
}

currTabElem.setAttribute("class", "selected"); 
currTabElem.setAttribute("className", "selected"); 

if (tabID == "srhtab3") {
	document.getElementById("pt2pt").style.display = "block";
	document.getElementById("searchbox").style.display = "none";
} else {
	document.getElementById("pt2pt").style.display = "none";
	document.getElementById("searchbox").style.display = "block";
}
return; 
}

function setActiveTab2(tabID) { // Swap Tabs in Search Box
//var srhTabs = new Array("srhtab1b", "srhtab2b", "srhtab3b", "srhtab4b", "srhtab5b", "srhtab6b", "srhtab7b", "srhtab8b")
var srhTabs = new Array("srhtab1b", "srhtab2b", "srhtab3b")
var currTabElem = document.getElementById(tabID); 
var initTab;

for (i=0; i<srhTabs.length; i++) {
	initTab = document.getElementById(srhTabs[i]);
	initTab.setAttribute("class", "");
	initTab.setAttribute("className", "");
}

currTabElem.setAttribute("class", "selected"); 
currTabElem.setAttribute("className", "selected"); 

return; 
}

function setActiveTabDining(tabID) { // Swap Tabs in Search Box
//var srhTabs = new Array("srhtab1", "srhtab2", "srhtab3", "srhtab4", "srhtab5", "srhtab6", "srhtab7", "srhtab8")
var srhTabs = new Array("dintab1", "dintab2", "dintab3", "dintab4")
//var divClass = new Array("dinclass1", "dinclass2", "dinclass3", "dinclass4")
var imgTabsOn = new Array("dining_china_on.png", "dining_asia_on.png", "dining_west_on.png", "dining_beverage_on.png")
var imgTabsOff = new Array("dining_china_off.png", "dining_asia_off.png", "dining_west_off.png", "dining_beverage_off.png")
var currTabElem;
//var currClassElem;
var imgLoc;
/*
for (i=0; i<srhTabs.length; i++) {
	initTab = document.getElementById(srhTabs[i]);
	initTab.setAttribute("class", "");
	initTab.setAttribute("className", "");
}

currTabElem.setAttribute("class", "selected"); 
currTabElem.setAttribute("className", "selected"); 
*/
for (i=0; i<srhTabs.length; i++) {
	currTabElem = document.getElementById(srhTabs[i]); 
	//currClassElem = document.getElementById(divClass[i]); 
	
	if (srhTabs[i] == tabID) {
		imgLoc = "images/" + imgTabsOn[i];
		currTabElem.src=(imgLoc);
		//currClassElem.style.display = "block";
	} else {
		imgLoc = "images/" + imgTabsOff[i];
		currTabElem.src=(imgLoc);
		//currClassElem.style.display = "none";
	}
}

return; 
}

function setActiveTabBusStop(tabID) { // Swap Tabs in Search Box
    var srhTabs = new Array("bustab1", "bustab2", "bustab3", "bustab4")
    var divClass = new Array("busclass1", "busclass2", "busclass3", "busclass4")
    var currTabElem;
    var currClassElem;
    var imgLoc;
    for (i=0; i<srhTabs.length; i++) {
	    currClassElem = document.getElementById(divClass[i]); 
    	
	    if (srhTabs[i] == tabID) {
		    /*currClassElem.style.border-top-color = "#2B578B";
		    currClassElem.style.border-top-width = "1px";
		    currClassElem.style.border-top-style = "solid";
		    currClassElem.style.border-left-color = "#2B578B";
		    currClassElem.style.border-left-width = "1px";
		    currClassElem.style.border-left-style = "solid";
		    currClassElem.style.border-right-color = "#2B578B";
		    currClassElem.style.border-right-width = "1px";
		    currClassElem.style.border-right-style = "solid";*/
		    currClassElem.setAttribute("class", "busstop_tab_on"); 
		    currClassElem.setAttribute("className", "busstop_tab_on"); 
	    } else {
		    //currClassElem.style.background = "#ffffff";
		    currClassElem.setAttribute("class", "busstop_tab_off"); 
		    currClassElem.setAttribute("className", "busstop_tab_off"); 
	    }
    }

    return; 
}

videosrhbox_val = '影片...'

function act_videosrh() {
  videosrhobj = document.getElementById('videosrh')

  if (videosrhobj.value == videosrhbox_val) {
	videosrhobj.setAttribute("class", "videosrh_act")
	videosrhobj.setAttribute("className", "videosrh_act")
    videosrhobj.value = ''
  }
}

function reset_videosrh() {
  videosrhobj = document.getElementById('videosrh')

  if (videosrhobj.value == '') {
	videosrhobj.setAttribute("class", "videosrh_noact")
	videosrhobj.setAttribute("className", "videosrh_noact")
    videosrhobj.value = videosrhbox_val 
  }
}

function init_videosrh() {
  videosrhobj = document.getElementById('videosrh')
 
  videosrhobj.setAttribute("class", "videosrh_noact")
  videosrhobj.setAttribute("className", "videosrh_noact")
  
  videosrhobj.value = videosrhbox_val
}

szsrhbox_val = '深圳娛樂、火鍋、按摩...'

function act_szsrh() {
  szsrhobj = document.getElementById('szsrh')

  if (szsrhobj.value == szsrhbox_val) {
	szsrhobj.setAttribute("class", "szsrh_act")
	szsrhobj.setAttribute("className", "szsrh_act")
    szsrhobj.value = ''
  }
}

function reset_szsrh() {
  szsrhobj = document.getElementById('szsrh')

  if (szsrhobj.value == '') {
	szsrhobj.setAttribute("class", "szsrh_noact")
	szsrhobj.setAttribute("className", "szsrh_noact")
    szsrhobj.value = szsrhbox_val 
  }
}

function init_szsrh() {
  szsrhobj = document.getElementById('szsrh')
 
  szsrhobj.setAttribute("class", "szsrh_noact")
  szsrhobj.setAttribute("className", "szsrh_noact")
  
  szsrhobj.value = szsrhbox_val
}

function popup_UsefulHotlines() {
  var option, filetoopen; 
  option = "width=520, height=460, left=20, top=20, location=no, menubar=no, resizable=no, scrollbars=no, status=yes, titlebar=yes, toolbar=no"; 
  filetoopen = 'popup_UsefulHotlines.html'; 
  window.open(filetoopen, "pop_UsefulHotlines", option) 
}
