﻿// JScript File

    function keydownhandler(event)
        {
        if(event && event.which) 
        {
            var e=event;
            var charCode=e.which;
        } 
        else 
        {
            var e=window.event;
            var charCode=e.keyCode;
        }
        // process only the Enter key
        if (charCode == 13)
        { 
            // cancel the default submit
            e.returnValue=false;
            e.cancel = true;        
            // submit the form by programmatically clicking the specified button
            var btn = document.getElementById("btnbooksearch");
            // finding the browser, and changing action according to that
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))                
                btn.click();        
            else        
                btn.focus();
        }
        }
        function validate()
        {
            //var radiobutton = document.getElementById("RadioButtonList1");
            var radiobutton = document.forms[0].RadioButtonList1;
            var chk = null;
            for (var i=0; i < radiobutton.length; i++)
            {
                if(radiobutton[i].checked)
                {
                    chk = true;
                }
            }
            if(!chk)
            {
                alert('Please Choose a Variant');
                return false;
            }
            else
                return true;
        }
        function mailtofriend(id,url)
        {
            window.open(url+'mailtofriend.aspx?id='+id,'mailtofriend','scrollbars=0,location=0,height=280,width=400')
        }
        function popup(id,url)
        {
            window.open(url+'productimgpopup.aspx?id='+id,'productimg','scrollbars=1,height=520,width=650');
        }
        
        function ltrim (s)
        {
            return s.replace( /^\s*/, "" );
        }
        
        function bookvalidation()
        {
            var key=document.getElementById("txtbookkey");
            if (ltrim(key.value)=="")
            { alert("Please enter Keyword to Search"); key.value=""; key.focus(); return false; }
        }
