﻿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;
}

var y;
y = document.getElementById('txtmyWidth');
if (y != null) { y.value = myWidth };
y = document.getElementById('txtmyHeight');
if (y != null) { y.value = myHeight };


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 divScrollLeftPos() {
    document.getElementById('txtdivScrollLeftPos').value = document.getElementById('divScrollLeft').scrollTop;
}

function divScrollRightPos() {
    document.getElementById('txtdivScrollRightPos').value = document.getElementById('divScrollRight').scrollTop;
}

function divScrollLeftRadGridPos() {
    document.getElementById('txtdivScrollLeftPos').value = document.getElementById('RadGrid1_GridData').scrollTop;
}

function cancelFunction() { alert("Express Install was cancelled"); }


function runScript() {
    x = document.getElementById('txtrunScript');
    if (x != null) {
        if (x.value != "") {
            var y = x.value;
            x.value = "";
            window.setTimeout(y, 0);
        }
    }
}

function msgalert() {
    x = document.getElementById('txtMsg');
    if (x != null) {
        if (x.value != "") {
            alert(x.value);
        }
        x.value = "";
    }
}

function msgconfirm() {
    try {
        var x, y, z;
        x = document.getElementById('txtConfirmMsg');
        y = x.value;
        x.value = '';
        z = document.getElementById('txtConfirmBt');
        z = document.getElementById(z.value);
        if (y == '1') {
            grayOut(true);
            z.click();
            return;
        }
        if (y == '2') {
            grayOut(false);
            z.click();
            return;
        }
        if (y == '.') {
            z.click();
            return;
        }
        if (y != '') {
            y = confirm(y);
            if (y == true) {
                z.click();
            }
            return;
        }
    }
    catch (err) {
    }
}

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 divScrollIni() {
    var x, y, a, b, c, z1, z2, x1, x2, x3;

    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('txtdivScrollResetLeft');
    if (x != null) {
        if (x.value != '') {
            x.value = '';
            x = document.getElementById('txtdivScrollLeftPos');
            x.value = 0;
        }
    }

    x = document.getElementById('txtdivScrollResetRight');
    if (x != null) {
        if (x.value != '') {
            x.value = '';
            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;

}

function messages() {
    msgalert();
    msgconfirm();
    ClickButton();
    runScript();
}

function fdiv1(div1, div2) {
    grayOut(true);
    var x = document.getElementById(div1);
    var y = document.getElementById(div2);
    var a = 0;
    var b = 0;
    var z = x;
    while (z != null) {
        a += z.offsetTop;
        b += z.offsetLeft;
        z = z.offsetParent;
    }
    y.style.position = "absolute";
    y.style.zIndex = "20";
    y.style.top = String(a + 20) + "px";
    y.style.left = String(b) + "px";
    y.className = "stylenormal";
}

function fdiv2(div2) {
    grayOut(false);
    var y = document.getElementById(div2);
    y.className = "stylehidden";
}


function projects(piPar) {
    var x;

    x = document.getElementById('txtPanel');
    if (x.value == 'Share') {
        fdiv1('divShare1', 'divShare2');
    }
    else {
        fdiv2('divShare2');
    }
    if (x.value == 'Send') {
        fdiv1('divSend1', 'divSend2');
    }
    else {
        fdiv2('divSend2');
    }

    cb_restore('txtc0');
    cb_restore('txtc1');
    cb_restore('txtc2');

    messages();
    if (piPar != 1) {
        player("230");
    }
    DownloadManager();

    //    divScrollIni();
}

function DownloadManager() {
    var x, y;
    x = document.getElementById("txtFiles");
    y = document.getElementById("divDownloadManager");
    if (x.value != '') {
        y.style.top = String((myHeight - 160) / 2) + "px";
        y.style.left = String((myWidth - 300) / 2 - 10) + "px";
        y.style.position = "absolute";
        y.style.zIndex = "50";
        y.innerHTML = "<applet archive='DownloadManagerPlugin7.jar' code='DownloadManager.class' style='width: 300px; height: 160px;' MAYSCRIPT><param name='DownloadFiles' value='" + x.value + "' ></applet>"
        y.style.visibility = "visible";
        grayOut(true);
    }
}

function DownloadManagerExit() {
    var x, y;
    x = document.getElementById("txtFiles");
    y = document.getElementById("divDownloadManager");
    x.value = '';
    y.style.visibility = "hidden";
    y.style.top = "0px";
    y.style.left = "0px";
    grayOut(false);
}

function player(psWidth) {

    if (swfobject.getFlashPlayerVersion().major < 10) {
        x = document.getElementById('divplayer1');
        x.style.width = "300px";
        x.style.textAlign = "center";
        x.innerHTML = "<a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>"
        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 - 5) + "px";
        z1.style.left = String(b) + "px";
        z1.style.zIndex = "10";
    }
    else {
        var x1, x2, x3, so, xsTime
        x1 = document.getElementById('lblPlay1'); // A musica que se pretende ouvir
        x2 = document.getElementById('lblPlay2'); // A musica que esta correntemente a ouvir
        x3 = document.getElementById('lblPlay3'); // "1" se start manual senão autostart
        xsTime = document.getElementById('lblTime');

        var flashvars = false;
        var params = { wmode: 'transparent', bgcolor: '#CCCCCC' };
        var attributes = {};

        if (x1.innerHTML == '') {
            // Mostra um player parado e sem música:
            swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
        }
        else {
            if (x1.innerHTML == x2.innerHTML) {
                // Se for a mesma música:
                if (x3.innerHTML == '') {
                    params = { wmode: 'transparent', bgcolor: '#CCCCCC', flashvars: 'duration=' + xsTime.innerHTML + '&file=' + x1.innerHTML + '&autostart=false' };
                    swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
                }
            }
            else {
                // Se mudou de música, toca a nova música:
                params = { wmode: 'transparent', bgcolor: '#CCCCCC', flashvars: 'duration=' + xsTime.innerHTML + '&file=' + x1.innerHTML + '&autostart=true' };
                swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
            }
        }

        x2.innerHTML = x1.innerHTML;
        x3.innerHTML = '1';

        z1 = document.getElementById('divplayer1');
        z2 = document.getElementById('divplayer2');
        a = 0;
        b = 0;
        try {
            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";
        }
        catch (err) {
            alert(err);
        }
    }
}

function c0_click(x) {
    var y, z, i, l;
    if (x.id == 'c00') {
        y = document.getElementById('txtc0');
        z = y.value.split(';');
        for (i = 1; i < z.length; i++) {
            y = document.getElementById(z[i]);
            if (y != null) {
                y.checked = x.checked;
            }
        }
    }
    else {
        y = document.getElementById('txtc0');
        z = y.value.split(';')
        l = true;
        for (i = 1; i < z.length & l; i++) {
            y = document.getElementById(z[i]);
            if (y != null) {
                l = y.checked;
            }
        }
        y = document.getElementById('c00');
        y.checked = l;
    }
    x = '';
    y = document.getElementById('txtc0');
    z = y.value.split(';');
    for (i = 1; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            if (y.checked) {
                x += ';' + y.id;
            }
        }
    }
    y = document.getElementById('txtc0Selected');
    y.value = x.substr(1, 1000);
}

