﻿// JavaScript Document
var CurrIntercorner_titID = 4;
var CurrIntercornerTit, CurrIntercornerBox;
var CurrIntercornerPoint;
var CurrPoint_index;

function OpenIntercorner() {

CurrIntercornerTit = document.getElementById("intercorner_head_" + CurrIntercorner_titID)
CurrIntercornerTit.setAttribute("class", "intercorner_tit_hl");
CurrIntercornerTit.setAttribute("className", "intercorner_tit_hl");

CurrIntercornerBox = document.getElementById("intercorner_box_" + CurrIntercorner_titID)
CurrIntercornerBox.style.display = "block"

return; 
}

function CloseIntercorner() {

CurrIntercornerTit = document.getElementById("intercorner_head_" + CurrIntercorner_titID)
CurrIntercornerTit.setAttribute("class", "intercorner_tit");
CurrIntercornerTit.setAttribute("className", "intercorner_tit");

CurrIntercornerBox = document.getElementById("intercorner_box_" + CurrIntercorner_titID)
CurrIntercornerBox.style.display = "none"

return; 
}

function switchIntercorner(titID) {

var boxtit;

CloseIntercorner();

boxtit = titID.id;
CurrIntercorner_titID = boxtit.substring(boxtit.length-1, boxtit.length);

OpenIntercorner();

return; 
}

var lang = 'EN'

var tab_group = new Array();
var panel_group = new Array();
tab_group[0] = new Array("tab_newscocat", "tab_newsvideos");
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_bizdir", "tab_residendir", "tab_usefulhotlines");

panel_group[0] = new Array("panel_newscocat", "panel_newsvideos");
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_bizdir", "panel_residendir", "panel_usefulhotlines");


var _COCATTAB_ON = true;

function chk_ACTTAB(tabgpID, tabID) {
  if (tabID == 0)
  {
        if (_COCATTAB_ON == true) 
        {
	      window.open("/iypbusiness_e10/en/html/browsing_search/browsecat.aspx", "", "")
	    } else 
	    {
	      _COCATTAB_ON = true
	      swapPanel(tabgpID,tabID)
	    }
  }
  else 
  {
	_COCATTAB_ON = false
	swapPanel(tabgpID,tabID)
  }
}

var eid_travelobiz=67 //zhongjianjun

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_up").style.cursor = "default"

  document.getElementById("travelobiz_btm").style.backgroundColor = "#a8c1db"
  document.images['travelobiz_down'].src = "../../images/arrow_down_o.gif"
  document.getElementById("travelobiz_down").style.cursor = "pointer"

  if (tabID == 0)
  {
	  eid_travelobiz=67
	  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">Swire Travel</a>'
  }
  else
  {
    eid_travelobiz=30
	  swapTravelObizTab(obiz_btnseq)
	  document.getElementById("swiretravel").innerHTML = '<a class="bluelink overunder" href="http://www.swiretravel.com/en/#business" target="_blank">Swire Travel</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) 
} 


videosrhbox_val = 'videos...'

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
}

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.aspx'; 
  webTraffic(48,sLang,'/home_e10/en/html/main/popup_UsefulHotlines.aspx');
  window.open(filetoopen, "pop_UsefulHotlines", option) 
}

szsrhbox_val = 'Shenzhen eating out, hot pot, spa...'

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 NewsToday(delay_hour) {
  var url; 
  var today = new Date();
  if(delay_hour == "")  delay_hour = 0;
  today.setHours(today.getHours() + parseInt(delay_hour));
  url = "/iypbusiness_e10/en/html/news_search/searchresult_news.aspx?entry=home&txtKeyword=" + getDate(today) + "+RTHK+englishnews&HiddenKeyword=Y";
  webTraffic(66,sLang,url);
  openWin(url);
}
