﻿google.load('search', '1');

function cse() {
    var ScDiv = document.getElementById("cse");

    this.searchControl = new google.search.SearchControl();

    this.searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
    this.searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF);

    //        var customSearchControl = new google.search.CustomSearchControl('011596855553082056121:utaythspgcq');
    //        var customSearchControl = new google.search.CustomSearchControl(); //('011596855553082056121:utaythspgcq');

    var cseid = '011596855553082056121:utaythspgcq';

    //Add searchers
    var searcher;
    var options;

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, null);
    searcher.setUserDefinedLabel("All");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "AboutUs");
    searcher.setUserDefinedLabel("About us");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "Services");
    searcher.setUserDefinedLabel("Services");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);
    
    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "Products");
    searcher.setUserDefinedLabel("Products");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);
    
    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "Solutions");
    searcher.setUserDefinedLabel("Solutions");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "CaseStudies");
    searcher.setUserDefinedLabel("Case Studies");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();
    searcher.setSiteRestriction(cseid, "Blog");
    searcher.setUserDefinedLabel("Blog");
    options.setNoResultsString('No results');
    this.searchControl.addSearcher(searcher, options);
    
    var drawOptions = new google.search.DrawOptions();
    drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);

    this.searchControl.draw(ScDiv, drawOptions);

    this.searchControl.execute(q);

    //        customSearchControl.draw('cse');
    //        customSearchControl.setNoResultsString('No results');
    //        customSearchControl.execute(q);
}

function OnLoad() {
    new cse();
}
google.setOnLoadCallback(OnLoad, true);

//    google.setOnLoadCallback(init);
