var is_iexplore = document.all;

//current controls focus index
var channel_cur_ctr_foc = 0;

function headjoyescom_Login(lurl)
{
    var uv = document.getElementById("top_username").value;
    var pv = document.getElementById("top_password").value;
    if(uv=='')
    {
        alert('请输入您的用户名!');
        return false;
    }
    if(pv=='')
    {
        alert('请输入您的密码!');
        return false;
    }
    var uri = document.location.href;
    window.location.href = lurl +"?u="+ escape(uri) +"&user="+ escape(uv) +"&pass="+ escape(pv) +"&fr=head";
}

//so
function headjoyescom_soInner()
{
    var s = document.getElementById("so_sort").value;
    var k = document.getElementById("q").value;
    var uri = "";
    if(k != "")
    {
        switch(parseInt(s))
        {
            case 0 : uri = "index.aspx";
                break;        
            case 1 : uri = "Search_Game.aspx";
                break;
            case 2 : uri = "Search_ring.aspx";
                break;
            case 3 : uri = "Search_Pic.aspx";
                break;
            case 4 : uri = "Search_Ebook.aspx";
                break;
            case 5 : uri = "Search_Theme.aspx";
                break;
            case 6 : uri = "Search_Tool.aspx";
                break; 
            case 7 : uri = "Search_Movie.aspx";
                break;                 
            default : uri = "index.aspx";
                break;
        }
        uri = "http://www.joyes.com/search/"+ uri +"?words="+ escape(k);
        window.location.href = uri;
    }
    else
    {
        alert("请输入搜索关键字!");
    }
}

//enter
function headjoyescom_mainctlkey()
{
    if(window.event.keyCode == 13)
    {
        if(channel_cur_ctr_foc == 50001)
        {
            //so
            headjoyescom_soInner();
        }
    }
}

if(is_iexplore)
{
    window.document.onkeydown = headjoyescom_mainctlkey;
}
