$(document).ready(function() {
	$("#dsp").click(function () {
		$("p").slideToggle("slow");
	});
});

$(document).ready(function() {
	$("#dsp3").click(function () {
		$("#m_m").fadeOut("fast");
		$("#gsearch").fadeOut("fast", function() {
				$("#multimedia").fadeIn("slow");
				$("#www").fadeIn("slow");
				document.forms[1].search.focus();
				document.forms[1].search.value = document.forms[0].q.value;
		});
	});
});

$(document).ready(function() {
	$("#dsp2").click(function() {
		$("#www").fadeOut("fast")
		$("#multimedia").fadeOut("fast", function() {
				$("#gsearch").fadeIn("slow");
				$("#m_m").fadeIn("slow");
				document.forms[0].q.focus();
				document.forms[0].q.value = document.forms[1].search.value;
		});
	});
});

function precarga() {
  var d=document;
  if(d.images){
	  if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=precarga.arguments;
	for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){
		d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
		}
	}
document.forms[0].q.focus();
}

function addEngine(localiza) {
 if (window.external && ("AddSearchProvider" in window.external)) {
   // Firefox 2 y IE 7, OpenSearch
   window.external.AddSearchProvider("http://adonay.name/"+localiza);
 } else if (window.sidebar && ("addSearchEngine" in window.sidebar)) {
   // Firefox <= 1.5, Sherlock
   window.sidebar.addSearchEngine("http://adonay.name/Sherlock/es.src",
                                  "http://adonay.name/imgs/search-icon.png",
                                  "Adonay Search", "");
 } else {
   // Sin soporte para motores de busqueda (IE 6, Opera, etc).
   alert("Sin soporte para proveedor de busquedas en el navegador.");
 }
}

google.load('search', '1');

// the se class encapsulates a left and right search control
// both controls are driven by a shared search form
function se() {
var sFormDiv = document.getElementById("searchForm");
var leftScDiv = document.getElementById("leftSearchControl");
var rightScDiv = document.getElementById("rightSearchControl");

// create a left, right search control
// create a custom search form
this.leftControl = new google.search.SearchControl();
this.rightControl = new google.search.SearchControl();
this.searchForm = new google.search.SearchForm(true, sFormDiv);

// bind clear and submit functions
this.searchForm.setOnSubmitCallback(this, se.prototype.onSubmit);
this.searchForm.setOnClearCallback(this, se.prototype.onClear);

// set up for large result sets
this.leftControl.setResultSetSize(GSearch.LARGE_RESULTSET);
this.rightControl.setResultSetSize(GSearch.LARGE_RESULTSET);

var searcher;
var options;

// configure left control
// vertical layout, image and blog
this.leftControl.addSearcher(new google.search.VideoSearch());
this.leftControl.addSearcher(new google.search.BookSearch());

// configure right control
// tabbed layout image, web, news, video
this.rightControl.addSearcher(new google.search.ImageSearch());
this.rightControl.addSearcher(new google.search.NewsSearch());
this.rightControl.addSearcher(new google.search.BlogSearch());

var drawOptions = new google.search.DrawOptions();
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_LINEAR);

this.rightControl.setNoResultsString(GSearchControl.NO_RESULTS_DEFAULT_STRING);
this.leftControl.setNoResultsString(GSearchControl.NO_RESULTS_DEFAULT_STRING);
this.leftControl.draw(leftScDiv);
this.rightControl.draw(rightScDiv, drawOptions);

}

// when the form fires a submit, grab its
// value and call the left and right control
se.prototype.onSubmit = function(form) {
var q = form.input.value;
if (q && q!= "") {
this.leftControl.execute(q);
this.rightControl.execute(q);
}
return false;
}

// when the form fires a clear, call the left and right control
se.prototype.onClear = function(form) {
this.leftControl.clearAllResults();
this.rightControl.clearAllResults();
form.input.value = "";
return false;
}

function OnLoad() {
new se();
}
google.setOnLoadCallback(OnLoad, true);
