﻿// JScript File



<script language="JavaScript" type="text/JavaScript">
<!--
<!--
window.history.forward(1);
var content=new Array()
//change the array below to the text associated with your links Expand or contract the array, depending on how many links you have
content[0]='<H4><center>Consulta y solicitud del acta de nacimiento</center></H4>'
content[1]='<H4><center>Consulta y solicitud del C.U.R.P.</center></H4>'
content[2]='<H4><center>Consulta de saldo de Tenencia</center></H4>'
content[3]='<H4><center><br></center></H4>'
content[4]='<br><big><b>Links and buttons</b></big><br>Add tooltips to your text links, rollover effects to your form buttons, keyboard features to your document, and more.'
content[5]='<br><big><b>Dynamic clocks and dates</b></big><br>Time is never static, so why should your time script be? Enter for DHTML scripts that actually understand this simple truth.'
content[6]='<br><big><b>Text animations</b></big><br>Text have been silent for too long- DHTML promises to free them, with flying text, typing text, dragable text, and more.'
content[7]='<br><big><b>Browser window</b></big><br>Click here scripts related to the browser window and frames.'
content[8]='<br><big><b>Other</b></big><br>All scripts that don\'t comfortably fit in any of the above categories go here...'

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",450)
}

function changetext(whichcontent){
if (document.all)
{
//descriptions.innerHTML="<font color=#000000 face=Verdana, Arial, Helvetica, sans-serif>"+whichcontent+"</font>"
}
else if (document.layers){
document.d1.document.d2.document.write(whichcontent)
document.d1.document.d2.document.close()
}

}

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];}
}


//-->

function CambiaMayusculas(texto)
{
	if(texto.value.length>0)
	{
		val = texto.value.toLowerCase();
		val = replace(val, 'é', 'e');
		val = replace(val, 'è', 'e');
		val = replace(val, 'ê', 'e');
		val = replace(val, 'ë', 'e');
		val = replace(val, 'à', 'a');
		val = replace(val, 'â', 'a');
		val = replace(val, 'å', 'a');
		val = replace(val, 'ä', 'a');
		val = replace(val, 'á', 'a');
		val = replace(val, 'ú', 'u');
		val = replace(val, 'ù', 'u');
		val = replace(val, 'û', 'u');
		val = replace(val, 'ó', 'o');
		val = replace(val, 'ò', 'o');
		val = replace(val, 'ö', 'o');
		val = replace(val, 'ô', 'o');
		val = replace(val, 'ç', 'c');
		val = replace(val, 'í', 'i');
		val = replace(val, 'ï', 'i');
		val = replace(val, 'ì', 'i');
		val = replace(val, 'ÿ', 'y');
		//alert(val);
		texto.value=val.toUpperCase();
		copia=texto.value;
		for(i=0;i<texto.value.length;i++)
		{
			letter=texto.value.charAt(i);
			letra=texto.value.charAt(i);
			if ((letter.charCodeAt(0)<65 || letter.charCodeAt(0)>90)&& letter!=" " && letter!="."  && letter!="Ñ" && letter!="ñ" && letter!="-")
			{	
				copia= replace(copia, letra,'');
			}
		}
		if(copia!=texto.value)
				alert("Hay caracteres no válidos.");
		copia=copia.rtrim();		
		texto.value=copia;
		
	}
	return;
}

function strltrim() 
{	return this.replace(/^\s+/,''); }

function strrtrim() 
{	return this.replace(/\s+$/,''); }

function strtrim() 
{	return this.replace(/^\s+/,'').replace(/\s+$/,''); }

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;


function replace(str, from, to) {
           var i = str.indexOf(from);
           if (!from || !str || i == -1) return str;
           var newstr = str.substring(0, i) + to;
           if (i+from.length < str.length)
           newstr += replace(str.substring(i+from.length,str.length),from,to);
           return newstr;
}



function ValidaNum(val)
{
	if(val.value!="")
	{
		if(val.value=='0')
		{
			alert('El núemero tiene  que ser mayor que cero.');
			val.focus();
			val.select();
			return false;
		}
		r=String(val.value);
		r=r.length;
		if(r>0)
		{
			var str = val.value;
			for (var i = 0; i < r; i++) 
			{
				var ch = str.substring(i, i + 1)
				if ((ch < "0" || "9" < ch))// && ch != '.') 
				{
					alert("Caracteres inválidos.")
					val.focus();
					val.select();
					return;
				}
			}
		}
		document.form1.submit();
 	}
	
 	return;
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->

	

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->

function isEmailAddress(theElement, nombre_del_elemento )
	{
		var s = theElement.value;
		var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9-_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		if (s.length == 0 ) return true;
	   if (filter.test(s))
	      return true;
		  
	   else
	     alert("Favor de capturar un correo electrónico valido.");
		theElement.focus();
		return false;
		
}
</script>

