var rowSelected;

//Ejecuta el link de una fila
function clickTD(src) {	
  if(src.tagName == 'TD'){
    src.children.tags('A')[0].click();
  	}
}

//Ejecuta el link de una fila
function clickToolbar(src, link) {	
  if(src.tagName == 'TD'){
//	ChangeStyle(src,'toolbar-text-clicked');
	document.location = link;
  }
}

//Ejecuta el link del boton
function clickToolbarBtn(src, link) {	
  if(src.tagName == 'TD'){
	document.location = link;
  }
}

//Funcion para cambiar el estilo
function ChangeStyle(src,clrOver) {
	if (src.className.substring(src.className.length-4,src.className.length) == "cked")
	{
		src.className = src.className;
	}
	else
	{
		if (clrOver == "")
		{	
			if (src.className.substring(src.className.length-4,src.className.length) == "over")
				src.className = src.className.substring(0,src.className.length-5);
			 else
				src.className = src.className + "-over";	
		}		
		else
		{	
				src.className = clrOver;
		}
	}	
}

//Funcion para setear el estilo de la fila del toolbar
function SetToolbarRow(id)
{
	document.getElementById(id).className = "toolbar-text-clicked";
}

//Funcion para setear el estilo de la fila del toolbar
function SetToolbarTable(id)
{
	document.getElementById(id).className = "toolbar-table-btn-clicked";
}

//Funcion para mostrar el contenido de leyes y demas
function ShowLaw(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=600,height=500,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}

//Funcion para mostrar el contenido de los pasos del Indice de Fallos
function ShowIF(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=420,height=700,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}

//Funcion para abrir ventana
function ShowWindow(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=600,height=500,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}


function ShowLawyers(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=600,height=200,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}

//Show messages
function ShowMessage(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=400,height=200,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}

//Selecciona un elemento del Combo Box
function CBSelectItem( aSelect , aValue )
{
    var ops = aSelect.options;
    for (i=0; i< ops.length; i++)
      if (ops(i).value == aValue)
          ops(i).selected = true;
}

//Funcion para cargar archivos
function LoadZipFile(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=250,height=100,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}

//Funcion para mostrar u ocultar table
function ShowHide(id) {
	aux = document.getElementById(id).style.display;
	if (aux == 'block')	{aux = 'none';}
	else{aux = 'block';	}
    document.getElementById(id).style.display = aux;
}

//Setea el valor del estilo al td pasado por parametro
function SetStyle(nombreFila, valorEstilo)
{
	var ie=(document.all) ? 1:0;
	var nc=(document.layers) ? 1:0;
	var n6=(document.getElementById) ? 1:0;
	
	if (ie) { document.all[nombreFila].className = valorEstilo; }
	if (n6) { document.getElementById(nombreFila).className = valorEstilo; }
	if (nc) { document.layers[nombreFila].className= valorEstilo; }	
}

//funcion para agrandar la imagen
function showpic(event, WhichOne, BackPic, Type, Pos)  {
	var NN4 = document.layers? true : false;
	var IE4 = document.all? true : false;

	// Only move the layer is requried
	if(Pos == 1)    {

	if(IE4)	{

		if(BackPic == 'pic3')   {
		Ypos = 150;
		Xpos = document.body.scrollLeft + event.clientX - event.offsetX -190;
		Ypos = document.body.scrollTop + event.clientY - event.offsetY - Ypos;
		} else  {
		Ypos = 50;//10;
		Xpos = document.body.scrollLeft + event.clientX - event.offsetX -400;//+70;
		Ypos = document.body.scrollTop + event.clientY - event.offsetY + Ypos;
		}

	} else	{
		
		if(BackPic == 'pic3')   {
			Ypos = 150;
			Xpos = event.pageX - 200;
			Ypos = event.pageY - 150;
		} else  {
			Ypos = 50;//10;
			Xpos = event.pageX - 200;//100;
			Ypos = event.pageY - 50;
		}

		Xpos = '350';


	}


	if(document.getElementById(WhichOne).style.visibility == "visible" && Type == 0)
	return;

	document.getElementById(WhichOne).style.top = Ypos;
	document.getElementById(WhichOne).style.left = Xpos;
	}

	// Switch the visibility, and set the background picture to lighter opacity
	if(Type == 0)   { 
	document.getElementById(WhichOne).style.visibility = "visible";

	Amount = 25;
	document.getElementById("global").style.filter = "alpha(opacity=" + Amount + ")";
	document.getElementById("global").style.opacity = "0.25";

	} else  {
	document.getElementById(WhichOne).style.visibility = "hidden";

	Amount = 100;
	document.getElementById("global").style.filter = "alpha(opacity=" + Amount + ")";
	document.getElementById("global").style.opacity = "1";

	}

}





























//BORRAR A PARTIR DE ACA





//Retorna true si el campo esta vacio y false en caso contrario
function isEmpty ( anEditBox, msg  ){
   if ( anEditBox.value == "") {
		alert (msg);
		anEditBox.focus();
		return true;
	 }   
   else
     return false;
  }


function fecha(){

fecha = new Date();
dia = fecha.getDate();
dia_semana = fecha.getDay();
mes = fecha.getMonth();
ano = fecha.getFullYear();

nombre_dias = new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
nombre_meses = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");

document.write(dia + " de " + nombre_meses[mes] + " de " + ano);

}


