﻿<!--

function GetHttpRequestObject()
{
    var xmlHttp = null;
        
    if (typeof XMLHttpRequest != 'undefined') 
    {
        xmlHttp = new XMLHttpRequest();
    }
    if (!xmlHttp) 
    {
        try 
        {
            xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch(e) 
        {
            try 
            {
                xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch(e) 
            {
                xmlHttp  = null;
            }
        }
    }
    
    return xmlHttp;
}

function ArtistRegisterIsTraderCB()
{
    if (document.Form1.ctl03_dv_Artist_cb_IsTrader.checked)
    {
        document.Form1.ctl03_dv_Artist_TextBoxUID.disabled = false;
        document.Form1.ctl03_dv_Artist_TextBoxUID.style.backgroundColor = "";
    }
    else
    {
        document.Form1.ctl03_dv_Artist_TextBoxUID.disabled = true;
        document.Form1.ctl03_dv_Artist_TextBoxUID.value = "";
        document.Form1.ctl03_dv_Artist_TextBoxUID.style.backgroundColor = "#EEEEEE";
    }
}

function sndPasswordCustomer(ev) 
{
    if (ev.keyCode == 13 || ev.which == 13)
        document.Form1.ctl03$btn_Request.click();
    return true;
}

function sndPasswordArtist(ev) 
{
    if (ev.keyCode == 13 || ev.which == 13)
        document.Form1.ctl03$btn_Request.click();
    return true;
}

function sndPasswordLabel(ev) 
{
    if (ev.keyCode == 13 || ev.which == 13)
        document.Form1.ctl03$btn_Request.click();
    return true;
}

function searchArtistOrAlbum(ev) 
{    
    if (ev.keyCode == 13 || ev.which == 13)
        Search();
    return false;
}

function SessionKeepAlive()
{
    window.setTimeout("SessionKeepAliveDoIt();", 900000);
}

function SessionKeepAliveDoIt()
{
    var request = GetHttpRequestObject();

    if (request)
    {
        request.open('GET', '/SessionKeepAlive.aspx', true);
        request.send(null);
        
        window.setTimeout("SessionKeepAliveDoIt();", 900000);
    }
}

function Search() 
{
    window.location.href = '/search.aspx?key=' + URLEncode(document.getElementById("Search1_txt_Search").value);
}

function URLEncode(url) 
{
    var SAFECHARS = "0123456789" + 
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
    "abcdefghijklmnopqrstuvwxyz" +
    "-_.!~*'()"; 
    var HEX = "0123456789ABCDEF";

    var plaintext = url;
    var encoded = "";
    for (var i = 0; i < plaintext.length; i++ ) 
    {
        var ch = plaintext.charAt(i);
        if (ch == " ") 
        {
            encoded += "+";
        } 
        else if (SAFECHARS.indexOf(ch) != -1) 
        {
            encoded += ch;
        } 
        else 
        {
            var charCode = ch.charCodeAt(0);
            if (charCode > 255) 
            {
                alert( "Unicode Character '"
                + ch
                + "' cannot be encoded using standard URL encoding.\n" +
                "(URL encoding only supports 8-bit characters.)\n" +
                "A space (+) will be substituted." );
                encoded += "+";
            } 
            else 
            {
                encoded += "%";
                encoded += HEX.charAt((charCode >> 4) & 0xF);
                encoded += HEX.charAt(charCode & 0xF);
            }
        }
    }

    return encoded;
}; 

-->
