﻿// 이미지 크게 보기 컨트롤
function viewLargeImg(path, name)
{  
   document.all[name].src = path;
}


// 객실 이미지 컨트롤
var sRepeat=null;
function doScrollerIE(dir, src, amount) 
{
    if (amount==null)
    {amount=20;}
    
    if (dir=="right")
    {
        document.all[src].scrollLeft+=amount;        
    }
    else
    {
        document.all[src].scrollLeft -=amount;       
    }
    
    if (sRepeat==null)
    {
        sRepeat = setInterval("doScrollerIE('" + dir + "','" + src + "'," + amount + ")",100);
        return false;
    }
    return false;
}
window.document.onmouseout = new Function("clearInterval(sRepeat);sRepeat=null");
window.document.ondragstart = new Function("return false");

function controlsmarquee(action, src)
{
    if (action == "stop")
    {
        document.all[src].stop();
    }
    else if (action == "start")
    {
        document.all[src].start();
    }
}

function marqueeControls(dir, src, amount) 
{
    if (amount==null)
    {amount=8;}
    
    if (dir=="up")
    {
        document.all[src].scrollTop +=amount;        
    }
    else
    {
        document.all[src].scrollTop -=amount;       
    }
}

// 메인 국가 리스트 컨트롤(컨베이어 벨트)
var html="";
 
  function startText() { for (i=0; i<ctnt.length; i++) insertText(i); }
  function scroll( param ) {
    if ( flag ) {
      for (i=0;i<ctnt.length;i++) {
        temp++;
        tmp = document.getElementById('scroll_area'+i).style;
        if( param=='left' ) {
          tmp.left = parseInt(tmp.left)+speed;
        } else if( param=='right' ) {
          tmp.left = parseInt(tmp.left )-speed;
        }
        if( parseInt(tmp.left)>1 ) {
          if( i==0 ) tmp2 = document.getElementById('scroll_area1').style;
          else if( i==1 ) tmp2 = document.getElementById('scroll_area0').style;
          if( parseInt(tmp2.left)>0 ) tmp2.left = width*(-1);
        }
        if (parseInt(tmp.left) <= width*(-1)) tmp.left = width*(ctnt.length-1);
        if( temp>=amount ) { flag=false; temp=0; }
      }
      window.setTimeout("scroll('"+param+"')", 1);
    }
  }
  function scroll_left() 
  {
    if( !flag ) 
        {
        flag=true; 
        scroll('left'); 
        } 
  }
  
  function scroll_right() 
  {   
    if( !flag ) 
    {
        flag=true;        
        scroll('right'); 
    } 
  }
  
  function insertText(i) {
    htmlstr="<div style='left:"+(width*i-0)+"px; width:"+width+"px; position:absolute;' id='scroll_area"+i+"'>\n";
    htmlstr+=ctnt[i]+'\n'+'</div>\n';
    document.write(htmlstr);    
  }
  
  
  
function MM_swapimageArrow(id, dir)
{
    if (dir == "left")
    {
        document.getElementById(id).src = "/main/Map/images/google_map_navi_button_left_on.gif";    
    }
    else
    {
        document.getElementById(id).src = "/main/Map/images/google_map_navi_button_right_on.gif";    
    }
}

function MM_swapImgRestoreArrow(id, dir)
{
    if (dir == "left")
    {
        document.getElementById(id).src = "/main/Map/images/google_map_navi_button_left_off.gif";    
    }
    else
    {
        document.getElementById(id).src = "/main/Map/images/google_map_navi_button_right_off.gif";    
    }
}