function imprimir() {
  if (window.print) {
    window.print();
  }else
    alert("Lo siento, pero a tu navegador no se le puede ordenar imprimir" +
      " desde la web.");
}

function cerrar() {
    window.close();
}

function statusmsg(msg) { window.status = msg ; return true }

// funciones para controlar las listas desplegables

var ie=(document.all) ? 1:0;
var nc=(document.layers) ? 1:0;
var n6=(document.getElementById) ? 1:0;

var estSbM1  = 1;
var estSbM2  = 1;
var estSbM3  = 1;
var estSbM4  = 1;
var estSbM5  = 1;
var estSbM6  = 1;
var estSbM7  = 1;
var estSbM8  = 1;
var estSbM9  = 1;
var estSbM10 = 1;
var estSbM11 = 1;
var estSbM12 = 1;
var estSbM13 = 1;

function MOSubmenu(etqCapa)
{
 var estcapa

  if (etqCapa == 'S1') {
	if (estSbM1) estcapa = 'block'
	else estcapa = "none";
	estSbM1 = (estSbM1) ? 0:1;
  }
  else
  {	
	if (etqCapa == 'S2') {
	  if (estSbM2) estcapa = 'block'
	  else estcapa = "none";
	  estSbM2 = (estSbM2) ? 0:1;
	}
	else
	{
	  if (etqCapa == 'S3') {
		if (estSbM3) estcapa = 'block'
		else estcapa = "none";
		estSbM3 = (estSbM3) ? 0:1;
	  }
	  else
	  {
		if (etqCapa == 'S4') {
		  if (estSbM4) estcapa = 'block'
		  else estcapa = "none";
		  estSbM4 = (estSbM4) ? 0:1;
		}
		  else
		  {
			if (etqCapa == 'S5') {
			  if (estSbM5) estcapa = 'block'
			  else estcapa = "none";
			  estSbM5 = (estSbM5) ? 0:1;
			}
			  else
			  {
				if (etqCapa == 'S6') {
				  if (estSbM6) estcapa = 'block'
				  else estcapa = "none";
				  estSbM6 = (estSbM6) ? 0:1;
				}
				  else
				  {
					if (etqCapa == 'S7') {
					  if (estSbM7) estcapa = 'block'
					  else estcapa = "none";
					  estSbM7 = (estSbM7) ? 0:1;
					}					
					  else
					  {
						if (etqCapa == 'S8') {
						  if (estSbM8) estcapa = 'block'
						  else estcapa = "none";
						  estSbM8 = (estSbM8) ? 0:1;
						}
						  else
						  {
							if (etqCapa == 'S9') {
							  if (estSbM9) estcapa = 'block'
							  else estcapa = "none";
							  estSbM9 = (estSbM9) ? 0:1;
							}
							  else
							  {
								if (etqCapa == 'S10') {
								  if (estSbM10) estcapa = 'block'
								  else estcapa = "none";
								  estSbM10 = (estSbM10) ? 0:1;
								}
								  else
								  {
									if (etqCapa == 'S11') {
									  if (estSbM11) estcapa = 'block'
									  else estcapa = "none";
									  estSbM11 = (estSbM11) ? 0:1;
									}
									  else
									  {
										if (etqCapa == 'S12') {
										  if (estSbM12) estcapa = 'block'
										  else estcapa = "none";
										  estSbM12 = (estSbM12) ? 0:1;
										}										
										  else
										  {
											if (etqCapa == 'S13') {
											  if (estSbM13) estcapa = 'block'
											  else estcapa = "none";
											  estSbM13 = (estSbM13) ? 0:1;
											}
										  }
									  }
								  }
							  }
						  }
					  }
				  }
			  }
		  }
	  }
	}
  }
  
  if (ie) {
	document.all[etqCapa].style.display= estcapa;
  }
  if(n6){
	document.getElementById(etqCapa).style.display = estcapa;
  }
  if(nc){
    document.layers[etqCapa].display= estcapa;
  }
}

var clicked = "minus";

function imgover(imgname){
	 imgname.src = "/images/arrow_down_over.gif";
}
function imgout(imgname){
     imgname.src = "/images/arrow_down.gif";
}

function imgclick(imgname){
   if (clicked == "plus"){
          clicked  = "minus";
       }
       else{
          clicked = "plus";
       }
}
function collapsed(){
	collapse('S1');
	collapse('S2');
	collapse('S3');
	collapse('S4');
	collapse('S5');
	collapse('S6');
	collapse('S7');
	collapse('S8');
	collapse('S9');
	collapse('S10');
	collapse('S11');
	collapse('S12');
	collapse('S13');

}

function collapse(etqCapa){

	document.getElementById(etqCapa).style.display ="none";

}
function ShowHide(id) {
	aux = document.getElementById(id).style.display;
	if (aux == 'block')	{aux = 'none';}
	else{aux = 'block';	}
    document.getElementById(id).style.display = aux;
}


function promo(remoteWin){
	remoteWin = window.open( remoteWin, "links", "width=800,height=969,toolbar=no,resizable=no,location=no,menubar=no,scrollbars=yes" );
}