﻿google.load('search', '1.0');

function OnSearchLoad() {

    var options = new google.search.SearcherOptions();
    var searchControl = new google.search.SearchControl();
    var searcher = new google.search.WebSearch();

    options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
    
    if(searchName=='khapre.org')
    {
        searcher.setSiteRestriction("www.khapre.org");
        searcher.setUserDefinedLabel("Search results from {Khapre.org}");
        searchControl.addSearcher(searcher,options);
	    searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF);
     }
    else
    {
        searcher.setSiteRestriction("007165592360334353365:tsvedcgscos");
        searcher.setUserDefinedLabel("Results from Custom {Khapre.org}");
        searchControl.addSearcher(searcher,options);
        searchControl.addSearcher(new google.search.BlogSearch(), options);
        searchControl.setLinkTarget(GSearch.LINK_TARGET_BLANK);
    }

    searchControl.draw(document.getElementById("sControl"));
    searchControl.execute(sTerm);
}
google.setOnLoadCallback(OnSearchLoad, true);
function OnSearchChange(value) 
{
    searchName=value;
    OnSearchLoad();
}
