/* JIS Web Standardization Team (http://www.jisman.co.kr) 권미영 */

/*셀렉트새창시작*/
function changeURL(url) {
    if (url != "") window.open(url);
}
/*셀렉트새창끝*/



/*스크롤메뉴시작*/
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function FloatDiv(id, sx, sy) {
    var el = d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];
    var px = document.layers ? "" : "px";
    window[id + "_obj"] = el;
    if (d.layers) el.style = el;
    el.cx = el.sx = sx;
    el.cy = el.sy = sy;
    el.sP = function(x, y) {
        this.style.left = x + px;
        this.style.top = y + px;
    };

    el.floatIt = function() {
        var pX, pY;
        pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
		document.documentElement && document.documentElement.clientWidth ?
		document.documentElement.clientWidth : document.getElementById("sub_container").clientWidth;
        pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
		document.documentElement.scrollTop : document.getElementById("sub_container").scrollTop;
        if (this.sy < 0)
            pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.getElementById("sub_container").clientHeight;
        this.cx += (pX + this.sx - this.cx) / 8; this.cy += (pY + this.sy - this.cy) / 8;
        this.sP(this.cx, this.cy);
        setTimeout(this.id + "_obj.floatIt()", 40);
    }
    return el;
}
//사용법: 움직일 객체 다음에 아래코드 삽입
//JSFX_FloatDiv("right_menu", 810,0).floatIt();
/*스크롤메뉴끝*/



/*펼침메뉴시작*/
function sh_faq(num) {
    var curSta = document.getElementById('faq_a' + num).style.display;
    if (curSta != "none") {
        document.getElementById('faq_a' + num).style.display = "none";
    } else {
        for (i = 1; i < 2; i++) {
            document.getElementById('faq_a' + i).style.display = "none";
        }
        document.getElementById('faq_a' + num).style.display = "block";
    }
}
/*펼침메뉴끝*/



/*오른쪽메뉴아이프레임세로사이즈자동리사이징시작*/
function getDocHeight(doc) {
    var docHt = 0, sh, oh;
    if (doc.height) {
        docHt = doc.height;
    }
    else if (doc.body) {
        if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
        if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
        if (sh && oh) docHt = Math.max(sh, oh);
    }
    return docHt;
}

function getReSize() {
    if (document.getElementById("ctl00_ctl00_quick_menu")) {

        var iframeWin = window.frames['ctl00_ctl00_quick_menu'];

        var iframeEl = window.document.getElementById ? window.document.getElementById('ctl00_ctl00_quick_menu') : document.all ? document.all['ctl00_ctl00_quick_menu'] : null;

        if (iframeEl && iframeWin) {
            var docHt = getDocHeight(iframeWin.document);

            if (docHt != iframeEl.style.height) iframeEl.style.height = docHt + 'px';
        }
        else { // firefox
            var docHt = window.document.getElementById('ctl00_ctl00_quick_menu').contentDocument.height;
            window.document.getElementById('ctl00_ctl00_quick_menu').style.height = docHt + 'px';
        }
    }
}

function getRetry() {
    getReSize();
    setTimeout('getRetry()', 500);
}
$(document).ready(getRetry);
/*오른쪽메뉴아이프레임세로사이즈자동리사이징끝*/





/*맵시작*/
function getReSize_Map() {
    if (document.getElementById("map")) {

        var iframeWin = window.frames['map'];

        var iframeEl = window.document.getElementById ? window.document.getElementById('map') : document.all ? document.all['map'] : null;

        if (iframeEl && iframeWin) {
            var docHt = getDocHeight(iframeWin.document);

            if (docHt != iframeEl.style.height) iframeEl.style.height = docHt + 'px';
        }
        else { // firefox
            var docHt = window.document.getElementById('map').contentDocument.height;
            window.document.getElementById('map').style.height = docHt + 'px';
        }
    }
}

function getRetry_Map() {
    getReSize_Map();
    setTimeout(getRetry_Map, 500);
}
$(document).ready(getRetry_Map);
/*맵끝*/



