function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

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];}
}

//Funciones incluídas en el UserControl function
//Se incluyen en este para hacer unificación y hacer referencia a uno solo.
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function mostrar(item){
var e = document.getElementById(item);
		if (e!=null)
	{
		if (e.style.display == '')
		{
			e.style.display = 'none';
		}
		else
		{
			e.style.display = '';
		}
	}
}

function expandir(item, nombreimagen,src_abierto,title_abierto,src_cerrado,title_cerrado)
{
	var d = document.getElementById(item);
	var imagen = document.getElementById(nombreimagen);
	if (d!=null)
	{
		if (d.style.display == '')
		{
			d.style.display = 'none';
			imagen.src = src_cerrado;
			imagen.title = title_abierto;
		}
		else
		{
			d.style.display = '';
			imagen.src = src_abierto;
			imagen.title = title_cerrado;
		}
	}
}
//Aqui terminan las funciones pertenecientes al UserControl Function

var Open = ""
var Closed = ""
function showhide(what,what2){
     
	if (what.style.display=='none'){
		menu1outline.style.display = 'none';
		menu1outline.scr = Closed.src;  
	
		menu2outline.style.display = 'none';
		menu2outline.scr = Closed.src; 
		
		menu3outline.style.display = 'none';
		menu3outline.scr = Closed.src; 
		 
		menu4outline.style.display = 'none';
		menu4outline.scr = Closed.src;
			
		menu5outline.style.display = 'none';
		menu5outline.scr = Closed.src;
		
		menu6outline.style.display = 'none';
		menu6outline.scr = Closed.src;
			
		menu7outline.style.display = 'none';
		menu7outline.scr = Closed.src;  
				
		menu8outline.style.display = 'none';
		menu8outline.scr = Closed.src;  
				
		menu9outline.style.display = 'none';
		menu9outline.scr = Closed.src;  
				
		menu10outline.style.display = 'none';
		menu10outline.scr = Closed.src; 
		 
		menu11outline.style.display = 'none';
		menu11outline.scr = Closed.src;
		 
		menu12outline.style.display = 'none';
		menu12outline.scr = Closed.src;
			 
		menu13outline.style.display = 'none';
		menu13outline.scr = Closed.src; 
			 
		menu14outline.style.display = 'none';
		menu14outline.scr = Closed.src; 
		
		menu15outline.style.display = 'none';
		menu15outline.scr = Closed.src;
		
		menu16outline.style.display = 'none';
		menu16outline.scr = Closed.src;
		what.style.display='';
		what2.src=Open.src
	}
	else{      
		what.style.display='none'
		what2.src=Closed.src
	}
}

function sobre(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  }
  function fuera(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  }
  function fclic(src) {
    if(event.srcElement.tagName=='TD'){
	  src.children.tags('a')[0].click();
    }
  }

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 rand_link() {
var a;
a = 1+Math.round(Math.random()*20);
return a;
}

function expandir(item, nivel)
{
	var d = document.getElementById(item);
	if (d!=null)
	{
		if (d.style.display == '')
		{
			d.style.display = 'none';
		}
		else
		{
			HideAll(nivel); 
			d.style.display = '';
		}
	}
}
function HideAll(nivel) 
{
	var targetElement;
	var aDivs = document.body.getElementsByTagName("DIV");
	
	for (var i = 0; i < aDivs.length; i++) 
	{
		targetElement = aDivs[i];
		if (targetElement.className == nivel)
			targetElement.style.display = 'none';
	}
}
function cambiarHojaEstilos (id,estilo) {
    document.all[id].className=estilo;
  }
  
 function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_showHideLayersPos() { //v6.0
var i,p,v,obj,args=MM_showHideLayersPos.arguments;
  for (i=0; i<(args.length-2); i+=3)
	if ((obj=MM_findObj(args[i]))!=null)
	{
		v=args[i+2];
		p=args[i+1];
		if (obj.style)
		{
			obj=obj.style;
			if(obj.display=='none')
			{
				v='';
				if(p=='1')
				{
					MM_swapImgRestore();
				}
			}
			else
			{
				v='none';
				if(p=='')
				{
					MM_swapImgRestore();
				}
			}
			//v=(obj.display=='none')?'':(obj.display=='')?'none':v;
			//v=(v=='show')?'':(v=='hide')?'none':v;
		}
		obj.display=v;
    }
}

/*----------------------------------------------------
Función que finaliza el evento del botón en caso 
de cancelar el borrar
----------------------------------------------------*/
function confirmar(msg, evt)
{
	if (window.confirm(msg))
	{
	}
	else
	{
		if(window.event)
			event.returnValue = false;
		else
			evt.preventDefault()	
	}
} 

//Funcion para realizar trim
function trim(cadena)
{	
	for(i=0; i<cadena.length; )
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else	
			break;
	}
	return cadena;
}

//Funcion que se ejecuta para el default de un boton
function fnTrapKD(btn, e)
{
	if( !e ) {e = window.event; } 
	var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
	if (theKey == 13)
	{
		if(window.event)
		{
			e.returnValue=false;
			e.cancel = true;
			btn.click();
		}
		else
		{
			e.preventDefault();
			eval(btn.href);
		}
		
	}
}

function validarCaracteresBuscador()
		{
		document.getElementById('buscar_txt_clave').value=(document.getElementById('buscar_txt_clave').value).replace(/[^\w\s]/,'');
		}

//Funcion que detecta si las mayusculas estan activas
function capLock(div_element, e)
{
	if( !e ) {e = window.event; } 
	var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
	var theShift = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) )
	if( ( theKey > 64 && theKey < 91 && !theShift ) || ( theKey > 96 && theKey < 123 && theShift ) ) 
		document.getElementById(div_element).style.display = '';
	else
		document.getElementById(div_element).style.display = 'none';
		
}

function AgregarFavoritos(Titulo,URL) 
{
	/* Condición para el navegador Firefox */
	//if (navigator.appName=="Netscape")
	if(navigator.appName=="Netscape")
	{
		/* Agrega la página a favoritos y asigna un título al enlace */
		window.sidebar.addPanel(Titulo,URL,""); 
	}

	/* Condición para el navegador IE */
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		/* Agrega la página a favoritos y asigna un título al enlace */
		window.external.AddFavorite(URL,Titulo);
	}
}
