﻿function Search() {
    var txtSearch = document.getElementById("txtSearch")
    if (txtSearch != null) {
        var rbGoogle = document.getElementById("rbGoogle");
        if ((rbGoogle != null) && (rbGoogle.checked)) {
            window.location = 'http://www.google.com/search?q=' + URLEncode(txtSearch.value);
        }
        var rbGoogleSite = document.getElementById("rbGoogleSite");
        if ((rbGoogleSite != null) && (rbGoogleSite.checked)) {
            window.location = 'http://www.google.com/search?q=' + URLEncode(txtSearch.value) + '&sitesearch=' + rbGoogleSite.value;
        }
        var rbSanook = document.getElementById("rbSanook");
        if ((rbSanook != null) && (rbSanook.checked)) {
            window.location = 'http://search.sanook.com/search.php?keepInput=&searchtype=1&q=' + URLEncode(txtSearch.value) + '&si=t&web_search.x=37&web_search.y=9'
        }
        var rbYouTube = document.getElementById("rbYouTube");
        if ((rbYouTube != null) && (rbYouTube.checked)) {
            window.location = 'http://www.youtube.com/results?search_query=' + URLEncode(txtSearch.value) + '&search_type=&aq=f'
        }
        var rbEbay = document.getElementById("rbEbay");
        if ((rbEbay != null) && (rbEbay.checked)) {
            window.location = 'http://shop.ebay.co.uk/?_nkw=' + URLEncode(txtSearch.value) + '&_sacat=See-All-Categories'
        }
        var rbAmazon = document.getElementById("rbAmazon");
        if ((rbAmazon != null) && (rbAmazon.checked)) {
            window.location = 'http://www.amazon.co.uk/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=' + URLEncode(txtSearch.value)
        }
        var rbASPNET = document.getElementById("rbASPNET");
        if ((rbASPNET != null) && (rbASPNET.checked)) {
            window.location = 'http://forums.asp.net/search/SearchResults.aspx?q=' + URLEncode(txtSearch.value) + '&o=Relevance'
        }
        var rbThai2English = document.getElementById("rbThai2English");
        if ((rbThai2English != null) && (rbThai2English.checked)) {
            window.location = 'http://www.thai2english.com/search.aspx?q=' + txtSearch.value
        }
        var rbUsingEnglish = document.getElementById("rbUsingEnglish");
        if ((rbUsingEnglish != null) && (rbUsingEnglish.checked)) {
            window.location = 'http://www.usingenglish.com/search/?cx=002032201194017603994%3Al6hqsqkwdx0&cof=FORID%3A11&q=' + URLEncode(txtSearch.value) + '#1424';
        }
        var rbEnWikipedia = document.getElementById("rbEnWikipedia");
        if ((rbEnWikipedia != null) && (rbEnWikipedia.checked)) {
            window.location = 'http://en.wikipedia.org/wiki/' + URLEncode(Underscore(txtSearch.value))
        }
        var rbThWikipedia = document.getElementById("rbThWikipedia");
        if ((rbThWikipedia != null) && (rbThWikipedia.checked)) {
            window.location = 'http://th.wikipedia.org/wiki/' + URLEncode(Underscore(txtSearch.value))
        }
    }
}
