arep = 0;
ares = 0;
function ajax(){
	var xmlhttp=false;
	try 
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch (e){
		try 
		{
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (E){
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function preview(nrep, v){ 
	if(arep != nrep){
		cerrar();		
		document.getElementById('play_' + nrep).className = 'contenedor_reproducir2';
		ver_reproductor(nrep, v);		
		arep = nrep;
	}else{		
		document.getElementById('play_' + nrep).className = 'contenedor_reproducir';
		cerrar_reproductor(nrep);
		arep = 0;
	}	
}
function cerrar(){
	if (arep != 0){
		document.getElementById('play_' + arep).className = 'contenedor_reproducir';
		cerrar_reproductor(arep);
	}
}
function download(id) {
	myRef = window.open('http://www.musicabuscador.com/down.php?id=' + id,'Descargando','left=20,top=20,width=490,height=200,toolbar=0,resizable=0,status=0');
}
function ver_reproductor(id, v){
	var reproductor;
	reproductor = document.getElementById('reproductor_' + id);
	objeto_ajax = ajax();
	objeto_ajax.open("GET", "http://www.parabuscar.net/preview.php?v=" + v, true);
	objeto_ajax.onreadystatechange=function() 
	{
		if (objeto_ajax.readyState==4) 
		{
			reproductor.innerHTML = objeto_ajax.responseText;
		}
	}
	objeto_ajax.send(null);	
}
function cerrar_reproductor(id){
	reproductor = document.getElementById('reproductor_' + id);
	reproductor.innerHTML = '';
}
function buscarmusic(){
	var busqueda = document.getElementById('buscar').value;
			busqueda = busqueda.split(" ").join("-");
			busqueda = busqueda.split("ñ").join("n");
			parent.location.href='http://www.parabuscar.net/Musica/mp3/'+busqueda+'/';

}
function buscar(){
	var busqueda = document.getElementById('buscar').value;
			busqueda = busqueda.split(" ").join("-");
			busqueda = busqueda.split("ñ").join("n");
			parent.location.href='http://www.google.com/search?hl=es&q='+busqueda+'&btnG=Buscar+con+Google';

}
function buscarvideo(){
	var busqueda = document.getElementById('buscar').value;
			busqueda = busqueda.split(" ").join("-");
			busqueda = busqueda.split("ñ").join("n");
			parent.location.href='http://www.parabuscar.net/Videos-de/'+busqueda+'/';

}
function buscarimagen(){
	var busqueda = document.getElementById('buscar').value;
			busqueda = busqueda.split(" ").join("-");
			busqueda = busqueda.split("ñ").join("n");
			parent.location.href='http://www.parabuscar.net/Imagenes-de/'+busqueda+'/';

}
function buscarwall(){
	var busqueda = document.getElementById('buscar').value;
			busqueda = busqueda.split(" ").join("-");
			busqueda = busqueda.split("ñ").join("n");
			parent.location.href='http://www.parabuscar.net/Wallpaper-de/'+busqueda+'/';

}
function cambiarestilo(id,status) {
  if (status == 1) {
    var element = document.getElementById(id); 
    element.className='cajas_over';
  } else {
  	var element = document.getElementById(id); 
  	element.className='cajas';
  }
}
function agregarweb(webs,direc){
		var web = document.getElementById('web').value;
		var tipo = webs+","+web;
		var days = 100;
		var name = "webs";
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+tipo+expires;
		if (direc=='naa'){window.location.href="http://www.parabuscar.net/";}else{window.location.href="http://www.parabuscar.net"+direc;}
}
function ocultar(){
		var fondo = document.getElementById('fondo');
		var agreweb = document.getElementById('agreweb');
		fondo.style.display="none";
		agreweb.style.display="none";
}
function mosagregarweb(){
		var fondo = document.getElementById('fondo');
		var agreweb = document.getElementById('agreweb');
		fondo.style.height=(screen.height)+"px";
		fondo.style.display="block";
		agreweb.style.left = (((screen.width)/2)-250)+"px";
		agreweb.style.display="block";
		document.getElementById('web').focus();
}
function borrar(webs,web,direc){
		webs = webs.split(","+web).join("");
		webs = webs.split(web).join("");
		var tipo = webs
		var days = 100;
		var name = "webs";
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+tipo+expires;
		if (direc=='naa'){window.location.href="http://www.parabuscar.net/";}else{window.location.href="http://www.parabuscar.net"+direc;}
}