﻿// === browser ===
function Browser()
{
	this.name = navigator.userAgent;
	this.isWinIE = this.isMacIE = false;
	this.isGecko = this.name.match(/Gecko\//);
	this.isSafari = this.name.match(/AppleWebKit/);
	this.isKHTML = this.isSafari || navigator.appVersion.match(/Konqueror|KHTML/);
	this.isOpera = window.opera;
	this.hasNS = (document.documentElement) ? document.documentElement.namespaceURI : null;
	if (document.all && !this.isGecko && !this.isSafari && !this.isOpera)
	{
		this.isWinIE = this.name.match(/Win/);
		this.isWinIE6 = this.name.match(/MSIE 6/);
		this.isMacIE = this.name.match(/Mac/);
	}
}
var Browser = new Browser();

/**
 * 우편번호 찾기 서비스 
 * zipcode.open(event, zip1, zip2, addr1, addr2); 각 Params 는 해당 Element Object를 넣는다.
*/
var zipcode = { 
    zip1: undefined, zip2: undefined, addr1: undefined, addr2: undefined,
    open: function(e, zip1, zip2, addr1, addr2) {
        this.zip1 = zip1;
        this.zip2 = zip2;
        this.addr1 = addr1;
        this.addr2 = addr2;

        var objBody = $$('body')[0];
        if (!$('ZipcodeContainer'))
        {
            objBody.appendChild(new Element('div', {id:'ZipcodeContainer'}
                ).insert(
                    new Element('div', {id:'ZipcodeTop'})
                ).insert(
                    new Element('div', {id:'ZipcodeSearchContainer'}).insert(
                        new Element('div', { id: 'ZipcodeSearchArea' }).update('* 우편번호(- 제외) or 주소의 동(읍/면/리)을 입력 후 검색<br />&nbsp;&nbsp;&nbsp;(예: 신사동이면 <strong>신사</strong>만 입력)').insert(
                            new Element('div', {id:'ZipcodeSearchAreaBox'}).insert(
                                new Element('img', { src: '/images/member/pop_post_t.gif', border: '0', alt: '우편번호검색' })
                            ).insert(
                                new Element('input', { type:'text', id:'tbSearchZipcode', name:'tbSearchZipcode', 'class':'imeHan box', maxlength:'10' })
                            ).insert(
                                new Element('span', {'class':'imgBtn'}).insert(
                                    new Element('a', {id:'btnZipCodeSearch','class':'curPointer' }).insert(new Element('span').update("검색"))
                                )
                            )
                        )
                    ).insert(
                        new Element('div', {id:'ZipcodeArea'}).insert(new Element('div', {id:'ZipcodeResult'}))
                    )
                ).insert(
                    new Element('div', {id:'ZipcodeBottom'}).insert(new Element('div', {id:'ZipcodeClose'}).insert(new Element('span').update("닫기")))
                )
            )

            var arrPos = mousePosition(e);
            $('ZipcodeContainer').style.top = arrPos[1]+10 +'px';
            $('ZipcodeContainer').style.left = arrPos[0]+10 +'px';
            $('tbSearchZipcode').observe('keypress',  (function() { if (e.keyCode == 13) { this.search($F('tbSearchZipcode')); return false; } }).bind(this));
            $('btnZipCodeSearch').observe('click',  (function() { this.search($F('tbSearchZipcode')); }).bind(this));
            $('btnZipCodeSearch').observe('focus',  (function() { blur(); }).bind(this));
            $('ZipcodeClose').observe('click', (function() { this.end(); }).bind(this));

        }
    },
    search: function(searchValue) {
        var url = "/member/MemberInfoSearch.ashx";
        var pars = "mode=zipcode&val=" + searchValue;
        new Ajax.Updater($('ZipcodeResult'), url, { parameters: pars, method:'get' });
    },
    select: function(zip1, zip2, addr1) {
        this.zip1.value = zip1;
        this.zip2.value = zip2;
        this.addr1.value = addr1;
        this.end();
    },
    end: function() {
        $('ZipcodeContainer').hide();
        var objBody = $$('body')[0];
        objBody.removeChild($('ZipcodeContainer'));
        if (this.addr2 != undefined) this.addr2.focus();
    }
}

/**
 * layer Popup
 * new FlushPopup(url, id, option)
*/
function FlushPopup(url, id, option)
{
	var self = this;
    self._id = id || null;
	self._wrap = null;
	self._box  = null;
    self._evt = (window.event) ? window.event : null;
    self._url = url;
    self._option = option;
	self._open = -1;
	self._page = new PageSize();
	self._pos  = new PagePos();
	self._curpos = {x:0,y:0};
	self._funcs = {'move':null,'up':null,'drag':null,'wheel':null};
    return self._init();
}

FlushPopup.prototype = {
    _init: function() {
        var self = this;
        var body = $$('body')[0];
        self._option = Object.extend({
            width: 400,
            height: 300,
            top: null,
            left: null,
            title: '',
            titleimage: null,
            showTitle: true,
            close: true,
            closebtn: 'UP',
            overlay: true,
            iframe: true,
            dragable: true,
            parameters: null
        }, self._option || {});

        var _id = (!self._id) ? document.getElementsByClassName("popContainer").length.toString() : self._id;
        self._id = ['_', _id].join('');
        self._wrap = self._createWrapOn(body);
        self._box = self._createBoxOn(body);
        self._show();
        return self;
    },
    _createWrapOn: function(obj) {
        var self = this;
        if (!obj) return null;

        var wrap = document.getElementById('overlay');
        if (Browser.isWinIE) wrap.style.position = 'absolute';
        Event.observe(wrap, "click", function(evt) { self._close(self._evt); });

        if ($("popLoadingImage" + self._id)) {
            var spin = $("popLoadingImage" + self._id);
        }
        else {
            var spin = document.createElement('img');
            wrap.appendChild(spin);
            spin.id = "popLoadingImage" + self._id;
            spin.src = "/images/plugins/lightbox/loading.gif";
            spin.style.position = 'relative';
            self._set_cursor(spin);
            Event.observe(spin, 'click', function(evt) { self._close(self._evt); });
        }

        return wrap;
    },
    _createBoxOn: function(obj) {
        var self = this;
        if (!obj) return null;
        if ($("popWrapper" + self._id)) {
            var box = $("popWrapper" + self._id);
        }
        else {
            var box = document.createElement("div");
            obj.appendChild(box);
            box.id = "popWrapper" + self._id;
            box.style.display = 'none';
            box.style.position = 'absolute';
            box.style.zIndex = '160';

            /** clone start **/
            var boxContainer = $('popWrapper' + self._option.closebtn);

            box.innerHTML = boxContainer.innerHTML; // clone

            var div = box.getElementsByTagName("div");
            for (var i = 0; i < div.length; i++) {
                if (div[i].id) div[i].id = div[i].id + self._id;
            }
            box.getElementsByTagName("h5")[0].id = box.getElementsByTagName("h5")[0].id + self._id;
            box.getElementsByTagName("span")[0].id = box.getElementsByTagName("span")[0].id + self._id;
            /** clone end **/
        }
        $$('.popclosebtn').invoke('observe', 'click', function() { self._close(self._evt); }).each(function(el) { el.title = '창 닫기'; });
        box = self._createOptional(box);
        return box;
    },
    _createOptional: function(obj) {
        var self = this;
        obj.firstChild.style.width = [self._option.width, 'px'].join('');
        $$('#popArea' + self._id + ' b, #popmiddle' + self._id + '').each(function(el) {
            el.style.height = [self._option.height, 'px'].join('');
            if (el.className == 'popmiddle')
                el.style.width = [(parseInt(self._option.width) - ((Browser.isWinIE6) ? 44 : 38)), 'px'].join('')
            else if (el.className == 'popmiddle2')
                el.style.width = [(parseInt(self._option.width) - ((Browser.isWinIE6) ? 38 : 32)), 'px'].join('')
            else
                el.style.width = null;
        });

        // content set
        var popContent = $('popContent' + self._id);
        popContent.style.height = [parseInt(popContent.parentNode.style.height) - 41, 'px'].join('');

        if (!self._option.showTitle) {
            $('popTitleContainer' + self._id).style.display = "none";
            popContent.style.height = [parseInt(popContent.parentNode.style.height), 'px'].join('');
        }
        else {
            // title set
            var imgpattern = /\.(jpg|gif|png)$/i;
            if (self._option.titleimage && imgpattern.test(self._option.titleimage)) {
                $('popTitle' + self._id).parentNode.style.padding = "0";
                $('popTitle' + self._id).innerHTML = "<img src=\"" + self._option.titleimage + "\" alt=\"" + self._option.title + "\" border=\"0\"  />";
            }
            else
                $('popTitle' + self._id).innerHTML = self._option.title;
        }


        if (self._option.iframe) {
            var iframeHeight = (self._option.showTitle) ? parseInt(popContent.parentNode.style.height) - 50 : parseInt(popContent.parentNode.style.height) - 5;
            if ($("popIfrmBox" + self._id)) {
                var iframe = $("popIfrmBox" + self._id);
            }
            else {
                var iframe = document.createElement("iframe");
                iframe.id = "popIfrmBox" + self._id;
                iframe.frameBorder = "0";
                iframe.width = "100%";
                iframe.height = [iframeHeight, 'px'].join('')
                iframe.scrolling = "auto";
                popContent.appendChild(iframe);
                Event.observe(iframe, 'load', function() {
                    //calcHeight(""+iframe.id +""); 
                    self._box.show();
                    if ($('popLoadingImage' + self._id)) $('popLoadingImage' + self._id).style.display = "none";
                });
            }
            iframe.src = self._url;
        }
        else {
            popContent.style.overflow = "auto";
            var ajax = new Ajax.Updater(popContent, self._url, { parameters: self._option.parameters, method: 'get' });
        }

        if (self._option.dragable) {
            var popWrapper = $('popWrapper' + self._id);
            var popTitleContainer = $('popTitleContainer' + self._id);
            //            popTitleContainer.title = "마우스를 사용하여 이동하실 수 있습니다";
            //            Event.observe(popTitleContainer, 'dblclick', function() { self._close(null); });
            //            Event.observe(popTitleContainer, 'mousedown', function() { 
            //                new Draggable(popWrapper, { scroll:window });
            //                /*
            //                new Draggable(popWrapper, { 
            //                    scroll: window, starteffect:false, moveeffect:false, endeffect:false, 
            //                    onEnd: function(draggable, event) { 
            //                    }
            //                });
            //                */
            //            });
            //            
        }

        return obj;
    },
    _show: function() {
        var self = this;
        if (self._open != -1) return

        //$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
        //$$('select').each(function(node){ node.style.visibility = 'hidden' });
        self._open = 1;
        self._set_size();
        if (self._option.overlay) new Effect.Appear(self._wrap, { duration: 0, from: 0.0, to: 0.4 }); //self._wrap.show();

        if (!self._option.iframe) {
            try {
                self._box.show();
                if ($('popLoadingImage' + self._id)) $('popLoadingImage' + self._id).style.display = "none";
            } catch (e) { }
        }

    },
    _set_size: function() {
        var self = this;
        if (self._open == -1) return;
        self._page.update();
        self._pos.update();
        var spin = self._wrap.firstChild;

        if (spin) {
            var top = (self._page.win.h - spin.height) / 2;
            if (self._wrap.style.position == 'absolute') top += self._pos.y;
            spin.style.top = [top, 'px'].join('');
            spin.style.left = [(self._page.win.w - spin.width - 30) / 2, 'px'].join('');
        }
        if (Browser.isWinIE) {
            self._wrap.style.width = [self._page.win.w, 'px'].join('');
            self._wrap.style.height = [self._page.win.h, 'px'].join('');
            self._wrap.style.top = [self._pos.y, 'px'].join('');
        }
        var box = self._box;
        if (box) {
            var top = (self._page.win.h - self._option.height) / 2;
            if (self._box.style.position == 'absolute') top += self._pos.y;
            box.style.top = (!self._option.top) ? [top, 'px'].join('') : [self._option.top, 'px'].join('');
            box.style.left = (!self._option.left) ? [(self._page.win.w - self._option.width) / 2, 'px'].join('') : [self._option.left, 'px'].join('');
        }
    },
    _set_cursor: function(obj) {
        var self = this;
        if (Browser.isWinIE && !Browser.isNewIE) return;
        obj.style.cursor = 'pointer';
    },
    _close: function(evt) {
        var self = this;
        var body = $$('body')[0];
        self._open = -1;
        self._wrap.innerHTML = "";
        self._wrap.style.display = "none";
        self._box.style.display = "none";
        try { body.removeChild(self._box); }
        catch (e) { }
        $$('select', 'object', 'embed').each(function(node) { node.style.visibility = 'visible' })
    }
};



// 관심상품 등록
function FavoriteProduct(proCode, proType, proName)
{
    if (confirm('관심상품으로 등록하시겠습니까?'))
    {
        var url = "/Product/Common/Favorite.ashx";
        var pars = "&proCode="+ proCode +"&proType="+ proType +"&proName="+ encodeURIComponent(proName);
        new Ajax.Request(url, { 
                        method:'get', parameters: "mode=add" + pars, 
                        onSuccess: function(req) {
                            if (req.responseText.length > 0) 
                                eval(req.responseText) 
                            else
                                new FlushPopup(url, null, { 
                                        width:380, height:150, iframe:false,
                                        parameters:'mode=view' + pars,  
                                        title:'관심상품 등록' //, titleimage:'/images/product/popup_text04.gif' 
                                });
                        }
        });
    }
}

// 사진 보기
function PhotoView(obj, target, cnt)
{
    if (obj)
    {
        cnt = (cnt != null) ? "_" + cnt : "";
        if (obj.src) $(target).src = obj.parentNode.href;
        if (obj.alt) $(target + 'PreviewText').innerHTML = obj.alt;
        else if ($(target + 'PreviewText')) $(target + 'PreviewText').innerHTML  = "";
    }
}

function detailPhotoView(obj, target, cnt)
{
    if(obj)
    {
        cnt = (cnt != null) ? "_" + cnt : "";
        if (obj.src) $('detail' + target + 'Image' + cnt).src= (obj.src.toLowerCase().indexOf('photo_nos.gif') > -1) ? obj.src.toLowerCase().replace("s.gif", "L.gif") : obj.src;
        if (obj.alt) $(target + 'PreviewText' + cnt).innerHTML = obj.alt;
        else if ($(target + 'PreviewText'+ cnt)) $(target + 'PreviewText'+ cnt).innerHTML  = "";

        if ($('detail' + target + 'Image' + cnt).parentNode)
        {
            if ($('detail' + target + 'Image' + cnt).parentNode.tagName.toLowerCase() == "a") 
            {
                $('detail' + target + 'Image' + cnt).parentNode.href = $('detail' + target + 'Image' + cnt).src;
            }
        }
        
    }
}

function TitleToNote() {
    var titledElements = ['a', 'img', 'span'];
    for (var j=0; j < titledElements.length; j++) {
        alert(titledElements[j]);
        
        $$(titledElements[j]+'[title]').each(function(el){ 
            if (typeof el == "object" && el.style.display != 'none' && el.style.visibility  != 'hidden') {
                var noteTitle = $div(el.title);
                noteTitle.setStyle({ position:'absolute', top:'10px', left:'30px', 'background-color':'#AAAAAA', border:'1px solid red' });
                el.appendChild( noteTitle );
                noteTitle.hide();
                el.makePositioned();

                el.observe('mouseover', function(){  noteTitle.show(); });
                el.observe('mouseout', function(){ noteTitle.hide(); });        
            }
        });
    }
}

// 공지사항 불러오기
function noticeList()
{
	if (document.URL.toLowerCase().indexOf('tne') == -1 && document.URL.toLowerCase().indexOf('memplus') == -1)
	    getRecentlyBoard('noticeDiv', 3, null, 3, null, 50, 1)
}


// 최신 게시물 가져오기
// compObj - 비교된 obj를 통해서 값을 바꿔옴 - 탭 형식에 쓰임 || null 일 경우 걍 불러온다
function getRecentlyBoard(targetObj, masterSeq, categorySeq, Top, compObj, cutnum, theme)
{
    cutnum = (cutnum && !isNaN(cutnum)) ? cutnum : 100;
    var url = "/Common/getRecentBoard.ashx";
    var pars = "top=" + Top + "&masterSeq="+ masterSeq +"&categorySeq="+ categorySeq +"&cutnum="+ cutnum +"&t="+ theme;
    
    targetObj = ((typeof(compObj) == "string") ? $(targetObj) : targetObj) || null;
    compObj = ((typeof(compObj) == "string") ? $(compObj) : compObj) || null;
    if (compObj)
    {
        var oVal = compObj.innerHTML;
        if (!(parseInt(oVal.split('|')[1]) == categorySeq && parseInt(oVal.split('|')[0]) == masterSeq))
        {
            new Ajax.Updater(targetObj, url, { method:'get', parameters:pars } );
            compObj.innerHTML = masterSeq + '|' + categorySeq;
        }
    }
    else
    {
        new Ajax.Updater(targetObj, url, { method:'get', parameters:pars } );
    }
}
function abc()
{
    alert($('noticeDiv').innerHTML);
}
// 지도보기
function OpenMap(productCode, scheduleNo, day, priceNo, url)
{
    if (!url) url = location.host.split('.')[0];
    var pars = "proCode="+ productCode +"&scheduleNo="+ scheduleNo +"&day="+ day +"&priceNo="+ priceNo +"&urlType="+url;
    Window.center("/Flex/Map/Map2.aspx?"+ pars, 'map', 720, 570, 'no');
    /*
    new FlushPopup('/Flex/Map/Map2.aspx?'+ pars, null, { 
		    width:750, 
		    height:600, 
		    top:0,
		    left:10,
		    showTitle: false, 
		    closebtn:'DOWN',
		    overlay: true, 
		    iframe: true, 
		    dragable: true,
		    targetWin : parent
		    //parameters: pars
	    });
    */
}

// 호텔보기
function OpenHotelMap(contentCode, masterName, gpsX, gpsY)
{
    var pars = "hotelCode="+ contentCode +"&hotelTitle="+ masterName +"&hotelCity=&hotelX="+ gpsX +"&hotelY="+ gpsY;
    Window.center("/Flex/Map/Map.aspx?"+ pars, 'map', 720, 570, 'no');
}


// 패키지 리스트 다른 상품 보기 클릭 
function toggleProductList(masterCode, id, simple)
{
	
    var relationSite = "/Product/Package";

    if (document.URL.toLowerCase().indexOf('tne.verygoodtour.com') > -1)
        relationSite = "/tne";
    else if (document.URL.toLowerCase().indexOf('.memplus.co.kr') > -1)
        relationSite = "/memplus";
    

    var url = relationSite + "/packageListMoreIframe.aspx";
    var iContainer = $('listAnotherContainer_' + id);
    var iFrame = $('IfrmAnotherDay_'+ id);
    var imgBtn = $('btnAnotherList_' + id);
    var strSimple = (isNaN(simple)) ? "&simple=" + simple : (simple > 0) ? "&after=" + simple : "";  // 숫자일때 after / 문자일때 simple
    var iFrameId = "&iframeID=IfrmAnotherDay_" + id;

    
    if (iContainer.style.display == "none")
    {
    	//imgBtn.src = "/images/product/btn_close.gif";
    	imgBtn.src = "/images/product/btn_zclose.gif";
        imgBtn.alt = "다른출발일 닫기";
        iFrame.src = url + "?masterCode=" + masterCode + strSimple + iFrameId;
        iContainer.style.display = "block";
    }
    else
    {
        iContainer.style.display = "none";
        //imgBtn.src = "/images/product/btn_open.gif";
        imgBtn.src = "/images/product/btn_zopen.gif";
        imgBtn.alt = "다른출발일 열기";
        iFrame.src = "about:blank";
    }
}

// 패키지 리스트 관련검색 클릭 
function getRelationList(code)
{
    $('hdCode').value = code;
    __doPostBack('ctl00$ContentPlaceHolder1$lbtnRelationChange','');
}



// 왼쪽 메뉴 - 3depth 서브 메뉴 레이어 - 현재 안쓰임
function showSubMenuSection(city, e)  // onmouseover="showSubMenuSection('SDI', event);"
{
	var posx=0, posy=0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {
		posx = (document.documentElement.clientWidth / 2) - 360;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = (document.body.clientWidth / 2) - 360;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
	if (city)
	{
		$$('ul.leftDepth3').invoke('hide');
		$('LeftSubDepth4').style.left = (posx) + 'px';
		$('LeftSubDepth4').style.top =  (posy - 10) + 'px';
		$('LeftSubDepth4').style.display = "";

		if ($('menu-city-'+ city.toLowerCase())) 
			$('menu-city-'+ city.toLowerCase()).style.display = "";
		else 
			$('LeftSubDepth4').style.display = "none";
	}
	else
	{
		$('LeftSubDepth4').style.display = "none";
		
	}
}

// 왼쪽 메뉴 - 메뉴 선택 
function menuSelect(obj, val)
{
	$$('li.selected').each(function(el) {
		el.className = el.className.replace('selected', '');
	});
	if (obj.parentNode.className.indexOf('selected') < 0)
		obj.parentNode.className = obj.parentNode.className + ' selected';

	$$('ul.leftDepth1 li a').each(function(el) {
		el.className = el.className.replace('on', '');
	});
	$$('.leftDepth2').invoke('hide');
	if ($('leftDepth2_'+ val)) $('leftDepth2_'+ val).show();

	if (obj.className.indexOf('on') < 0)
		obj.className = obj.className.replace(val, val+'on');
}

// 왼쪽 메뉴 - 고객 센터 
function getCustomerService(menu, evt)
{
	var arrPos = mousePosition(evt);
	var ps = new PageSize();
	ps.update();

    var t = 0;
    var l = 0;
    var w = 500;
    var h = 410;
    var subject = "";
    
    switch(menu)
    {
        case "tel": w = 450; h = 440; subject = "부서별 전화안내"; break;
        case "account": w = 500; h = 410; subject = "부서별 입금계좌"; break;
    }
    if (Browser.isWinIE) { w = w; h = h; }
    if (arrPos){ t = arrPos[1] - h -50; l = (ps.win.w / 2 / 2); }
    new FlushPopup('/_input/info/TourInfo/LeftMenu_'+ menu +'.html', 3, { 
		    width:w, height:h, top:t, left:l,
		    showTitle: true, title:subject, titleimage:'/images/common/popup_text_team_'+ menu +'.gif',
		    closebtn:'UP', overlay: false,  iframe: false,  dragable: true, parameters: ''
	});
}

// 홈페이지 메인
function mainSearch()
{
    if ($('q'))
    {
        if ($F('q').length > 0) 
        {
            var url = (MiyaFormat.productcode($('q')) == true) ? "/Product/Package/PackageDetail.aspx?proCode=" : "/Product/Common/Search.aspx?keyword=";
            document.location.href = url + escape($F('q'));
        }
        else alert('검색어를 입력해주세요');
    }
}

// 도시 이름 검색 팝업
function ApproachCityFinder(cityNameObj, cityCodeObj, txt)
{
    //new FlushPopup("/Product/Common/ApproachCityFinder.aspx?cityTxt=" + escape(txt) + "&cityName=" + cityNameObj + "&cityCode=" + cityCodeObj, 5, { width: 380, height: 440, closebtn: 'DOWN', overlay: false, title: '도시명 검색' });
    new FlushPopup("/Product/Common/ApproachCityFinderNew.aspx?cityTxt=" + escape(txt) + "&cityName=" + cityNameObj + "&cityCode=" + cityCodeObj, 5, { width: 700, height: 570, closebtn: 'DOWN', overlay: false, title: '도시명 검색' });
}

// 지도 플래시에서 상세보기 눌렀을때 창띄우기.
function viewContent(contentCode)
{
    Window.center("/Product/Common/ShowPlaceInfo.aspx?contentCode=" + contentCode, "showPlaceInfo", 970, 660, 'no');
}


// 다른 출발일 보기
function anotherStartDate(url)
{
    var w = 650;
    var h = 255;

    if (Browser.isWinIE)
    {
        w = 660;
        h = 270;
    }
    new FlushPopup(url, 5, {width:w, height:h, showTitle:true, titleimage:'/images/common/bar_date.gif', title:'다른출발일 보기', overlay:false })
}


/***********************************************
* Pausing up-down scroller- ⓒ Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
	this.content=content //message array content
	this.tickerid=divId //ID of ticker div to display information
	this.delay=delay //Delay between msg change, in miliseconds.
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
	this.hiddendivpointer=1 //index of message array for hidden div

	document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden;height:20px;">');
	document.write('<div class="innerDiv" style="position:absolute; width:100%; height:20px;" id="'+divId+'1">'+content[0]+'</div>');
	document.write('<div class="innerDiv" style="position:absolute; width:100%; height:20px; visibility:hidden;" id="'+divId+'2">'+content[1]+'</div></div>');

	var scrollerinstance=this

	if (window.addEventListener) //run onload in DOM2 browsers
		window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
	else if (window.attachEvent) //run onload in IE5.5+
		window.attachEvent("onload", function(){scrollerinstance.initialize()})
	else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec

	setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
	this.tickerdiv=document.getElementById(this.tickerid)
	this.visiblediv=document.getElementById(this.tickerid+"1")
	this.hiddendiv=document.getElementById(this.tickerid+"2")
	this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
	//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
	// 2007-10-05 해외항공에서 에러가 발생하여 수정함
	if (this.tickerdiv.offsetWidth-(this.visibledivtop*2)>0)
		this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
	this.getinline(this.visiblediv, this.hiddendiv)
	this.hiddendiv.style.visibility="visible"

	var scrollerinstance=this
	document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
	document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}

	if (window.attachEvent) //Clean up loose references in IE
		window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})

	setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
	var scrollerinstance=this
	if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
		this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
		this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
		setTimeout(function(){scrollerinstance.animateup()}, 50)
	}else{
		this.getinline(this.hiddendiv, this.visiblediv)
		this.swapdivs()

		setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
	}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
	var tempcontainer=this.visiblediv
	this.visiblediv=this.hiddendiv
	this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
	div1.style.top=this.visibledivtop+"px"
	div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
	var scrollerinstance=this
	if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
		setTimeout(function(){scrollerinstance.setmessage()}, 100)
	else{
		var i=this.hiddendivpointer
		var ceiling=this.content.length
		this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
		this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
		this.animateup()
	}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
	if (tickerobj.currentStyle)
		return tickerobj.currentStyle["paddingTop"]
	else if (window.getComputedStyle) //if DOM2
		return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
	else
		return 0
}


function writeLoadingFlash(div) {

	var sTag = '<div id="loadingMsg" style="position: relative; left: 180px; top:10px; display: block;">';
	sTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	sTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
	//sTag += 'style="vertical-align:middle;" width="346" height="148" align="center">';
	sTag += 'width="354" height="193" align="absmiddle">';
	sTag += '<param name="movie" value="/images/air_overseas/loading_s.swf" />';
	sTag += '<param name="quality" value="high" />'
	sTag += '<embed src="/images/air_overseas/loading_s.swf" quality="high" ';
	sTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	sTag += 'type="application/x-shockwave-flash" width="354" height="193"></embed></object></div>';

	div.innerHTML = sTag; 
}

//플래시 로딩 멈추기 
function loadingStop() {
	var oLoadingMsg = document.getElementById("loadingMsg")

	if (oLoadingMsg != undefined && oLoadingMsg != null) {
		oLoadingMsg.style.visibility = "hidden";
		oLoadingMsg.style.display = "none";
	}


	//document.all.loadingMsg.style.visibility = "hidden";
}


function getRoutings(routings, viacitys) {


	var ret = routings;
	var arrStartRouting = routings.split('~')[0]	
	//for( 
}