/*연혁탭시작*/
function history(o) {
    images_on = new Array("images/History_tab_01.gif", "images/History_tab_02.gif", "images/History_tab_03.gif");
    images = new Array("history_tab_01", "history_tab_02", "history_tab_03");

    //alert("SRC::"+document.getElementById("history_tab").src);

    for (i = 0; i < images.length; i++) {
        if (images[i] == o) {
            ///document.history_tab.src = images_on[i];
            document.getElementById("history_tab").src = images_on[i];
            //eval(images[i]).style.display="";
            document.getElementById(images[i]).style.display = "block";
        } else {
            //eval(images[i]).style.display="none";
            document.getElementById(images[i]).style.display = "none";
        }
    }
}
/*연혁끝*/

// Dealer Locator 레이어 팝업 비활성화 
function LayerPopupInit() {
    $("#construction_usa").html("");
    $("#construction_usa").hide();
}
// Dealer Locator 레이어 팝업 활성 
function LayerPopupOpen(country, state, category) {
    $("#construction_usa").html("<iframe id='map' src='DealerInfo.aspx?country=" + country + "&state=" + state + "&category=" + category + "' frameborder='0' scrolling='no' height='100%' width='100%' marginwidth='0' marginheight='0' allowtranaparency='rue'></iframe>");
    $("#construction_usa").show();
}

/*건설장비맵탭시작*/
function construction(o) {
    images_on = new Array("images/Construction_tab_01.gif", "images/Construction_tab_02.gif");
    images = new Array("construction_tab_01", "construction_tab_02");

    //alert("SRC::"+document.getElementById("construction_tab").src);

    for (i = 0; i < images.length; i++) {
        if (images[i] == o) {
            ///document.construction_tab.src = images_on[i];
            document.getElementById("construction_tab").src = images_on[i];
            //eval(images[i]).style.display = "block";
            document.getElementById(images[i]).style.display = "block";
        } else {
            //eval(images[i]).style.display = "none";
            document.getElementById(images[i]).style.display = "none";
        }
    }
    LayerPopupInit();
}
/*건설장비맵끝*/



/*수장비맵탭시작*/
function handling(o) {
    images_on = new Array("images/Handling_tab_01.gif", "images/Handling_tab_02.gif");
    images = new Array("handling_tab_01", "handling_tab_02");

    //alert("SRC::"+document.getElementById("chandling_tab").src);

    for (i = 0; i < images.length; i++) {
        if (images[i] == o) {
            ///document.handling_tab.src = images_on[i];
            document.getElementById("handling_tab").src = images_on[i];
            //eval(images[i]).style.display = "block";
            document.getElementById(images[i]).style.display = "block";
        } else {
            //eval(images[i]).style.display = "none";
            document.getElementById(images[i]).style.display = "none";
        }
    }
    LayerPopupInit();
}
/*수장비맵끝*/



/*parts탭시작*/
function parts(o) {
    images_on = new Array("images/Parts_tab_01.gif", "images/Parts_tab_02.gif");
    images = new Array("parts_tab_01", "parts_tab_02");

    //alert("SRC::"+document.getElementById("parts_tab").src);

    for (i = 0; i < images.length; i++) {
        if (images[i] == o) {
            ///document.parts_tab.src = images_on[i];
            document.getElementById("parts_tab").src = images_on[i];
            //eval(images[i]).style.display="";
            document.getElementById(images[i]).style.display = "block";
        } else {
            //eval(images[i]).style.display="none";
            document.getElementById(images[i]).style.display = "none";
        }
    }
}
/*parts끝*/



// popup
function openWindowFrameless(url, winname, x, y, px, py) {
    win = window.open("", winname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + x + ",height=" + y + ";");
    win.moveTo(px, py);
    win.document.location.replace(url);
}

// LayerPopup
function openWindowLayer(rul, winname, x, y, px, py) {
    $("#LayerPopups").html(function() {
        var tag = "";
        tag += "<div style=''>";
    });
}
