function thickBoxPopup(){
window.open("popUp.php?height=120&width=400 class=thickbox title=Información");
}
var peticion = false; 
var cargador = false; 
if (window.XMLHttpRequest) {
      peticion = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
            peticion = new ActiveXObject("Microsoft.XMLHTTP");
}

function Cargo(){
	$("a").click(function(){
		if(this.rel != "no-ajax"){
			UpdateDiv(this.href, this.rel);
			return false;
		}else{
			return true;
		}
	});
}
function ObtenerDatos(datos,divID) { 

String.prototype.tratarResponseText=function(){
    var pat=/<script[^>]*>([\S\s]*?)<\/script[^>]*>/ig;
    var pat2=/\bsrc=[^>\s]+\b/g;
    var elementos = this.match(pat) || [];
    for(i=0;i<elementos.length;i++) {
        var nuevoScript = document.createElement('script');
        nuevoScript.type = 'text/javascript';
        var tienesrc=elementos[i].match(pat2) || [];
        if(tienesrc.length){
            nuevoScript.src=tienesrc[0].split("'").join('').split('"').join('').split('src=').join('').split(' ').join('');
        }else{
            var elemento = elementos[i].replace(pat,'$1','');
            nuevoScript.text = elemento;
        }
        document.getElementsByTagName('body')[0].appendChild(nuevoScript);
    }
    return this.replace(pat,'');
}
if(peticion) {
     var obj = document.getElementById(divID); 
     peticion.open("GET", datos); 
	 peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1'); 
     peticion.onloadstart = function(){
      document.getElementById(divID).innerHTML = "<center style='margin-top: 30px;'><br /><img src=\"images/8-0.gif\" /></center>";
 }
     peticion.onreadystatechange = function()  { 
          if (peticion.readyState == 4) { 
               obj.innerHTML = peticion.responseText.tratarResponseText();  
          } 
     } 
peticion.send(null); 
}
}

function Busqueda(){
	var texto = $('#Texto').val();
	if(($.trim(texto) !="")){
	document.getElementById('Cuerpo').className='CuerpoB';
	ObtenerDatos('buscar.php?que='+texto,'Resultados');
		}else{
		alert("Pon algo o qué.");
	}
}
function GetBusca(e) {

  tecla = (document.all) ? e.keyCode : e.which;
  if (tecla==13) {
		Busqueda();
        return 0;
  }   
}
function fecha(){
	fecha = new Date()
	mes = fecha.getMonth()
	diaMes = fecha.getDate()
	diaSemana = fecha.getDay()
	anio = fecha.getFullYear()
	dias = new Array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado')
	meses = new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre')
	document.write('<span id="#fecha">')
	document.write (dias[diaSemana] + ", " + diaMes + " de " + meses[mes] + " de " + anio)
	document.write ('</span>')
}

function cuentaatras(){
<!--
var date = new Date("July 23, 2013");
var description = " JMJ R&iacute;o de Janeiro 2011";
var now = new Date();
var diff = date.getTime() - now.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));

if (days > 1) {
document.write(days+1 + " días para la" + description);
}
else if (days == 1) {
document.write("Solo dos días para la" + description);
}
else if (days == 0) {
document.write("Mañana empieza la" + description);
}
else {
document.write("Ya estamos en la" + description + "!");
}

// End -->
}

