﻿var $ = function(id) { return "string" == typeof id ? document.getElementById(id) : id; }
function ClearText(id, type) {
    if (type) {
        if ($(id).value == "") {
            $(id).value = $(id).defaultValue;
        }
    }
    else {
        if ($(id).value == $(id).defaultValue) {
            $(id).value = "";
        }
    }
}

function Search(textID, searchID, languageID) {
    var searchUrl;
    searchText = $(textID).value;
    encodeText = encodeURI(searchText);
    siteUrl = document.location + "";
    if (languageID == 7) {
        searchUrl = "http://" + siteUrl.substring(7, siteUrl.indexOf('/', 7)) + "/en/Search.aspx?searchTerms=" + encodeText;
    }
    else {
        searchUrl = "http://" + siteUrl.substring(7, siteUrl.indexOf('/', 7)) + "/Search.aspx?searchTerms=" + encodeText;
    }
    window.open(searchUrl); 
}
