jQuery.noConflict();
jQuery(document).ready(function() {
//alert(jQuery("#diverror").length);
    if (jQuery("#diverror").length > 0) {


        if (jQuery("#ctl00_HiddenError").val() == 1 || jQuery("#ctl00_ctl00_HiddenError").val() == 1) {
            //alert('hai1');

            jQuery('#ctl00_divforgotpwd').hide('fast');
            jQuery('#userlogin').show('slow');
            jQuery('a#forgotpwd').show('slow');
            jQuery('#logintitle').show('slow');
            jQuery('#ctl00_divCaptcha').show('slow');
            jQuery('#ctl00_btnsignin').attr('disabled', '');
            jQuery('#ctl00_ctl00_divforgotpwd').hide();
            jQuery('#ctl00_divforgotpwd').hide();

        }
        else if (jQuery("#ctl00_HiddenError").val() == 2 || jQuery("#ctl00_ctl00_HiddenError").val() == 2) {
            //alert('hai2');

            jQuery('#userlogin').hide('slow');
            jQuery('a#forgotpwd').hide('slow');
            jQuery('#logintitle').hide('slow');
            jQuery('#ctl00_ctl00_divCaptcha').hide('slow');
            jQuery('#ctl00_divCaptcha').hide('slow');
            jQuery('#ctl00_divforgotpwd').show('fast');
            jQuery('#ctl00_divforgotpwd').attr('disabled', '');

        }
        jQuery("div#panel").slideDown("fast");
        jQuery("#toggle a").toggle();
        //jQuery('#ctl00_btnsignin').attr('disabled', '');
        //jQuery('#ctl00_ctl00_btnsignin').attr('disabled', '');
         

    } else {
        jQuery('#ctl00_ctl00_divforgotpwd').hide();
        jQuery('#ctl00_divforgotpwd').hide();
        jQuery('#ctl00_divCaptcha').show('slow');
        jQuery('#ctl00_btnsignin').attr('disabled', '');

    }
    
    // Expand Panel
    jQuery("#ctl00_ctl00_open").click(function() {
        jQuery("div#panel").slideDown("slow");
        jQuery('#ctl00_ctl00_btnsignin').attr('disabled', '');
        return false;
    });
    // Expand Panel 
    jQuery("#ctl00_open").click(function() {
        jQuery("div#panel").slideDown("slow");
        jQuery('#ctl00_btnsignin').attr('disabled', '');
        return false;
    });

    // Collapse Panel
    jQuery("#close").click(function() {
        jQuery("div#panel").slideUp("slow");
        jQuery('#ctl00_btnsignin').attr('disabled', 'disabled');
        return false;
    });

    // Switch buttons from "Log In | Register" to "Close Panel" on click
    jQuery("#toggle a").click(function() {
        jQuery("#toggle a").toggle();
    });

    // shows the slickbox on clicking the noted link

    jQuery('a#forgotpwd').click(function() {
        jQuery('#ctl00_ctl00_divforgotpwd').show('slow');
        jQuery('#ctl00_divforgotpwd').show('slow');
        jQuery('#userlogin').hide('slow');
        jQuery('a#forgotpwd').hide('slow');
        jQuery('#logintitle').hide('slow');
        jQuery('#ctl00_ctl00_divCaptcha').hide('slow');
        jQuery('#ctl00_divCaptcha').hide('slow');
        jQuery('#diverror').hide('slow');

        return false;
    });
    jQuery('a#cancel').click(function() {
        jQuery('#ctl00_ctl00_divforgotpwd').hide('slow');
        jQuery('#ctl00_divforgotpwd').hide('slow');
        jQuery('#userlogin').show('slow');
        jQuery('a#forgotpwd').show('slow');
        jQuery('#logintitle').show('slow');
        jQuery('#ctl00_ctl00_divCaptcha').show('slow');
        jQuery('#ctl00_divCaptcha').show('slow');
        jQuery('#diverror').hide('slow');
        return false;
    });
});

// Google Search



//<![CDATA[
function initLoader() {
    var script = document.createElement("script");
    //script.src = "http://www.google.com/jsapi?key=ABQIAAAAoaqzZrdbwIFiQIIpWxDWARSIdR4F-3-vczd9RRLo5-PFVp7ncRTC10S3Fvl5RSvJQcaMjg4h0kAT3g";
    var gaJsHostsearch = (("https:" == document.location.protocol) ? "https://" : "http://");
    script.src = gaJsHostsearch + "www.google.com/jsapi?key=ABQIAAAAoaqzZrdbwIFiQIIpWxDWARSIdR4F-3-vczd9RRLo5-PFVp7ncRTC10S3Fvl5RSvJQcaMjg4h0kAT3g";
    script.type = "text/javascript";
    document.getElementsByTagName("head")[0].appendChild(script);
}

function OnLoad() {

    // Create a search control      
    var searchControl = new google.search.SearchControl(); searchControl.setLinkTarget(searchControl.LINK_TARGET_SELF);
    var siteSearch = new GwebSearch(); siteSearch.setUserDefinedLabel("SivaBaba.org");
    siteSearch.setUserDefinedClassSuffix("siteSearch"); siteSearch.setSiteRestriction("SivaBaba.org");
    // web search, open, alternate root
    var options = new GsearcherOptions(); options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN); options.setRoot(document.getElementById("searchresult"));
    searchControl.addSearcher(siteSearch, options); searchControl.draw(document.getElementById("searchcontrol"));
    // Execute an inital search
    searchControl.execute();



}
function GoogleSearch() {
    initLoader();
    setTimeout("google.load('search', '1', { 'callback': OnLoad })", 4000)
}


