// JavaScript Document
var debug = true; 
function noway(go){ 
	if(document.all){if(event.button == 2){ alert(popup); return false; }}
	if (document.layers){ if (go.which == 3){ alert(popup); return false; }}
}
function right(e){
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; 
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert('Â© 2009 INTELIGO BANK. Todos los derechos reservados.'); return false; } 
return true; 
}
if (document.layers){ document.captureEvents(Event.MOUSEDOWN);}
if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right;
document.onmousedown=noway;
document.onmousedown=right; 

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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//Browser Validation
var isIE = (window.navigator.userAgent.indexOf("MSIE")> 0);  
if (! isIE){   
  HTMLElement.prototype.__defineGetter__("innerText",function () { return(this.textContent); });   
  HTMLElement.prototype.__defineSetter__("innerText",function (txt) { this.textContent = txt; });
}


function PopUpVideo(pID){
	MM_openBrWindow("../content/video.php?pID="+pID,"popup","width=450, height=350")
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

function checkEmail(inputvalue){	
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	return pattern.test(inputvalue);
}

function ampliarCh(){
	document.getElementById("divPrincipal").style.fontSize= '11px';
}

function ampliarMed(){
	document.getElementById("divPrincipal").style.fontSize= '12px';
}

function ampliarGr(){
	document.getElementById("divPrincipal").style.fontSize= '13px';
}
/*
function alternar(divRegistro){
    if (document.getElementById("divRegistro").style.display=="none"){document.getElementById("divRegistro").style.display=""}
   else{document.getElementById("divRegistro").style.display="none"} 
}*/



// definiciones basicas
OCULTO="none";
VISIBLE="block";
function mostrar(blo) {
	document.getElementById(blo).style.display=VISIBLE;
	document.getElementById('divRegistro').style.display=VISIBLE;
	document.getElementById('ver_on').style.display=OCULTO;
}
function ocultar(blo) {
	document.getElementById(blo).style.display=OCULTO;
	document.getElementById('divRegistro').style.display=OCULTO;
	document.getElementById('ver_on').style.display=VISIBLE;
}

function recomendar(){
	document.getElementById('divEnviar').style.display="block";
}
function cerrarlayer(){
	document.getElementById("divRecomienda").style.visibility='hidden';
	document.getElementById("divRecomienda").style.display="none";
}


/********* FUNCION FORMULARIOS *************/
function checkStringNumerico()
{
    var checkStr="0123456789";
	var xkey;
	if (document.all)
	{
		xkey=window.event.keyCode;
		if(xkey=="13")
			event.returnValue = true;
		else
	        if (!(checkStr.indexOf(String.fromCharCode(xkey)) >= 0))
	            return false;
			else
				return true;
	}
}

function checkStringAlfabetico()
{
    var checkStr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZñÑáéíóúÁÉÍÓÚ ";
	var xkey;
	if (document.all)
	{
		xkey=window.event.keyCode;
		if(xkey=="13")
			event.returnValue = true;
		else
	        if (!(checkStr.indexOf(String.fromCharCode(xkey)) >= 0))
	            return false;
			else
				return true;
	}
}

function checkStringAlfaNumerico(value)
{
    var checkStr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZñÑáéíóúÁÉÍÓÚ0123456789 ";
	var xkey;
	if (document.all)
	{
		xkey=window.event.keyCode;
		if(xkey=="13")
			event.returnValue = true;
		else
	        if (!(checkStr.indexOf(String.fromCharCode(xkey)) >= 0))
	            return false;
			else
				return true;
	}
}

function esFecha(dia,mes,ano){
	var num_dias;
	if(parseInt(mes)>=1 && parseInt(mes)<=12){
		switch(parseInt(mes)){
			case 1 : num_dias=31; break;
			case 2 : num_dias=((ano % 4)==0) ? 29 : 28; break;
			case 3 : num_dias=31; break;
			case 4 : num_dias=30; break;
			case 5 : num_dias=31; break;
			case 6 : num_dias=30; break;
			case 7 : num_dias=31; break;
			case 8 : num_dias=31; break;
			case 9 : num_dias=30; break;
			case 10 : num_dias=31; break; 
			case 11 : num_dias=30; break;
			case 12 : num_dias=31; break;
			default : num_dias=31; 
		}
		if(parseInt(dia)<=num_dias){
			return true;
		}
		else{
			return false;
		}
	}
	else{
		return false;
	}
}
/********* FIN FORMULARIOS *************/