﻿function DoSearch(){    if(document.getElementById("sk").value=="")    {        alert('Please enter a value to search for');        document.getElementById("sk").focus();        return false;    }    window.location='Albums.aspx?act=' + document.getElementById("tpe").value + '&key=' + document.getElementById("sk").value + '&sk=' + document.getElementById("sk").value;    return false;}function doEnterSearch(buttonName,e)
    {
    //the purpose of this function is to allow the enter key to 

    //point to the correct button to click.

        var key;

         if(window.event)
              key = window.event.keyCode;     //IE

         else
              key = e.which;     //firefox

    
        if (key == 13)
        {
            //Get the button the user wants to have clicked

            var target=document.getElementById(buttonName);
            if(target!=null)
            {
                if(document.dispatchEvent) {
                    var oEvent = document.createEvent( "MouseEvents" );
                    oEvent.initMouseEvent("click", true, true,window, 1, 1, 1, 1, 1, false, false, false, false, 0, target);
                    target.dispatchEvent( oEvent );
                    return false;
                }else if(document.fireEvent) { // IE
                    target.fireEvent("onclick");
                    return false;
                }
            }else{
                if(document.dispatchEvent) { // W3C
                    return DoSearch();
    //                var oEvent = document.createEvent( "MouseEvents" );
    //                oEvent.initMouseEvent("click", true, true,window, 1, 1, 1, 1, 1, false, false, false, false, 0, target);
    //                target.dispatchEvent( oEvent );
                    }
                else if(document.fireEvent) { // IE
                    //target.fireEvent("onclick");
                    return DoSearch();
                    }    
             }
        }
   }

