// JavaScript Document

function Verificar_Search(){

    if (params.getValue('res') != '')
    {
	   document.searchform.searchwords.value = params.getValue('res');
	   doSearch();
    }

	params.getValue('keywords') != "" ? document.searchform.searchwords.value = params.getValue('keywords') : "Buscar..."	

	if (params.getValue('keywords') != ''){
		document.getElementById('celda1').style.display = 'none';
		document.getElementById('celda2').style.display = 'block';
		var ele = document.getElementById('resultadoBody');
	
		while (ele.firstChild) {
  		ele.removeChild(ele.firstChild);
		}

		searchwords=params.getValue('keywords');
		searchAll(searchwords);
	}
}

function doSearch(){
	searchwords=document.searchform.searchwords.value;
	if (searchwords != 'Buscar...'){
		document.getElementById('celda1').style.display = 'none';
		document.getElementById('celda2').style.display = 'block';
		var ele = document.getElementById('resultadoBody');
		
		while (ele.firstChild) {
		ele.removeChild(ele.firstChild);
		}

		document.searchform.accion.value = "doSearch";
		searchAll(searchwords);
	}
}

function abrir_sugerencias(){
	popup = window.open("instrucciones_uso.html","otra_ventana","width=600,height=300,resizable=no,scrollbars=no,toolbar=no,status=no");
	var aw = screen.availWidth;
	var ah = screen.availHeight;
	popup.moveTo(aw/2-340, ah/2-215);

}

function buscar(){
    searchwords=document.searchform.searchwords.value;
    if ((searchwords != '') && (searchwords != 'Buscar...'))
    {
		doSearch();
    }
	else
    {
       alert('Por favor escriba la palabra que desea buscar ...');
       document.searchform.searchwords.value = '';
	   document.searchform.searchwords.focus();
	}
}

