// JScript 
function ShowMain(FileName_Left,FileName_Right,Right_Stop) {
    var temp;
    if (FileName_Left != "") {
        var checkLeftUrl = CheckCurrentLeftUrl(FileName_Left);
        if (checkLeftUrl == "false") {
            temp = document.getElementById("left");
            temp.src = FileName_Left + GetUrlParm(FileName_Left);
            temp.contentWindow.window.name = "left";
            frames["left"] = temp.contentWindow.window;
        }
    }
    if (FileName_Right != "") {
        //alert(FileName_Right);
        temp = document.getElementById("main_right");
        temp.src = FileName_Right + GetUrlParm(FileName_Right);
        temp.contentWindow.window.name = "main_right";
        frames["main_right"] = temp.contentWindow.window;
    }
    if (Right_Stop != "") {
        //alert(FileName_Right);
        temp = document.getElementById("Stop");
        //temp.src = FileName_Right + GetUrlParm(FileName_Right);
        //temp.contentWindow.window.name = "main_right";
        //frames["main_right"] = temp.contentWindow.window;
        temp.innerHTML = Right_Stop;
    }
}

function UpdateNav(Nav)
{
    
}

function OpenLink(FileName_Left, FileName_Right, Right_Stop) {
//    if (parent.document.getElementById("left").src != FileName_Left) {
//        parent.document.getElementById("left").src = FileName_Left;
//    }
    var mr = parent.document.getElementById("main_right");
    mr.src = FileName_Right;
    mr.contentWindow.window.name = "main_right";
    frames["main_right"] = mr.contentWindow.window;
    
     if (Right_Stop != "") {
        //alert(FileName_Right);
        temp = parent.document.getElementById("Stop");
        //temp.src = FileName_Right + GetUrlParm(FileName_Right);
        //temp.contentWindow.window.name = "main_right";
        //frames["main_right"] = temp.contentWindow.window;
        temp.innerHTML = Right_Stop;
    }
}

function CheckCurrentLeftUrl(leftUrl) {
    var src = document.getElementById("left").src;
    var regex = /\s*[\?&]{1,1}t=[0-9]{1,}$/;
    var currentLeftUrl = src.replace(regex, '');
    if (currentLeftUrl.lastIndexOf(leftUrl) >= 0) {
        if (currentLeftUrl.lastIndexOf(leftUrl) == (currentLeftUrl.length - leftUrl.length)) {
            return "true";
        }
    }
    return "false";
}

function GetUrlParm(url) {
    var urlparm = "?";
    if (url.indexOf('?') >= 0) {
        urlparm = "&";
    }
    urlparm = urlparm + "t=" + GetRandomNum();
    return urlparm;
}

function GetRandomNum() {
    var Range = 1000;
    var Rand = Math.random();
    return (Math.round(Rand * Range));
}



function reinitIframe(){

    var iframeleft = document.getElementById("left");
    var iframeright = document.getElementById("main_right");

    try{
    
    if(iframeright.contentWindow.document.documentElement.scrollHeight < 430)
    {
        iframeleft.height =  iframeleft.contentWindow.document.documentElement.scrollHeight;
        iframeright.height =  430;
        iframeright.width =  document.body.clientWidth - 160;
    }else
    {
        iframeleft.height =  iframeleft.contentWindow.document.documentElement.scrollHeight;
        iframeright.height =  iframeright.contentWindow.document.documentElement.scrollHeight;
        iframeright.width =  document.body.clientWidth - 170;
    }


    

    }catch (ex){}

    }

    window.setInterval("reinitIframe()", 200);



 function MenuOperation(Menu,M){
    //alert(document.getElementById(Menu).style.display);
    if (document.getElementById(Menu).style.display == "none")
    {
        document.getElementById(Menu).style.display = "block";
        document.getElementById(M).className = "menu-bg lv-1-opn"
    }
    else
    {
        document.getElementById(Menu).style.display = "none";
        document.getElementById(M).className = "menu-bg lv-1-cls"
    }
//    alert(Menu);
//    alert(document.getElementById(Menu).style.display);
}


function LNKOpen(Menu)
{
    parent.document.getElementById(Menu).style.display = "block";
}

function LNKClose(Menu)
{
    parent.document.getElementById(Menu).style.display = "none";
}


function MenuClick(Number,Count)
{
    //alert(Number);
    var RunNumber = Number;
    
    for(var i = 1; i<= Count; i++)
    {
        if (i==RunNumber){
            document.getElementById("Nav" +i).className = "b current";
        }
		else
        {
        document.getElementById("Nav" + i).className = "b";
        }
    }
    
}

function NoticeBox(Number,Count)
{
    for(var i = 1; i<= 3; i++)
    {
        if (i==Number){
            document.getElementById("Notice_" +i).className = "f-tab-t selected";
            document.getElementById("NoticeBox_"+i).style.display = "block";
        }
		else
        {
            document.getElementById("Notice_" +i).className = "f-tab-t";
            document.getElementById("NoticeBox_"+i).style.display = "none";
        }
    }
}



