// JavaScript Document

<!-- SCROLL
couleurbase = "#000000";
couleurover = "#696869";
function flecha(color01)
{
with(document.body.style)
	{
	scrollbarArrowColor=color01;
	}
}

function scrollBar(face)
	{
	with(document.body.style)
		{
		scrollbarDarkShadowColor=face;
//		scrollbar3dLightColor=couleurligne;
//		scrollbarArrowColor="#FFFFFF";
		scrollbarBaseColor=face;
//		scrollbarFaceColor=face;
		scrollbarHighlightColor=face;
		scrollbarShadowColor=face;
// 		scrollbarTrackColor="#5e7d96";
		}
	}
function colorBar(){
		var w = document.body.clientWidth;
		var h = document.body.clientHeight;
		var x = event.clientX;
		var y = event.clientY;
		if(x>w) scrollBar(couleurover), flecha("white");
		else scrollBar(couleurbase), flecha("#C4C4C4");
		}
		if (document.all){
		scrollBar(couleurbase);
		document.onmousemove=colorBar;
}
// SCROLL -->




// CAMBIAR COLOR AL BOTON - Inicio de Codigo
function estado(activo,borColor,borArriba,borAbajo,borDerecha,borIzquierda,txFamily,txTam,txColor,imagen){
if (event.srcElement.tagName=="INPUT")
event.srcElement.style.backgroundColor= activo;
event.srcElement.style.borderColor= borColor;
event.srcElement.style.borderTopColor= borArriba;
event.srcElement.style.borderBottomColor= borAbajo;
event.srcElement.style.borderLeftColor= borIzquierda;
event.srcElement.style.borderRightColor= borDerecha;
event.srcElement.style.fontFamily= txFamily;
event.srcElement.style.fontSize= txTam;
event.srcElement.style.color= txColor;
event.srcElement.style.backgroundImage="url"+"('"+imagen+"')"
}

//-------------------
<!-- VALIDAR FORMULARIO
// campo para ingresar solo numeros
var nav4 = window.Event ? true : false;
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}
<!-- Auto Tabulación
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
//  End -->
// VALIDAR FORMULARIO -->
<!-- POP UP 
function popUp(URL,ancho,alto,arriba,izquierda,expandible,menu_bar,herramientas_bar,direccion,desplazamiento,sb,estado) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'width='+ ancho +',height='+ alto +',top='+ arriba +',left='+ izquierda +',resizable='+ expandible +',menubar='+ menu_bar +',toolbar='+ herramientas_bar +',location=no,scrollbars='+ desplazamiento +',statusbar='+ sb +',status='+ estado +'');");
}
// POP UP -->

<!-- CENTRAR VENTANA POP UP
function centrar(ANCHO, ALTO){
	x = (screen.width - ANCHO) / 2;
	y = (screen.height - ALTO) / 2;
	moveTo(x, y);
}
// CENTRAR VENTANA POP UP -->

<!-- Calendario Dias faltantes
var before="días)"
var current="- (Hoy)"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function cuenta_regresiva(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
var diferencia=(Math.round((Date.parse(todaystring)-Date.parse(futurestring))/(24*60*60*1000))*1)

if (difference==0)
document.write(current)
else if (difference>0)
document.write("- (Faltan "+difference+" "+before)
else
document.write("- (Han pasado "+diferencia+" "+before)
}          
//-->


<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



<!-- TD COLOR
 function mOvr(src,clrOver) { if (!src.contains(event.fromElement)) { src.style.cursor = 'hand'; src.bgColor = clrOver; } }
function mOut(src,clrIn) { if (!src.contains(event.toElement)) { src.style.cursor = 'default'; src.bgColor = clrIn; } }
// TD COLOR -->




<!-- AYUDA
var zindex=50
var nChunk = 0;
var nSteps = 10;
var nDelay = 15;

window.themenu = null;
function dropit2(whichone,top,left){ // I.E.
if (window.themenu&&themenu.id!=whichone.id){
 themenu.style.visibility="hidden";
}

if(window.themenu == whichone) return;
event.cancelBubble = true;
themenu=whichone;
if (document.all){

	event.cancelBubble=true;
	themenu.style.left= document.body.scrollLeft + event.clientX+left
	themenu.style.top=  document.body.scrollTop + event.clientY+top

	if (themenu.style.visibility=="hidden"){
		themenu.style.clip = "rect(0,0,0,0)";
		themenu.style.visibility="visible"
		nChunk = nSteps;
		verMenu();
		themenu.style.zIndex=zindex++
	}
}
}


function ocultarmenu(whichone){
if (window.themenu)
themenu.style.visibility="hidden";
window.clearTimeout(paintmenu);
themenu = null;
}

var paintmenu = null;
function verMenu() {
  if(themenu != null) {
   themenu.style.clip = "rect(0 100 % " + nChunk + "% 0)";
   nChunk += nSteps;
   nChunk <=100 ? paintmenu = window.setTimeout("verMenu()",nDelay) : themenu.style.clip = "rect(0,100%,100%,0)";
  }

}
 // N.S.