function c1_click(x) {
    var y, z, i, l;

    if (x.checked) {
        x = x.id;
        x = x.substr(2, 1000);
        y = document.getElementById('c2' + x);
        if (y != null) {
            y.checked = false;
        }
    }

    x = '';
    y = document.getElementById('txtc1');
    z = y.value.split(';');
    for (i = 1; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            if (y.checked) {
                x += ';' + y.id;
            }
        }
    }
    y = document.getElementById('txtc1Selected');
    y.value = x.substr(1, 1000);

    x = '';
    y = document.getElementById('txtc2');
    z = y.value.split(';');
    for (i = 1; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            if (y.checked) {
                x += ';' + y.id;
            }
        }
    }
    y = document.getElementById('txtc2Selected');
    y.value = x.substr(1, 1000);
}

function c2_click(x) {
    var y, z, i, l;

    if (x.checked) {
        x = x.id;
        x = x.substr(2, 1000);
        y = document.getElementById('c1' + x);
        if (y != null) {
            y.checked = false;
        }
    }

    x = '';
    y = document.getElementById('txtc1');
    z = y.value.split(';');
    for (i = 1; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            if (y.checked) {
                x += ';' + y.id;
            }
        }
    }
    y = document.getElementById('txtc1Selected');
    y.value = x.substr(1, 1000);

    x = '';
    y = document.getElementById('txtc2');
    z = y.value.split(';');
    for (i = 1; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            if (y.checked) {
                x += ';' + y.id;
            }
        }
    }
    y = document.getElementById('txtc2Selected');
    y.value = x.substr(1, 1000);
}