// 업소 뉴스 컨트롤
function startNews() {for (i=0; i<ctnNews.length; i++) insertNews(i); }
 
  function scroll_news( param ) 
  {
    if ( winflag ) 
    {
    var speed = 1;
    var amount = 1;
    var temp=-1;
      for (i=0;i<ctnNews.length;i++) 
        {
        temp++;
        tmp = document.getElementById('scroll_area'+i+'_news').style;
            if( param=='up' ) {
              tmp.top = parseInt(tmp.top) + speed;
            } else if( param=='down' ) {
              tmp.top = parseInt(tmp.top) - speed;
            } else if(param == 'upclick'){
              tmp.top = parseInt(tmp.top) + 10;  
            }
            else if(param == 'downclick'){
              tmp.top = parseInt(tmp.top) - 10;  
            }
            if( parseInt(tmp.top)>1 ) {
              if( i==0 ) tmp2 = document.getElementById('scroll_area1_news').style;
              else if( i==1 ) tmp2 = document.getElementById('scroll_area0_news').style;
              if( parseInt(tmp2.top)>0 ) tmp2.top = height*(-1);
            }
            if (parseInt(tmp.top) <= height*(-1)) tmp.top = height*(ctnNews.length-1);
            if( temp>=amount ) { winflag=false; temp=0; }
        }
       window.setTimeout("scroll_news('"+param+"')", 1);       
    }
  }
  function scroll_up_news() 
  { 
    if( !winflag ) 
    { 
        winflag=true;        
        scroll_news('upclick');         
    } 
  }
  
  function scroll_down_news(action)
  { 
    if( !winflag ) 
    { 
        winflag=true;
        if (action == 'click')
        {
        scroll_news('downclick');      
        }
        else
        {
        scroll_news('down'); 
        }
    } 
  }
  
  function insertNews(i) {
    htmlstr="<div style='top:"+(height*i-0)+"px; height:"+height+"px; position:absolute;' id='scroll_area"+i+"_news' onmouseover='javascript:clearInterval(cunt);' onmouseout='javascript:callRun();'>\n";
    htmlstr+=ctnNews[i]+'\n'+'</div>\n';    
    document.write(htmlstr);       
  }
  
  
  // 여행 뉴스 컨트롤
  function startTourNews() {for (i=0; i<ctnTourNews.length; i++) insertTourNews(i); }
 
  function scroll_tournews( param ) 
  {
    if ( winTourflag ) 
    {
    var speed = 1;
    var amount = 1;
    var temp=-1;
      for (i=0;i<ctnTourNews.length;i++) 
        {
        temp++;
        tmp = document.getElementById('scroll_area'+i+'_tournews').style;
            if( param=='up' ) {
              tmp.top = parseInt(tmp.top) + speed;
            } else if( param=='down' ) {
              tmp.top = parseInt(tmp.top) - speed;
            } else if(param == 'upclick'){
              tmp.top = parseInt(tmp.top) + 10;  
            }
            else if(param == 'downclick'){
              tmp.top = parseInt(tmp.top) - 10;  
            }
            if( parseInt(tmp.top)>1 ) {
              if( i==0 ) tmp2 = document.getElementById('scroll_area1_tournews').style;
              else if( i==1 ) tmp2 = document.getElementById('scroll_area0_tournews').style;
              if( parseInt(tmp2.top)>0 ) tmp2.top = height*(-1);
            }
            if (parseInt(tmp.top) <= height*(-1)) tmp.top = height*(ctnNews.length-1);
            if( temp>=amount ) { winTourflag=false; temp=0; }
        }
       window.setTimeout("scroll_news('"+param+"')", 1);       
    }
  }
  function scroll_up_tournews() 
  { 
    if( !winTourflag ) 
    { 
        winTourflag=true;        
        scroll_tournews('upclick');         
    } 
  }
  
  function scroll_down_tournews(action)
  { 
    if( !winTourflag ) 
    { 
        winTourflag=true;
        if (action == 'click')
        {
        scroll_tournews('downclick');      
        }
        else
        {
        scroll_tournews('down'); 
        }
    } 
  }
  
  function insertTourNews(i) {
    htmlstr="<div style='top:"+(height*i-0)+"px; height:"+height+"px; position:absolute;' id='scroll_area"+i+"_tournews' onmouseover='javascript:clearInterval(cunt_tour);' onmouseout='javascript:callRun_tour();'>\n";
    htmlstr+=ctnTourNews[i]+'\n'+'</div>\n';    
    document.write(htmlstr);       
  }
