jQuery(document).ready(function() {
    try {
        var qdr = /[?&]as_qdr=([^&]*)/
      .exec(window.location.search)[1];
        //      alert(qdr);
        var opts = document
      .getElementsByName("as_qdr")[0]
      .getElementsByTagName("option");
        for (var i = 0; i < opts.length; i++)
            opts[i].selected = (opts[i].value == qdr);
    } catch (e) { }
}
  	);

function searchFocus(txt) {
    //stop ad panel refresh
    var thisTimer = (jQuery('span[id$=Timer1]'));
    if (thisTimer.length == 1) {
        ToggleTimer(thisTimer[0].id);
    }
    if (jQuery('#search_criteria > input').val() == jQuery('#search_hidden > input').val())
        jQuery('#search_criteria > input').val("");
}
function searchBlur(txt) {
    if (jQuery('#search_criteria > input').val() == "") {
        jQuery('#search_criteria > input').val(jQuery('#search_hidden > input').val());
        var thisTimer = (jQuery('span[id$=Timer1]'));
        if (thisTimer.length == 1) {
            ToggleTimer(thisTimer[0].id);
        }
    }
}
function searchSubmit(event) {
    jQuery('#search_criteria > input').val(jQuery('#q2Value > input').val());
    //            if (event.keyCode == 13) {
    //                document.getElementById('mainform').method = 'get';
    //                document.getElementById('mainform').submit();
    //            }
}
function searchClicked() {
    var str = window.location.href;
    str = (str.replace(/as_qdr=.*?\&/, "as_qdr=" + jQuery('#searchTime').val() + "&"));
    str = (str.replace(/\?q=.*?\&/, "?q=" + jQuery('#mainSearch').val() + "&"));
    if (str.indexOf("?q=") == -1) {
        str = str + "?q=" + jQuery('#mainSearch').val() + "&" + "as_qdr=" + jQuery('#searchTime').val() + "&cof=FORID:11" + "&ie=UTF-8" + "&cx=016530437863538178274:scvtjmmlany";
    }
    window.location.href = str;
}

