function dictsearch()
{
        var txt = document.getElementById('keyword').value;
	txt = txt.replace(/\//g, "／");
        txt = txt.replace(/\./g, "．");
        txt = txt.replace(/=/g, "＝");

        type = encodeURIComponent('全ての辞書');
        req = encodeURIComponent(txt);
        if (txt.length == 0)
        {
                url = "/index.html";
        }
        else
        {
                //url = "/dictsearch.php?keyword=" + req + "&searchtype=" + type;
                url = "/" + req + "/" + type;
        }
        window.location.href = url;

        return false;
}

function procSubmit()
{
        var txt = document.sbox.keyword.value;
	txt = txt.replace(/\//g, "／");
        txt = txt.replace(/\./g, "．");
        txt = txt.replace(/=/g, "＝");
        if(document.sbox.searchtype.length)
        {
                var i;
                for(i = 0; i < document.sbox.searchtype.length; i ++)
                {
                        if(document.sbox.searchtype[i].checked)
                        {
                                type = encodeURIComponent(document.sbox.searchtype[i].value);
                                req = encodeURIComponent(txt);
                                if (txt.length == 0)
                                {
                                        url = "/index.html";
                                }
                                else
                                {
                                        url = "/" + req + "/" + type;
                                }
                                window.location.href = url;

                                return false;
                        }
                }
                return false;
        }
}

function dictsearchByType(st)
{
        var txt = document.getElementById('keyword').value;
	txt = txt.replace(/\//g, "／");
        txt = txt.replace(/\./g, "．");
        txt = txt.replace(/=/g, "＝");

        type = encodeURIComponent('全ての辞書');
        switch(st)
        {
                case 'jp':
                        type = encodeURIComponent('国語');
                        break;
                case 'jpen':
                        type = encodeURIComponent('和英');
                        break;
                case 'enjp':
                        type = encodeURIComponent('英和');
                        break;
                case 'alldicts':
                default:
                        type = encodeURIComponent('全ての辞書');
        }

        req = encodeURIComponent(txt);
        if (txt.length == 0)
        {
                url = "/index.html";
        }
        else
        {
                //url = "/dictsearch.php?keyword=" + req + "&searchtype=" + type;
                url = "/" + req + "/" + type;
        }
        window.location.href = url;

        return false;
}

function sentencesearch()
{
        var txt = document.getElementById('keyword').value;

        req = encodeURIComponent(txt);
        if (txt.length == 0)
        {
                url = "/sentence.html";
        }
        else
        {
                url = "/sentencesearch.php?keyword=" + req;
        }
        window.location.href = url;

        return false;
}


function translate()
{
        var txt = document.getElementById('keyword').value;

        req = encodeURIComponent(txt);
        if (txt.length == 0)
        {
                url = "/translation.html";
        }
        else
        {
                url = "/translation.php?originaltext=" + req;
        }
        window.location.href = url;

        return false;
}

function keydown()
{
        if (event.keyCode == 13)
        {
                event.returnValue=false;
                document.getElementById("noresults-searchsubmit").click();
                return false;
        }
}

function dicsh(txt)
{
	txt = txt.replace(/\//g, "／");
        txt = txt.replace(/\./g, "．");
        txt = txt.replace(/=/g, "＝");
        type = encodeURIComponent('全ての辞書');
        req = encodeURIComponent(txt);
        if (txt.length == 0)
        {
                url = "/index.html";
        }
        else
        {
                url = "/" + req + "/" + type;
        }
        window.location.href = url;

        return false;
}