function cb_restore(x) {
    var y, z, i, l;
    y = document.getElementById(x);
    z = y.value.split(';');
    for (i = 0; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            y.checked = false;
        }
    }
    y = document.getElementById(x + 'Selected');
    z = y.value.split(';');
    for (i = 0; i < z.length; i++) {
        y = document.getElementById(z[i]);
        if (y != null) {
            y.checked = true;
        }
    }
}

function grayOut(vis, options) {
    var ws = new windowSize();
    var x = document.getElementById('form1');
    x.style.height = ws.windowHeight;

    // Pass true to gray out screen, false to ungray
    // options are optional.  This is a JSON object with the following (optional) properties
    // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
    // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
    // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
    // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
    // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
    // in any order.  Pass only the properties you need to set.
    var options = options || {};
    var zindex = options.zindex || 19;
    var opacity = options.opacity || 40;
    var opaque = (opacity / 100);
    var bgcolor = options.bgcolor || '#000000';
    var dark = document.getElementById('darkenScreenObject');
    if (!dark) {
        // The dark layer doesn't exist, it's never been created.  So we'll
        // create it here and apply some basic styles.
        // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
        var tbody = document.getElementsByTagName("body")[0];
        var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position = 'absolute';                 // Position absolutely
        tnode.style.top = '0px';                           // In the top
        tnode.style.left = '0px';                          // Left corner of the page
        tnode.style.overflow = 'hidden';                   // Try to avoid making scroll bars            
        tnode.style.display = 'none';                      // Start out Hidden
        tnode.id = 'darkenScreenObject';                   // Name it so we can find it later
        tbody.appendChild(tnode);                            // Add it to the web page
        dark = document.getElementById('darkenScreenObject');  // Get the object.
    }
    if (vis) {
        // Calculate the page width and height 
        if (document.body && (document.body.scrollWidth || document.body.scrollHeight)) {
            var pageWidth = document.body.scrollWidth + 'px';
            var pageHeight = document.body.scrollHeight + 'px';
        } else if (document.body.offsetWidth) {
            var pageWidth = document.body.offsetWidth + 'px';
            var pageHeight = document.body.offsetHeight + 'px';
        } else {
            var pageWidth = '100%';
            var pageHeight = '100%';
        }
        //set the shader to cover the entire page and make it visible.
        dark.style.opacity = opaque;
        dark.style.MozOpacity = opaque;
        dark.style.filter = 'alpha(opacity=' + opacity + ')';
        dark.style.zIndex = zindex;
        dark.style.backgroundColor = bgcolor;
        dark.style.width = pageWidth;
        dark.style.height = pageHeight;
        dark.style.display = 'block';
    } else {
        dark.style.display = 'none';
    }
}

function fBodyBgColor() {
    var x, y;
    x = document.getElementById('lblBodyBgColor');
    y = document.getElementById('body1');
    y.bgColor = x.innerHTML;
}

