﻿function display(sID) {

oObj = document.getElementById(sID);
if (oObj) {
oObj.style.display='inline';
}
}

function hide(sID) {
oObj = document.getElementById(sID);
if (oObj) {
oObj.style.display='none';
}
}

function gettab(id){

for (i=1;i<=3;i++)
{
if (id == i)
{
display("box_serach"+i);
document.getElementById("lie"+i).className ='AB18FFFFFF';
}else{
hide("box_serach"+i);
document.getElementById("lie"+i).className ='font12';
}
}

}

//function gettab1(id){

//for (i=1;i<=4;i++)
//{

//if (id == i)
//{

//display1("box_Promotion"+i);
//document.getElementById("td1").className ='BgNoHoner';
//}else{
//hide1("box_Promotion"+i);
//document.getElementById("td"+i).className ='BgHoner';
//}
//}
//}


function gettab1(id)
{
for (i=1;i<=10;i++)
{

if (id == 1)
{
display1("box_Promotion1");
document.getElementById("td1").className ='BgNoHoner1';
}
else
{
hide1("box_Promotion1");
document.getElementById("td1").className ='BgHoner1';
}

if (id == 2)
{
display1("box_Promotion2");
document.getElementById("td2").className ='BgNoHoner2';
}
else
{
hide1("box_Promotion2");
document.getElementById("td2").className ='BgHoner2';
}

if (id == 3)
{
display1("box_Promotion3");
document.getElementById("td3").className ='BgNoHoner3';
}
else
{
hide1("box_Promotion3");
document.getElementById("td3").className ='BgHoner3';
}

if (id == 4)
{
display1("box_Promotion4");
document.getElementById("td4").className ='BgNoHoner4';
}
else
{
hide1("box_Promotion4");
document.getElementById("td4").className ='BgHoner4';
}

if (id == 5)
{
display1("box_Promotion5");
document.getElementById("td5").className ='BgNoHoner5';
}
else
{
hide1("box_Promotion5");
document.getElementById("td5").className ='BgHoner5';
}

if (id == 6)
{
display1("box_Promotion6");
document.getElementById("td6").className ='BgNoHoner6';
}
else
{
hide1("box_Promotion6");
document.getElementById("td6").className ='BgHoner6';
}

if (id == 7)
{
display1("box_Promotion7");
document.getElementById("td7").className ='BgNoHoner7';
}
else
{
hide1("box_Promotion7");
document.getElementById("td7").className ='BgHoner7';
}

if (id == 8)
{
display1("box_Promotion8");
document.getElementById("td8").className ='BgNoHoner8';
}
else
{
hide1("box_Promotion8");
document.getElementById("td8").className ='BgHoner8';
}

if (id == 9)
{
display1("box_Promotion9");
document.getElementById("td9").className ='BgNoHoner9';
}
else
{
hide1("box_Promotion9");
document.getElementById("td9").className ='BgHoner9';
}

if (id == 10)
{
display1("box_Promotion10");
document.getElementById("td10").className ='BgNoHoner10';
}
else
{
hide1("box_Promotion10");
document.getElementById("td10").className ='BgHoner10';
}

}
}

function display1(sID) {

oObj = document.getElementById(sID);
if (oObj) {
oObj.style.display='inline';
}
}

function hide1(sID) {
oObj = document.getElementById(sID);
if (oObj) {
oObj.style.display='none';
}
}

function rotate(id,settime){
if (id >10){id=1;}
gettab1(id);
id++;
timer = setTimeout("rotate("+id+","+settime+")", settime);

}
function clicktab(id){

if (id == 1)
{
display1("box_serach1");
document.getElementById("ts1").className ='Bgpackage';
}else{
hide1("box_serach1");
document.getElementById("ts1").className ='Bgnopackage';
}

if (id == 2)
{
display1("box_serach2");
document.getElementById("ts2").className ='BgHotel';
}else{
hide1("box_serach2");
document.getElementById("ts2").className ='BgnoHotel';
}

if (id == 3)
{
display1("box_serach3");
document.getElementById("ts3").className ='BgFlight';
}else{
hide1("box_serach3");
document.getElementById("ts3").className ='BgnoFlight';
}


stoper();
timer = setTimeout("rotate("+id+","+1000+")", 1000);
}

function stoper() {
clearTimeout(timer);
}

function clicktabFlight(id){

if (id == 1)
{
display1("box_serach1");
document.getElementById("ts1").className ='Bgbarbar';
}else{
hide1("box_serach1");
document.getElementById("ts1").className ='BgNobar';
}

if (id == 2)
{
display1("box_serach2");
document.getElementById("ts2").className ='Bgbarbar';
}else{
hide1("box_serach2");
document.getElementById("ts2").className ='BgNobar';
}
if (id == 3)
{
display1("box_serach3");
document.getElementById("ts3").className ='Bgbarbar';
}else{
hide1("box_serach3");
document.getElementById("ts3").className ='BgNobar';
}
if (id == 4)
{
display1("box_serach4");
document.getElementById("ts4").className ='Bgbarbar';
}else{
hide1("box_serach4");
document.getElementById("ts4").className ='BgNobar';
}
if (id == 5)
{
display1("box_serach5");
document.getElementById("ts5").className ='Bgbarbar';
}else{
hide1("box_serach5");
document.getElementById("ts5").className ='BgNobar';
}
stoper();
timer = setTimeout("rotate("+id+","+1000+")", 1000);
}

function clicktabFlightbox(id){

if (id == 1)
{
display1("box_serach1");
document.getElementById("ts1").className ='BgbarbarBox';
}else{
hide1("box_serach1");
document.getElementById("ts1").className ='BgNobarBox';
}

if (id == 2)
{
display1("box_serach2");
document.getElementById("ts2").className ='BgbarbarBox';
}else{
hide1("box_serach2");
document.getElementById("ts2").className ='BgNobarBox';
}
}

function stoper() {
clearTimeout(timer);
}


function getposOffset(overlay, offsettype){
  var totaloffset = (offsettype == "left")? overlay.offsetLeft : overlay.offsetTop
  var parentEl = overlay.offsetParent
  while (parentEl != null) {
    totaloffset = (offsettype == "left")? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop
    parentEl = parentEl.offsetParent
  }
  return totaloffset
}

var menutimedelay = 0
var menudisplay = ""

function menuoverlay(curobj, subobjstr) {
  if (document.getElementById) {
    if (menudisplay != "" & menudisplay != subobjstr) document.getElementById(menudisplay).style.visibility = "hidden"
    menudisplay = subobjstr
    var subobj = document.getElementById(subobjstr)
    subobj.style.visibility = "visible"
    var xpos = getposOffset(curobj, "left")
    var ypos = getposOffset(curobj, "top")

     /* คำนวณตำแหน่งของเมนูตรงกับด้านล่าง-ซ้าย */
    subobj.style.left = xpos + "px"
    subobj.style.top = ypos + curobj.offsetHeight + 2 + "px"
    
    return false
  }
}

/* หน่วงเวลาเพื่อซ่อนเมนู */
function menudelayHide(lyr) {
  menutimedelay = setTimeout('document.getElementById("'+lyr+'").style.visibility="hidden"', 250)
}

/* หยุดการซ่อนเมนู */
function menuMouseover(lyr) {
  if (menutimedelay > 0) clearTimeout(menutimedelay)
}

/* ซ่อนเมนูทันที */
function menuHide(lyr) {
  document.getElementById(lyr).style.visibility = "hidden"
}
