//-----------------------------------------------------------
// 文件名称: Web25175_Hotel2.tabpanel.js
// 页面名称: Web25175_Hotel2.tabpanel
//　
// 描    述: .Net选项卡 ElementId服务器控件Id
// 版　　本: 1.1
// 兼容情况: IE6+,Chrome,Mozilla, Netscape, Firefox,Maxthon3+,
// 创建标识: Add By 吴希 2011-12-07
//------------------------------------------------------------------------------------------
//        <div id="header">
//            <ul>
//                <li class="current">
//                    <span> 选项卡１</span></li>
//                <li>
//                    <span> 选项卡２</span></li>
//                <li>
//                    <span> 选项卡３</span></li>
//            </ul>
//            <br style="clear: both;" />
//        </div>
//        <div tab="tabcontent"></div>
//        <div tab="tabcontent"></div>
//        <div tab="tabcontent"></div>
//------------------------------------------------------------------------------------------
function InitTabPanel(ElementId) {
    var Ele = uiGet(ElementId);
    var tab = uiGet("header");
    var tabPanel = new Array();
    var div = uiGetTag(window.document, "div");
    if (div != null && div.length > 0) {
        for (i = 0; i < div.length; i++) {
            if (div[i].getAttribute("tab") == "tabcontent") {
                tabPanel.push(div[i])
            }
        }
    }
    if (tab != null) {
        var li = uiGetTag(tab, "li");
        if (li != null && li.length > 0) {
            for (i = 0; i < li.length; i++) {
                if (Ele != null) {
                    if (Ele.value == i) {
                        li[i].className = "current";
                        if (tabPanel[i] != null) tabPanel[i].style.display = 'block';
                    } else {
                        li[i].className = "";
                        if (tabPanel[i] != null) tabPanel[i].style.display = 'none';
                    }
                }
                li[i].setAttribute("index", i);
                li[i].onclick = function() {
                    var index = this.getAttribute("index");
                    var lis = this.parentElement;
                    for (j = 0; j < li.length; j++) {
                        li[j].className = "";
                        if (tabPanel[j] != null) tabPanel[j].style.display = 'none';
                    }
                    this.className = 'current';
                    if (tabPanel[index] != null) tabPanel[index].style.display = 'block';
                    if (Ele != null) Ele.value = index;
                }
            }
        }
    }
}