function fPlayer(psWidth) {

    if (swfobject.getFlashPlayerVersion().major < 10) {
        var x = document.getElementById('divplayer1');
        x.style.width = "300px";
        x.style.textAlign = "center";
        x.innerHTML = "<a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>"
    }
    else {
        var x1, x2, x3, so, xsTime, gp

        x1 = document.getElementById('lblPlay1'); // A musica que se pretende ouvir
        x2 = document.getElementById('lblPlay2'); // A musica que esta correntemente a ouvir
        x3 = document.getElementById('lblPlay3'); // "1" se start manual senão autostart
        xsTime = document.getElementById('lblTime');

        var flashvars = false;
        var params = { wmode: 'transparent', bgcolor: '#CCCCCC' };
        var attributes = {};

        if (x1.innerHTML == '') {
            // Mostra um player parado e sem música:
            swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
        }
        else {
            if (x1.innerHTML == x2.innerHTML) {
                // Se for a mesma música:
                if (x3.innerHTML == '') {
                    params = { wmode: 'transparent', bgcolor: '#CCCCCC', flashvars: 'duration=' + xsTime.innerHTML + '&file=' + x1.innerHTML + '&autostart=false' };
                    swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
                }
            }
            else {
                // Se mudou de música, toca a nova música:
                params = { wmode: 'transparent', bgcolor: '#CCCCCC', flashvars: 'duration=' + xsTime.innerHTML + '&file=' + x1.innerHTML + '&autostart=true' };
                swfobject.embedSWF("JWPlayer.swf", "divplayer1", psWidth, "24", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
            }
        }

        x2.innerHTML = x1.innerHTML;
        x3.innerHTML = '1';
    }

}

// Catalogues2:

function fCTWindow(source) {
    var a, b, z1, z2, x;

    z1 = document.getElementById('flash1');
    z2 = document.getElementById('flash2');
    x = document.getElementById('tblFlash');

    if (z1 != null & z2 != null & x != null) {
        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.style.position = "absolute";
        x.style.top = String(a) + "px";
        x.style.left = String(b) + "px";
        x.className = "stylenormal";
        x.style.zIndex = "10";
    }

    if (document.getElementById('lblPanel').innerHTML == '3') {

        var ws, gp, wh, x, y, z;

        ws = new windowSize();
        x = document.getElementById('divform');
        if (x != null) {
            x.style.height = String(ws.windowHeight) + "px";
            x.style.zIndex = "0";
        }

        gp = new getPosition('divplayer2');
        x = document.getElementById('divplayer1');
        x.style.position = "absolute";
        x.style.top = String(gp.top + 4) + "px";
        x.style.left = String(gp.left) + "px";
        x.style.zIndex = "10";
        x.style.visibility = "visible";

        y = document.getElementById('divObras');
        if (y != null) {
            gp = new getPosition('divObras');

            z = ws.windowHeight - gp.top - 20;
            if (z < 10) { z = 10 };
            y.style.height = String(z) + "px";
            if (document.getElementById('divScrollLeft') != null) { document.getElementById('divScrollLeft').style.height = y.style.height };
            if (document.getElementById('divScrollRight') != null) { document.getElementById('divScrollRight').style.height = y.style.height };
            if (document.getElementById('RadGrid1') != null) { document.getElementById('RadGrid1').style.height = y.style.height };
            if (document.getElementById('tblInfo') != null) { document.getElementById('tblInfo').style.height = y.style.height };

            x = document.getElementById('txtdivScrollResetLeft');
            if (x != null) {
                if (x.value != '') {
                    document.getElementById('txtdivScrollLeftPos').value = 0;
                }
            }

            x = document.getElementById('txtdivScrollResetRight');
            if (x != null) {
                if (x.value != '') {
                    document.getElementById('txtdivScrollRightPos').value = 0;
                }
            }

            if (document.getElementById('divScrollLeft') != null) { document.getElementById('divScrollLeft').scrollTop = document.getElementById('txtdivScrollLeftPos').value };
            if (document.getElementById('divScrollRight') != null) { document.getElementById('divScrollRight').scrollTop = document.getElementById('txtdivScrollRightPos').value };
            if (document.getElementById('RadGrid1') != null & source == 5) { document.getElementById('RadGrid1_GridData').scrollTop = document.getElementById('txtdivScrollLeftPos').value };
        }
    }
}

function fCTActions(source) {
    if (document.getElementById('lblPanel').innerHTML == '3') { fPlayer("300") };
    messages();
    DownloadManager();
    fCTWindow(5);
    document.getElementById('txtdivScrollResetLeft').value = '';
    document.getElementById('txtdivScrollResetRight').value = '';
}

// MusicSearch2 MusicSearch3:

function fMSWindow(source) {
    var ws, gp, wh, x, y, z;

    ws = new windowSize();
    x = document.getElementById('divform');
    if (x != null) {
        x.style.height = String(ws.windowHeight) + "px";
        x.style.zIndex = "0";
    }

    gp = new getPosition('divplayer2');
    x = document.getElementById('divplayer1');
    x.style.position = "absolute";
    x.style.top = String(gp.top + 4) + "px";
    x.style.left = String(gp.left) + "px";
    x.style.zIndex = "10";
    x.style.visibility = "visible";

    y = document.getElementById('divObras');
    if (y != null) {
        gp = new getPosition('divObras');

        z = ws.windowHeight - gp.top - 20;
        if (z < 10) { z = 10 };
        y.style.height = String(z) + "px";
        if (document.getElementById('divScrollLeft') != null) { document.getElementById('divScrollLeft').style.height = y.style.height };
        if (document.getElementById('divScrollRight') != null) { document.getElementById('divScrollRight').style.height = y.style.height };
        if (document.getElementById('RadGrid1') != null) { document.getElementById('RadGrid1').style.height = y.style.height };
        if (document.getElementById('tblInfo') != null) { document.getElementById('tblInfo').style.height = y.style.height };

        x = document.getElementById('txtdivScrollResetLeft');
        if (x != null) {
            if (x.value != '') {
                document.getElementById('txtdivScrollLeftPos').value = 0;
            }
        }

        x = document.getElementById('txtdivScrollResetRight');
        if (x != null) {
            if (x.value != '') {
                document.getElementById('txtdivScrollRightPos').value = 0;
            }
        }

        if (document.getElementById('divScrollLeft') != null) { document.getElementById('divScrollLeft').scrollTop = document.getElementById('txtdivScrollLeftPos').value };
        if (document.getElementById('divScrollRight') != null) { document.getElementById('divScrollRight').scrollTop = document.getElementById('txtdivScrollRightPos').value };
        if (document.getElementById('RadGrid1') != null & source == 5) { document.getElementById('RadGrid1_GridData').scrollTop = document.getElementById('txtdivScrollLeftPos').value };
    }

 }

 function beginRequest(sender, args) {
     document.getElementById('txtStart2').value = document.getElementById('txtStart1').value;
     document.getElementById('txtEnd2').value = document.getElementById('txtEnd1').value;
     document.getElementById('txtControl2').value = document.getElementById('txtControl1').value;

     var d = new Date();
     document.getElementById('txtStart1').value = d.getTime(); ;
     document.getElementById('txtEnd1').value = '';
     document.getElementById('txtControl1').value = args.get_postBackElement().id;
 }

function endRequest(sender, args) {
    var d = new Date();
    document.getElementById('txtEnd1').value = d.getTime();;
    var f = document.getElementById('txtForm').value;
    switch (f)
    {
    case 'MusicSearch3': 
        fMSActions();
        break;
    case 'Catalogues2': 
        fCTActions();
        break;
    case 'Projects2': 
        projects();
        break;
    default:
        alert(f);
    }
}

function fMSNextPlay(source) {
    var x = document.getElementById('btNextPlay').value;
    if (x != '0') {
        window.setTimeout('fMSNextPlay2()', parseInt(x) * 1000);
    }
}

function fMSNextPlay2() {
    var x= document.getElementById("btNextPlay");
    x.click();
}

function fMSActions(source) {
    fMSNextPlay(source);
    fPlayer("300");
    messages();
    DownloadManager();
    fMSWindow(5);
    document.getElementById('txtdivScrollResetLeft').value = '';
    document.getElementById('txtdivScrollResetRight').value = '';
}

function closeWindow() {
    window.open('', '_self', '');
    window.close();
}

// User Info:

function fUIActions(source) {
    messages();
}

