function openDiv (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "block";
	}
}
function closeDiv (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}

function validarq(e) {
	tecla = (document.all) ? e.keyCode : e.which;
	if (tecla==8) return true;
	if (tecla==241) return true;
	if (tecla==209) return true;
	patron = /\w/;
	te = String.fromCharCode(tecla);
	if (!patron.test(te)){
		patron =/[chr(255)\s]/;
		return patron.test(te); 
	}
}

function validar(e) {
	tecla = (document.all) ? e.keyCode : e.which;
	if (tecla==8) return true;
	patron = /\w/;
	te = String.fromCharCode(tecla);
	if (!patron.test(te)){
		patron =/[;:,.ņŅ chr(255)\s]/;
		return patron.test(te); 
	}
}
function validarenter(e) {
	tecla = (document.all) ? e.keyCode : e.which;
	if (tecla==13){return buscar()}
	if (tecla==8) return true;
	if (tecla==241) return true;
	if (tecla==209) return true;
	patron = /\w/;
	te = String.fromCharCode(tecla);
	if (!patron.test(te)){
		patron =/[chr(255)\s]/;
		return patron.test(te); 
	}
}

var btn
function _desp(i){  
	_plegt(btn)
	//_plegall
	var ob=document.getElementById('id_'+i)
	var obp=document.getElementById('b_'+i)
	if(ob){
		obp.style.height='33px'
		ob.style.display='block';
		obp.style.borderBottom=0
	}
	btn=i
	return false;
}
function _plegt(id){
	var ob=document.getElementById('id_'+id)
	var obp=document.getElementById('b_'+id)
	if(ob){
		ob.style.display='none';
		obp.style.height='28px'
		obp.style.borderBottom='1px'
		obp.style.borderBottomColor='#778A98'
		obp.style.borderBottomStyle='solid'
		}
	return false;
}
function _plegall(){
	for(i=1;i<=9;++i){
	var ob=document.getElementById('id_'+i)
	var obp=document.getElementById('b_'+i)
	if(ob){
		ob.style.display='none';
		obp.style.height='28px'
		obp.style.borderBottom=5
		obp.style.borderBottomColor='#778A98'
		obp.style.borderBottomStyle='solid'
		}
	}
	return false;
}
/**********************script del buscador principal************************/
var opc=1
var arr_op= new Array()
arr_op[0]= new Array("Web","checked='checked' value='http://www.hi5musica.com/buscaweb/buscador.php?q='>Google","value='http://es.search.yahoo.com/search?fr=fp-tab-web-t-1&ei=ISO-8859-1&meta=vl%3D&p='>Yahoo!","value='http://search.msn.com/results.aspx?FORM=QBHP&q='>MSN","value='http://a9.com/'>A9","value='http://es.ask.com/web?qsrc=0&o=0&dm=lang&q='>ASK","value='http://www.altavista.com/web/results?itag=ody&kgs=1&kls=0&q='>Altavista ")
arr_op[1]= new Array("Videos","value='http://www.videosflow.com/?cmd=Yt&q=' checked='checked'>Videos Flow","value='http://www.hi5musica.com/videos/buscar.php?q='>Hi5musica","value='http://www.youtube.com/results?search_query='>YouTube!","value='http://video.google.com/videosearch?btnG=Search+Video&q='>Google","value='http://es.search.yahoo.com/search/video?fr=FP-tab-vid-t&ei=ISO-8859-1&p='>Yahoo!","value='http://www.altavista.com/video/results?mvf=mpeg&mvf=avi&mvf=qt&mvf=msmedia&mvf=realmedia&mvf=other&mvd=all&q='>Altavista")
arr_op[2]= new Array("Musica","value='http://www.videosflow.com/?cmd=Es&q='checked='checked'>Videos Flow","value='http://www.radioblogclub.com/search/0/'>Radio Blog","value='http://audio.search.yahoo.com/search/audio?sm=Yahoo%21+Search&fr=FP-tab-aud-t&toggle=1&cop=&ei=UTF-8&p='>Yahoo!","value='http://www.altavista.com/audio/results?maf=mp3&maf=wav&maf=msmedia&maf=realmedia&maf=aiff&maf=other&mad=all&q='>Altavista","value='http://music.aol.com/search/artistresults.adp?query='>AOL","value='http://www.mp3.com/search.php?action=Search&stype=artist&x=0&y=0&query='>MP3.com")
arr_op[3]= new Array("Imagen","value='http://images.google.com.pe/images?hl=es&btnG=B%C3%BAsqueda+de+im%C3%A1genes&q=' checked='checked'>Google","value='http://es.search.yahoo.com/search/images?fr=FP-tab-img-t&ei=ISO-8859-1&p='>Yahoo!","value='http://search.msn.com/images/results.aspx?FORM=QBIR&q='>MSN","value='http://a9.com/'>A9","value='http://es.ask.com/pictures?qsrc=&o=0&q='>ASK","value='http://www.altavista.com/image/results?mik=photo&mik=graphic&mip=all&mis=all&miwxh=all&q='>Altavista")
arr_op[4]= new Array("Tareas","value='http://es.wikipedia.org/wiki/' checked='checked'>Wikipedia","value='http://monografias.com/cgi-bin/search.cgi?substring=0&bool=and&query='>Monografias","value='http://buscador.rincondelvago.com/'>El Rincon del vago","value='http://www.ilustrados.com/buscar.php?search='>Ilustrados","value='http://buscador.icarito.cl/icarito/index.jsp?palabrasABuscar='>Icarito")
arr_op[5]= new Array("Diccionario","value='http://buscon.rae.es/draeI/SrvltConsulta?TIPO_BUS=3&LEMA=' checked='checked'>Diccionario","value='http://www.sinonimos.org/buscar.php?termino='>Sinonimos","value='http://www.antonimos.net/?termino='>Antonimos","value='http://www.wordreference.com/es/en/translation.asp?spen='>Espaņol/Ingles","value='http://www.wordreference.com/es/translation.asp?tranword'>Ingles/Espaņol")
arr_op[6]= new Array("Noticias","value='http://news.google.com.pe/news?hl=es&ned=es&btnG=Buscar+en+Noticias&q=' checked='checked'>Google","value='http://es.search.yahoo.com/search/news?fr=FP-tab-news-t&ei=ISO-8859-1&p='>Yahoo!","value='http://search.msn.com/news/results.aspx?FORM=QBNH&srch_type=1&lang=es-US&q='>MSN","value='http://buscador.lycos.es/cgi-bin/pursuit?SITE=es&x=26&y=14&cat=news&family=off&pic_adv=1&pic_family_link=off&query='>ASK","value='http://www.excite.es/search/news/results?offset=0&q='>Lycos","value='http://noticias.vocento.com/search.php?o=0&qsrc=1&q='>Excite","value='http://newssearch.bbc.co.uk/cgi-bin/search/results.pl?tab=spanish&scope=spanish&order=sortboth&threshold=50&q='>BBC","value='http://abc.mynewsonline.com/?method=buscar&precision=1&int_olddays=31&query='>ABC")
arr_op[7]= new Array("Software","value='http://www.portaldedescargas.com/buscar.php?buscartitulo=' checked='checked'>PortaldeDescargas","value='http://www.softonic.com/index.phtml?id_section=2&search='>Softonic","value='http://www.download.com/3120-20_4-0.html?tag=srch&tg=dl-20&search.x=0&search.y=0&search=+Go%21&qt='>Download","value='http://www.todoprogramas.com/buscar.asp?buscar='>TodoProgramas")
arr_op[8]= new Array("Compras","value='http://search.ebay.com/search/search.dll?cgiurl=http%3A%2F%2Fcgi.ebay.com%2Fws%2F&fkr=1&from=R8&category0=&satitle=' checked='checked'>Ebay.com","value='http://search.ebay.es/'>Ebay.es","value='http://listado.deremate.com.pe/'>Per&uacute;","value='http://listado.deremate.com.mx/'>M&eacute;xico","value='http://www.deremate.cl/accdb/search1.asp?Type=1&VentasPorPagina=30&TipoRemates=0&TipoRemates1=0&TipoRemates2=0&txtregion1=0&TipoOrden=0&searchmyshop=0&sIDU=0&IDCamino=0&IDC=0&txtSearch='>Chile","value='http://www.deremate.com.ar/accdb/search1.asp?TipoRemates=0&txtsearch='>Argentina")
function _actopbp(op){
	_desopbp(opc)
	_opbusq(op)
	var ob=document.getElementById('opb'+op)	
	var obi=document.getElementById('b');
	if(obi)obi.focus()
	if(op==arr_op.length){ob.className="opbfh"}
	else{ob.className="opbh"}		
	opc=op
return false;
}
function _desopbp(op){
	var ob=document.getElementById('opb'+op);	
	if(op==arr_op.length){if(ob)ob.className="opbf"}
	else{if(ob)ob.className="opb"}		
	
}
function _op(){
var s = new Array();
var ob=document.getElementById('copb')
var i		
	for(i=1;i<=arr_op.length;i++){	
		
		if(i!=arr_op.length){s[s.length]="<div id='opb"+ i +"' class='opb'><a href='@' onClick='return _actopbp("+i+")'>"+ arr_op[i-1][0] +"</a></div>"}		
		else{ s[s.length]="<div id='opb"+ i +"' class='opbf'><a href='@' onClick='return _actopbp("+i+")'>"+ arr_op[i-1][0] +"</a></div>"}				
	}
	if(ob)ob.innerHTML = s.join("");
}
function _opbusq(op){
	var i
	var txt=""	
	var oblb=document.getElementById('clblb')
	var obbtnb=document.getElementById('btnb')
	if(arr_op[op-1][0]=='Im&aacute;genes'){
		if(obbtnb)obbtnb.value='Buscar Imagenes'
	}else{
		if(obbtnb)obbtnb.value='Buscar '+arr_op[op-1][0]
	}
	
	if(arr_op[op-1][0]=='Web'){
	oblb.innerHTML="<img  src='http://www.google.com/logos/Logo_40wht.gif' border=0>"		
	oblb.style.height='60px'
	oblb.style.paddingTop='0px'
	}
	else{
	oblb.innerHTML="Busca :" //arr_op[op-1][0] +":"	
	oblb.style.height='40px'
	oblb.style.paddingTop='20px'
	}
	
	var ob=document.getElementById('coob')	
	for(i=1;i<=arr_op[op-1].length-1;i++){									
			
			if(arr_op[op-1][i]=='[M&aacute;s]'){
			txt+="<a href='http://www.hi5musica.com' target='_blank'>"+arr_op[op-1][i]+"<a>"
			}else{
			txt+="<input type='radio' name='sitesearch' "+arr_op[op-1][i]}
			
			
	}
	ob.innerHTML=txt
}
function _init(){
	_op()
	_actopbp(opc)
	var obi=document.getElementById('b');
	if(obi)obi.focus()
}
function buscar(){
		var x = document.busqued.b.value;
		var y = getRadio(document.busqued.sitesearch);
		var url = y + x; 		
		if(y=='http://www.hi5musica.com/buscaweb/buscador.php?q='){
		var obfr=document.getElementById('frmBusqueda123')
		obfr.q.value=x
		obfr.submit()
		}else{
		window.open(url,'_blank')		
		}
		
		
		return false
}
function buscar2(){
		for(i=0;i<document.busqued.sitesearch.length;i++)
		{
			var x = document.busqued.b.value;
			var y = document.busqued.sitesearch[i].value;
			var url = y + x;
			window.open(url,'_blank');
		}
	}
function getRadio(ctrl)	{
	for(i=0;i<ctrl.length;i++)
        if(ctrl[i].checked) return ctrl[i].value;
}
function fomhora(Segundos){
		var Hora 
		var Minuto 
		var Segundo
        var Tiempo 
        var r
        Tiempo = Segundos
        Hora = parseInt(Tiempo / 3600)
        Minuto = parseInt((Tiempo - Hora * 3600) / 60)
        Segundo = Tiempo - Hora * 3600 - Minuto * 60
        if(Minuto<10)Minuto="0"+Minuto
        if(Segundo<10)Segundo="0"+Segundo
        r = Minuto + ":" + Segundo
        return r
}



