// JavaScript By Jorge Condomi


var DIR = "http://www.raven.com.ar";


// DIR = "http://localhost/blog";


function mostrar(url, wh, hh){


	return window.open(url, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+wh+',height='+hh+',top=10,left=10');


}


function Ajax() {


  var xmlhttp;


  /*@cc_on


  @if (@_jscript_version >= 5)


    try {


      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");


    } catch (e) {


      try {


        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");


      } catch (E) {


        xmlhttp = false;


      }


    }


  @else


  xmlhttp = false;


  @end @*/


  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {


    try {


      xmlhttp = new XMLHttpRequest();


    } catch (e) {


      xmlhttp = false;


    }


  }


  return xmlhttp;


}


var show = false;


var ajax = Ajax();





function get(){


	var reloj = document.getElementById("clock");


	


	reloj.style.display = "inline";


	var contenedor = document.getElementById("resultado");


	var f = document.getElementById("campo");


	f.setAttribute("autocomplete","off");


	var param = f.value;


	if(param == null || param == ""){


		borrarTodo();


		clear_field();


	}else{


	


	


	ajax.open("GET", DIR+"/search.php?par="+param,true);


		ajax.onreadystatechange=function() {


			


			if (ajax.readyState==4) {


				reloj = document.getElementById("clock");


	reloj.style.display = "none";


				if (!show){


				


				contenedor.style.display = "block";


				show = true;


				}


				contenedor.innerHTML = ajax.responseText;	


				


			}





		}


		ajax.send(null);


	}


		


}


function borrarTodo(){


	var v = document.getElementById("campo");


	v.value = "Buscar";


	var contenedor2 = document.getElementById("resultado");


	contenedor2.style.display = "none";


	show = false;


	var reloj = document.getElementById("clock");


	reloj.style.display = "none";


}





function mensaje_temporal(){


	var v = document.getElementById("campo");


	v.value = "Solo escribe aqui";


		setTimeout("clear_field()",500);





}


function restaurar(){


	setTimeout("borrarTodo()",500);


}





function clear_field(){


	var v = document.getElementById("campo");


		v.value = '';	


}


function ocultar(id){


	if(document.getElementById){


		var objeto = document.getElementById(id);


		if(objeto.style.display == "none"){


		objeto.style.display = "block";


		}else{


		objeto.style.display = "none";


		}


	}


}


////////////////////////////////////////////





if (window.addEventListener) {


window.addEventListener("load", borrarTodo, false);


} else if (document.getElementById) {


window.attachEvent("onload", borrarTodo)


} else if (window.attachEvent) {


window.onload = borrarTodo;


}