function dropit(e,whichone){
if (window.themenu&&themenu.id!=eval(whichone).id) themenu.visibility="hide";
if(themenu == eval(whichone)) return false;
themenu=eval(whichone);
if (themenu.visibility=="hide") {
themenu.left=e.pageX -10 
themenu.top=e.pageY -10   
themenu.zIndex++
right = themenu.clip.right; 
bottom = themenu.clip.bottom; 
nChunk = nSteps;
nRight = nBottom = 0;
showMenu2(right,bottom);
}

return false
}

var nRight;
var nBottom;

function showMenu2(right,bottom) { 
  if(themenu != null) {
   themenu.visibility = "show";
   nBSteps = bottom / (100/nChunk);
   nRSteps = right / (100 / nChunk) ;
   nRight += nRSteps;
   nBottom += nBSteps;
   themenu.clip.right = nRight ;
   themenu.clip.bottom = nBottom ;
   nRight <= right ? paintmenu = window.setTimeout("showMenu2(right,bottom)",nDelay) : themenu.clip.right = right; themenu.clip.bottom = bottom;
  }

}

function hidemenu2(){
if(window.themenu&&themenu != null) {
themenu.visibility="hide"
}

themenu = null;
}

if (document.all){
document.onmouseover = ocultarmenu;
} 
            
// AYUDA -->


function mOvr(src,clrOver) { if (!src.contains(event.fromElement)) { src.style.cursor = 'default'; src.bgColor = clrOver; } }
function mOut(src,clrIn) { if (!src.contains(event.toElement)) { src.style.cursor = 'default'; src.bgColor = clrIn; } }


<!-- CURSOR
function changecur(what){
if (document.all&&document.body.getAttributeNode)
document.body.style.cursor="url(../recursos/cursor"+what+".cur)"
}
// CURSOR -->
<!-- Sonido
function Reproducir(sonido){
document.all.sound.src = sonido;}

function Parar(){
document.all.sound.src = ""}
// sonido-->


<!-- COPIAR
// Copiado con mouse
function copiar() {
//		if (window.themenu)
//		{
//		themenu.style.visibility="hidden";
//		window.clearTimeout(paintmenu);
//		themenu = null;
//		}
		
		//var permitir="0"
		//	if (permitir=="1")
		//		{
		var copyright="\n © Red Cristiana 2009 - http://www.redcristiana.com.mx"
		a=document.selection.createRange();
		campo_copiar.value=a.text+copyright;
		texto=campo_copiar;
		texto.select();
		informacion=texto.createTextRange()
		informacion.execCommand("Copy");
		window.status="El contenido a sido COPIADO al portapapeles."
		setTimeout("window.status=''",5800)
		//		}
		//	else
		//		{
		//		alert("No esta permitido copiar\n en esta sección.");
		//		}
}

	
	
// Copiando manualmente
function Tecla(permiso)
{
    var tecla=window.event.keyCode; 
    var ctrl=window.event.ctrlKey;

    if (ctrl && tecla==67)
	{
	event.keyCode=0;
	event.returnValue=false;
	TeclaCopiar(permiso);
	}
} 
function TeclaCopiar(cifrado) {
	var valor=cifrado;
	var copyright="\n © Red Cristiana 2009 - http://www.redcristiana.com.mx";
	
	if (valor=="1")
		{
		elegido=document.selection.createRange();
		campo_copiar.value=elegido.text+copyright;
		texto=campo_copiar;
		texto.select();
		informacion=texto.createTextRange();
		informacion.execCommand("Copy");
		}
	else {
		alert("No esta permitido copiar\n en esta sección.");
		}
}

// COPIAR -->
<!-- IMPRIMIR
function imprimir() {
if (window.themenu)
themenu.style.visibility="hidden";
window.clearTimeout(paintmenu);
themenu = null;//	b= createRange();

if (window.print)
window.print()
else
alert("Disculpe, su navegador no soporta esta opción.");
}
// IMPRIMIR -->
<!-- AGREGAR A FAVORITOS - Inicio de Codigo
function agregar(){
if (window.themenu)
themenu.style.visibility="hidden";
window.clearTimeout(paintmenu);
themenu = null;


if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
var url="http://www.redcristiana.com.mx";
var titulo="RedCristiana.com.mx";
window.external.AddFavorite(url,titulo);
}
else {
if(navigator.appName == "Netscape") 
alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks");
}
}
// AGREGAR A FAVORITOS -->




function irA(url){
window.location=url
}



		var highlightcolor='#FFFFFF'
		
		var ns6=document.getElementById&&!document.all
		var previous=''
		var eventobj
		
		//Regular expression to highlight only form elements
		var intended=/INPUT|TEXTAREA|SELECT|OPTION/
		
		//Function to check whether element clicked is form element
		function checkel(which){
		if (which.style&&intended.test(which.tagName)){
		if (ns6&&eventobj.nodeType==3)
		eventobj=eventobj.parentNode.parentNode
		return true
		}
		else
		return false
		}
		
		//Function to highlight form element
		function highlight(CampColor){
		eventobj=ns6? e.target : event.srcElement
		if (previous!=''){
		if (checkel(previous))
		previous.style.backgroundColor=''
		previous=eventobj
		if (checkel(eventobj))
		eventobj.style.backgroundColor=CampColor
		}
		else{
		if (checkel(eventobj))
		eventobj.style.backgroundColor=CampColor
		previous=eventobj
		}
		}