//Buscar en salmos
String.prototype.preg_quote=function(){
p= /([:.\+*?[^\]$(){}=!<>|:)])/g;
return this.replace(p,"\\$1");
}
function buscar(cadena){
resetear();
if(!cadena.length)return;
var info3;
cadena=cadena.preg_quote();
var patron=new RegExp(cadena+'(?!\}\})','gim');
var espacio = /^\s$/;
var el = document.getElementById('LineaSalmosGrande').getElementsByTagName('*');
for(var ii=0;ii<el.length;ii++){
if(el[ii].hasChildNodes && el[ii].nodeName.toLowerCase()!='title' && el[ii].nodeName.toLowerCase()!='script' && el[ii].nodeName.toLowerCase()!='meta' && el[ii].nodeName.toLowerCase()!='link' && el[ii].nodeName.toLowerCase()!='style'){
var tt=el[ii].childNodes;
for(var jj in tt){
if(tt[jj].nodeType==3 && !espacio.test(tt[jj].nodeValue)){
patron.lastIndex = 0;
if(info3=patron.exec(tt[jj].nodeValue)){
tt[jj].nodeValue=tt[jj].nodeValue.replace(patron,'{{'+tt[jj].nodeValue.substr(info3['index'],cadena.length)+'}}');

}
}

}
}
}
document.getElementById('LineaSalmosGrande').innerHTML=document.getElementById('LineaSalmosGrande').innerHTML.split('}}').join('</span>').split('{{').join('<span style="background-color: yellow">');

}
function resetear(){
document.getElementById('LineaSalmosGrande').innerHTML=original;
}
window.onload=function(){
original=document.getElementById('LineaSalmosGrande').innerHTML;
}
$(document).ready(function($){
$(".subir").hide(); //Esto hace que el div Inicialice Oculto
	$(function () {
		$(window).scroll(function () {
			if ($(this).scrollTop() > 100) { //Esto hace que el Div aparezca de despues de haber bajado 100px con el scroll
				$('.subir').fadeIn(); //Aparece con un efecto Fade
			} else {
				$('.subir').fadeOut(); // Desaparece con un efecto Fade
			}
		});
		$('.subir a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 700); // Todo esto hace que se la pagina se desplace hasta el tope con una lentitud de 500 milisegundos
			return false;
		});
	});

});
//Detectamos botones del teclado

function shortcut(shortcut,callback,opt) {
//Provide a set of default options
var default_options = {
'type':'keydown',
'propagate':false,
'target':document
}
if(!opt) opt = default_options;
else {
for(var dfo in default_options) {
if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
}
}
var ele = opt.target
if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
var ths = this;
//The function to be called at keypress
var func = function(e) {
e = e || window.event;
//Find Which key is pressed
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code).toLowerCase();
var keys = shortcut.toLowerCase().split("+");
//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
var kp = 0;
//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
var shift_nums = {
"`":"~",
"1":"!",
"2":"@",
"3":"#",
"4":"$",
"5":"%",
"6":"^",
"7":"&",
"8":"*",
"9":"(",
"0":")",
"-":"_",
"=":"+",
";":":",
"'":"\"",
",":"<",
".":">",
"/":"?",
"\\":"|"
}
//Special Keys - and their codes
var special_keys = {
'esc':27,
'escape':27,
'tab':9,
'space':32,
'return':13,
'enter':13,
'backspace':8,
'scrolllock':145,
'scroll_lock':145,
'scroll':145,
'capslock':20,
'caps_lock':20,
'caps':20,
'numlock':144,
'num_lock':144,
'num':144,
'pause':19,
'break':19,
'insert':45,
'home':36,
'delete':46,
'end':35,
'pageup':33,
'page_up':33,
'pu':33,
'pagedown':34,
'page_down':34,
'pd':34,
'left':37,
'up':38,
'right':39,
'down':40,
'f1':112,
'f2':113,
'f3':114,
'f4':115,
'f5':116,
'f6':117,
'f7':118,
'f8':119,
'f9':120,
'f10':121,
'f11':122,
'f12':123
}
for(var i=0; k=keys[i],i<keys.length; i++) {
//Modifiers
if(k == 'ctrl' || k == 'control') {
if(e.ctrlKey) kp++;
} else if(k == 'shift') {
if(e.shiftKey) kp++;
} else if(k == 'alt') {
if(e.altKey) kp++;
} else if(k.length > 1) { //If it is a special key
if(special_keys[k] == code) kp++;
} else { //The special keys did not match
if(character == k) kp++;
else {
if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
character = shift_nums[character];
if(character == k) kp++;
}
}
}
}
if(kp == keys.length) {
callback(e);
if(!opt['propagate']) { //Stop the event
//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = false;
//e.stopPropagation works only in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
return false;
}
}
}
//Attach the function with the event
if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
else ele['on'+opt['type']] = func;
}
