//Funciones para imagenes botones
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) { //v3.0
  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); 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];}
}
//Fin funciones imagenes para botones

function MostrarCapa(NombreCapa, cantCapas) {
	//NombreImagen es el nombre del elemento img del link que expande o contrae la capa
	//indicada en NombreCapa.	
	if(cantCapas == 2)
		var capaH = window.document.getElementById(NombreCapa+"H");
		
	var capa = window.document.getElementById(NombreCapa);
	var td = window.document.getElementById("TD" + NombreCapa);
	var tdI = window.document.getElementById("TD" + NombreCapa + "I");
	var tdD = window.document.getElementById("TD" + NombreCapa + "D");
	//var vinc = window.document.getElementById("Link" + NombreCapa);
	if (capa.style.display == "none")
	{	
		if(cantCapas == 2)
			capaH.style.display = "block";
		capa.style.display = "block";
		MM_swapImage("img" + NombreCapa,'','../Imagenes/expEncabIzq.gif',1);
		MM_swapImage("img" + NombreCapa + 'Der','','../Imagenes/expEncabDer.gif',1);
		MM_swapImage("img" + NombreCapa + 'MM','','../Imagenes/menos.gif',1);
		td.className = "expTitulo";
		tdI.className = "expTitulo";
		tdD.className = "expTitulo";
		//vinc.className = "expTituloLink";
	}else{
		if(cantCapas == 2)
			capaH.style.display = "none"
		capa.style.display = "none"
		MM_swapImage("img" + NombreCapa,'','../Imagenes/conEncabIzq.gif',1);
		MM_swapImage("img" + NombreCapa + 'Der','','../Imagenes/conEncabDer.gif',1);
		MM_swapImage("img" + NombreCapa + 'MM','','../Imagenes/mas.gif',1);
		td.className = "expTituloCon";
		tdI.className = "expTituloCon";
		tdD.className = "expTituloCon";
		//vinc.className = "conTituloLink";
	}
}


function MostrarCapaPlan(NombreCapa) {
	//NombreImagen es el nombre del elemento img del link que expande o contrae la capa
	//indicada en NombreCapa.	
		
	var capa = window.document.getElementById(NombreCapa);
	if (capa.style.display == "none")
	{	
		capa.style.display = "block";
		MM_swapImage("img" + NombreCapa,'','../Imagenes/expanded.gif',1);
	}else{
		capa.style.display = "none"
		MM_swapImage("img" + NombreCapa,'','../Imagenes/collapsed.gif',1);
	}
}

function VisualizarCapa(NombreCapa, NombreImagen, cantCapas) {
	//NombreImagen es el nombre del elemento img del link que expande o contrae la capa
	//indicada en NombreCapa.
	if(cantCapas == 2)
		var capaH = window.document.getElementById(NombreCapa+"H");
	var capa = window.document.getElementById(NombreCapa);
	if (capa.style.display == "none")
	{
		if(cantCapas == 2)
			capaH.style.display = "block";	
		capa.style.display = "block";
		MM_swapImage(NombreImagen,'','../Imagenes/expanded.gif',1);
	}else{
		if(cantCapas == 2)
			capaH.style.display = "none"	
		capa.style.display = "none"
		MM_swapImage(NombreImagen,'','../Imagenes/collapsed.gif',1);
	}
}

function MarcarTodos()
{
	var lista = window.document.getElementsByTagName("input");
	if (lista.length > 0)
	{			
		//b es una variable que se setea false dentro de la pagina
		b = !b;					
		for (i=0;i<lista.length;++i) 
		{			
			if (lista[i].type == "checkbox")		
					lista[i].checked = b;
		}
	}
}

function ValidarLargo0(source, arguments)
{
	arguments.IsValid = true;
}

function ValidarLargo50(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 50)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo100(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 100)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo150(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 150)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo200(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 200)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo250(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 250)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo255(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 255)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo300(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 300)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo350(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 350)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo400(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 400)
		arguments.IsValid = false;		
	else
		arguments.IsValid = true;
}

function ValidarLargo2000(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 2000)
		arguments.IsValid = false;
	else
		arguments.IsValid = true;
}

function ValidarLargo4000(source, arguments)
{	
	var texto = arguments.Value;
	
	if(texto.length > 4000)
		arguments.IsValid = false;
	else
		arguments.IsValid = true;
}

function trim(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}