﻿function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
    }
}

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

function center_imgwait() {
    var x = document.getElementById("imgwait");
    if (x != null) {
        var myWidth = 0, myHeight = 0;
        if (typeof (window.innerWidth) == 'number') {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
        } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
        } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
        }

        var scrOfX = 0, scrOfY = 0;
        if (typeof (window.pageYOffset) == 'number') {
            //Netscape compliant
            scrOfY = window.pageYOffset;
            scrOfX = window.pageXOffset;
        } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            //DOM compliant
            scrOfY = document.body.scrollTop;
            scrOfX = document.body.scrollLeft;
        } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            //IE6 standards compliant mode
            scrOfY = document.documentElement.scrollTop;
            scrOfX = document.documentElement.scrollLeft;
        }

        var a = (myHeight + scrOfY - 45) / 2;
        var b = (myWidth + scrOfX - 45) / 2;

        x.style.position = "absolute";
        x.style.zIndex = "200";
        x.style.top = String(a) + "px";
        x.style.left = String(b) + "px";
    }
}

function divScrollLeftPos() {
    var x, y;
    x = document.getElementById('txtdivScrollLeftPos');
    y = document.getElementById('divScrollLeft');
    x.value = y.scrollTop;
}

function divScrollRightPos() {
    var x, y;
    x = document.getElementById('txtdivScrollRightPos');
    y = document.getElementById('divScrollRight');
    x.value = y.scrollTop;
}

function focus1() {
    var x;
    x = document.getElementById("btReset");
    x.focus();
    window.setTimeout("focus2()", 1);
}

function focus2() {
    var x;
    x = document.getElementById("txtSearchString");
    x.focus();
}

function musicsearch() {
    var x, y, a, b, c, z1, z2, x1, x2 ,x3;
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    var scrOfX = 0, scrOfY = 0;
    if (typeof (window.pageYOffset) == 'number') {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }

    if (myHeight < 681) {
        myHeight = 681;
    }

    a = (myHeight + scrOfY - 30);
    b = (myWidth - 1000) / 2;

    y = document.getElementById('divScrollLeft');
    a = 0;
    b = 0;
    z2 = y;
    while (z2 != null) {
        a += z2.offsetTop;
        b += z2.offsetLeft;
        z2 = z2.offsetParent;
    }

    x = document.getElementById('txtdivScrollReset');
    if (x != null) {
        if (x.value != '') {
            x.value = '';
            x = document.getElementById('txtdivScrollLeftPos');
            x.value = 0;
            x = document.getElementById('txtdivScrollRightPos');
            x.value = 0;
        }
    }

    x = document.getElementById('txtdivScrollLeftPos');
    y = document.getElementById('divScrollLeft');
    y.style.height = String(myHeight - a - 28) + "px";
    y.scrollTop = x.value;

    x = document.getElementById('txtdivScrollRightPos');
    y = document.getElementById('divScrollRight');
    y.style.height = String(myHeight - a - 28) + "px";
    y.scrollTop = x.value;

    x1 = document.getElementById('lblPlay1');
    x2 = document.getElementById('lblPlay2');
    x3 = document.getElementById('lblPlay3');
    if (x1.innerHTML != x2.innerHTML) {
        var so = new SWFObject("mediaplayer.swf", "mediaplayer", "300", "20", "10", "#CCCCCC");
        so.addParam('wmode', 'transparent');
        if (x1.innerHTML != '') {
            so.addParam('flashvars', 'file=' + x1.innerHTML + '&autostart=true');
        }
        so.write("divplayer1");
        x2.innerHTML = x1.innerHTML;
        x3.innerHTML = '1';
    }
    else {
        if (x3.innerHTML == '') {
            var so = new SWFObject("mediaplayer.swf", "mediaplayer", "300", "20", "10", "#CCCCCC");
            so.addParam('wmode', 'transparent');
            if (x1.innerHTML != '') {
                so.addParam('flashvars', 'file=' + x1.innerHTML + '&autostart=false');
            }
            so.write("divplayer1");
            x2.innerHTML = x1.innerHTML;
            x3.innerHTML = '1';
        }
    }

    z1 = document.getElementById('divplayer1');
    z2 = document.getElementById('divplayer2');
    a = 0;
    b = 0;
    while (z2 != null) {
        a += z2.offsetTop;
        b += z2.offsetLeft;
        z2 = z2.offsetParent;
    }
    z1.style.position = "absolute";
    z1.style.top = String(a) + "px";
    z1.style.left = String(b) + "px";
    z1.style.zIndex = "10";

    x = document.getElementById('tblDownload');
    x.style.position = "absolute";
    x.style.top = String(a + 17) + "px";
    x.style.left = String(b) + "px";
    x.className = "stylenormal";
    x.style.zIndex = "10";

}

function msgalert() {
    x = document.getElementById('lblMsg');
    if (x != null) {
        if (x.innerText != "") {
            alert(x.innerText);
        }
        x.innerText = "";
    }
}

function msgconfirm() {
    var x, y, z;
    x = document.getElementById('txtConfirmMsg');
    if (x != null) {
        if (x.value != '') {
            z = document.getElementById('txtConfirmBt');
            z = document.getElementById(z.value);
            var y = confirm(x.value);
            x.value = '';
            if (y == true)
                z.click();
        }
    }
}

function ClickButton() {
    var x, y;
    x = document.getElementById('txtClickButton');
    if (x != null) {
        if (x.value != "") {
            y = document.getElementById(x.value);
            x.value = '';
            y.click();
        }
    }
}

function messages() {
    msgalert();
    msgconfirm();
    ClickButton();
}
