	// JavaScript Document
///////// Popups ///////////////////////////////////////
function Abrir_curriculum (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=700,height=700,top=100,left=50";
window.open(pagina,"",opciones);
}

function ubicacion_transparencia (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=763,height=700,top=100,left=50";
window.open(pagina,"",opciones);
}


function Abrir_curriculum_consejeros (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=605,height=600,top=100,left=50";
window.open(pagina,"",opciones);
}

function noticias(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=600,top=20,left=0";
window.open(pagina,"",opciones);
}
function servicio(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=600,top=20,left=0";
window.open(pagina,"",opciones);
}

function sintesis(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=600,top=20,left=0";
window.open(pagina,"",opciones);
}
function openubicacion() {
window.open("images/ubicacion_1.gif","Ubicacion", "height=594,width=601,status=no,toolbar=no,menubar=no,location=no");
}
function Abrir_Ubicacion (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=594,height=601,top=100,left=50";
window.open(pagina,"",opciones);
}
function Abrir_galeria (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=950,height=740,top=100,left=50";
window.open(pagina,"",opciones);
}
function Abrir_monitoreo (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=750,height=622,top=100,left=50";
window.open(pagina,"",opciones);
}
function Abrir_Estadisticas(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=865,height=1000,top=10,left=10";

window.open(pagina,"",opciones);
}
function Abrir_libro(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=865,height=1000,top=10,left=10";

window.open(pagina,"",opciones);
}

function spot(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=640,height=480,top=10,left=10";
window.open(pagina,"",opciones);
}

function generico1(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=400,top=25,left=300";
window.open(pagina,"",opciones);
}

function generico2(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=450,top=25,left=400";
window.open(pagina,"",opciones);
}

function generico3(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=450,top=25,left=500";
window.open(pagina,"",opciones);
}

function popup_declaracion(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=450,top=40,left=20";
window.open(pagina,"",opciones);
}

function Abrir_ayuda(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=990,height=810,top=10,left=10";
window.open(pagina,"",opciones);
}


function popup(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=225,top=100,left=50";
window.open(pagina,"",opciones);
}

function popup_tca(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=491,height=650,top=100,left=50";
window.open(pagina,"",opciones);
}

function popupBib(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=225,top=200,left=350";
window.open(pagina,"",opciones);
}

function popup3(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=700,top=100,left=550";
window.open(pagina,"",opciones);
}

function popup2(pagina) {
var opciones="fullscreen=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=340,top=10,left=250";

window.open(pagina,"",opciones);
}

function popup4(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=490,height=678,top=100,left=250";
window.open(pagina,"",opciones);
}


function portal(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=435,height=235,top=100,left=50";
window.open(pagina,"",opciones);
}



function lista_del_dia (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=950,height=850,top=0,left=0";
window.open(pagina,"",opciones);
}
function directorio(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=650,height=850,top=0,left=0";
window.open(pagina,"",opciones);
}

function busqueda_funcionario(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=650,height=180,top=300,left=400";
window.open(pagina,"",opciones);
}
function directorio_juzgados(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=716,height=441,top=100,left=40";
window.open(pagina,"",opciones);
}
function directorio_juzgados_trans(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=732,height=460,top=100,left=40";
window.open(pagina,"",opciones);
}


function leyes(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=750,height=441,top=100,left=40";
window.open(pagina,"",opciones);
}

function lista_sala_publicada(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=950,height=740,top=100,left=50";
window.open(pagina,"",opciones);
}

function organigrama(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=940,height=466,top=100,left=40";
window.open(pagina,"",opciones);
}

function libro1(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=571,height=739,top=100,left=40";
window.open(pagina,"",opciones);
}

function libro2(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=361,height=600,top=100,left=700";
window.open(pagina,"",opciones);
}

function cartel2(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=350,height=179,top=100,left=450";
window.open(pagina,"",opciones);
}


function cartel2coloquio(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=521,height=800,top=100,left=450";
window.open(pagina,"",opciones);
}
function triptico2coloqui0(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=900,height=650,top=100,left=450";
window.open(pagina,"",opciones);
}

function SpotII(pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=450,top=100,left=450";
window.open(pagina,"",opciones);
}
///////////////////////////////////////////////////////



<!-- Begin cambia imagenes
function movepic(img_name,img_src) {
document[img_name].src=img_src;
}
// End -->

function valida_usuarios(){
	
	
 if((document.sample.usuario.value == "")||  (document.sample.usuario.value == null))
   {
      alert ("Introducir usuario");
    //  document.sample.usuario.focus();
      return false;
    }
else
 {
  if((document.sample.password.value== "")|| (document.sample.password.value==null))
   	{
      alert ("Introducir Contraseña");
      //document.sample.password.focus();
      return false;
    }
	
 else{
     return true;
 	}
 }
}


function limpia()
{
if(document.busca.mot.value=="Buscar")
{
document.busca.mot.value="";	
}
}
function llena_bus()
{
if(document.busca.mot.value=="")
{
document.busca.mot.value="Buscar";	
}	
}
// JavaScript Document
/********************INICIO ASUNTOS RADICADOS*******************************************************************/

function valo()
{
		document.sample.actor_op.disabled=true;			 
		document.sample.demandado_op.disabled=true;			 
	     document.sample.partes.checked=false;			 
  		 document.sample.actor_op.checked=false;
   		 document.sample.demandado_op.checked=false;
		 document.sample1.sala.disabled=false;
		 document.sample1.via.disabled=false;
		 document.sample.toca.disabled=false;		 
		 document.sample.causa.disabled=false;
		 document.sample.no_oficio.disabled=false;
		 document.sample.anot.disabled=false;
		 document.sample.anoc.disabled=false;
		 document.sample.anon.disabled=false;
		 document.sample.actor.disabled=true;
		 document.sample.demandado.disabled=true;
		 document.sample.actor.value="No Aplica";
 		 document.sample.demandado.value="No Aplica";	
		 document.sample.toca.value="";
 		 document.sample.causa.value="";		
		 document.sample.no_oficio.value="";
 		 document.sample.anot.value="";
 		 document.sample.anoc.value="";		 
 		 document.sample.anon.value="";
		 document.sample.calendar.value="";
 		 document.sample.calendar.disabled=false;		 		 

}

function valo2()
{
  		document.sample.actor_op.disabled=false;			 
		document.sample.demandado_op.disabled=false;			 

		 document.sample1.general.checked=false;
  		 document.sample.actor_op.checked=true;
   		 document.sample.demandado_op.checked=false;

			
		 document.sample.actor.disabled=false;
		 document.sample.demandado.disabled=true;
 		 document.sample.demandado.value="No Aplica";
		 document.sample1.sala.disabled=true;
		 document.sample1.via.disabled=true;
		 document.sample.toca.disabled=true;		 
		 document.sample.causa.disabled=true;
		 document.sample.no_oficio.disabled=true;		 
 		 document.sample.anot.disabled=true;
		 document.sample.anoc.disabled=true;
		 document.sample.anon.disabled=true;		 		 		 		 		 
		 document.sample.toca.value="0000";
 		 document.sample.causa.value="0000";		
		 document.sample.no_oficio.value="0000";
 		 document.sample.anot.value="0000";
 		 document.sample.anoc.value="0000";		 
 		 document.sample.anon.value="0000";
 		 document.sample.calendar.value="0000-00-00";		 		 
 		 document.sample.calendar.disabled=true;		 		 
         document.sample.actor.value="";
// 		 document.sample.demandado.value="";	

		 	 
}

function ini()
{
	
		
		
		document.sample.actor_op.disabled=false;			 
		document.sample.demandado_op.disabled=false;			 
		
		document.sample.actor_op.checked=true;
		document.sample.demandado_op.checked=false;	
		


		document.sample.demandado.disabled=true;			 

 		 document.sample.demandado.value="No Aplica";
    
	   
}
function ini1()
{
		 document.sample1.general.checked=true;
		 document.sample.actor.disabled=true;
		 document.sample.demandado.disabled=true;
		 document.sample.anot.disabled=true;
		 document.sample.anoc.disabled=true;
		 document.sample.anon.disabled=true;
		 document.sample1.sala.value="";
 		 document.sample1.via.value="";
		 document.sample1.sala.disabled=false;
		 document.sample1.via.disabled=false;
		 document.sample.toca.disabled=false;		 
		 document.sample.causa.disabled=false;
		 document.sample.no_oficio.disabled=false;		 
		 document.sample.toca.value="";
 		 document.sample.causa.value="";		
		 document.sample.no_oficio.value="";
 		 document.sample.anot.value="";
 		 document.sample.anoc.value="";		 
 		 document.sample.anon.value="";
		 document.sample.calendar.value="";
 		 document.sample.calendar.disabled=false;		 
		 document.sample.actor.value="No Aplica";
 		 document.sample.demandado.value="No Aplica";
}

<!---------------------------------------------------------------------------------------------------------->


function validar_toca() {	
if ( document.sample.toca.value !== "" ) {

      
		document.sample.anot.disabled=false;
		document.sample.anot.focus();

	} else	{
		document.sample.anot.disabled=true;
		
	}	
}

function validar_causa() {	

if ( document.sample.causa.value !== "" ) {

		document.sample.anoc.disabled=false;
		document.sample.anoc.focus();

	} else	{
		document.sample.anoc.disabled=true;

	}	

}
function validar_no_oficio() {	

if ( document.sample.no_oficio.value !== "" ) {

		document.sample.anon.disabled=false;
		document.sample.anon.focus();

	} else	{
		document.sample.anon.disabled=true;

	}	
}

function validar(){
	if (document.sample.materia.value == ""){
		alert("Seleccione La Materia")
		return false
	}
	
	else 
	{
	
		  if (document.sample.sala.value=="" && document.sample.via.value == "" && document.sample.toca.value== "" && document.sample.			          causa.value == "" && document.sample.no_oficio.value== "" && document.sample.calendar.value =="" && document.sample.actor.value =="")
		   {
		   alert("Llene al menos un campo para continuar con la búsqueda")		
		   return false
		   }
	/*   else
	    { 
		  if (document.sample.actor.value == "" && document.sample.demandado.value == "" )
		    {
	     	alert("Llene al menos 2 Campos")
		    return false
		    }
	
	     }
	*/
	 }
	

}

function validar_actor() {	
 
        document.sample.demandado_op.checked=false;			 

    	document.sample.demandado.disabled=true;
		document.sample.demandado.value="No Aplica";				
		document.sample.actor.disabled=false;
       	document.sample.actor.value="";



}


function validar_demandado() {	

        document.sample.actor_op.checked=false;			 
    	document.sample.actor.disabled=true;
		document.sample.actor.value="No Aplica";				
		document.sample.demandado.disabled=false;
       	document.sample.demandado.value="";
}


/********************FIN ASUNTOS RADICADOS*******************************************************************/

/*Menu arriba*/
function jsTrim(s) {return s.replace(/(^\s+)|(\s+$)/g, "");}

function Track(trackParm, objLink)
{
    if (objLink.innerText && jsTrim(objLink.innerText))
    {
        // anchor tag, use link text
        LinkText = objLink.innerText;
    }
    else if (objLink.all && objLink.all(0).alt)
    {
        // image, use alt text
        LinkText = objLink.all(0).alt;
    }
         
    var strDomain = document.domain;
    var s = trackParm.split("|");
    var strLinkArea;
    var strLinkId;
    var strPageRegion;
    
    if (trackParm.substring(0,1) == "|")
    {
        strPageRegion = s[1];
        strLinkArea = s[2];
        strLinkId = s[2] + s[3];
    }
    else
    {
            strLinkArea = s[0];
        strLinkId = s[0] + s[1];

    }
    
    if (typeof(LinkText)=="undefined" || !LinkText || LinkText == "")
        LinkText = strLinkId;

    ctUrl = objLink.href + "?LinkId=" + strLinkId + "&LinkArea=" + strLinkArea 

    if (typeof(DCSext)!="undefined") 
    {
            DCSext.wt_strHeadlnLocale = detectedLocale;
            DCSext.wt_strCat=strLinkArea+"|"+detectedLocale;
            DCSext.wt_strUrl = window.location.href.toLowerCase();
            DCSext.wt_strArea = strPageRegion;
    }
        return false; 
}

var b = window.navigator.appName;


//	Show the languages list in the it's panel
function DDFilterOn(e)
{   
	try
	{
		//	Change Image
		ChangeDropDownImage(true);
		//	Set Position
		oMTPS_DD_PopUpDiv.style.top = oMTPS_DD_ImgArrow.height;
		
		//	Add Event Handlers
		if(oMTPS_DD_PopUpDiv.style.display != "inline")
		{
			oMTPS_DD_PopUpDiv.style.display = "inline";

            if(document.addEventListener)
            {       //  Commented for # 32609
				    //  document.addEventListener("keydown", HandleEvent, false);
				    document.addEventListener("click", TestForResizableAreaControl, false);
				    window.addEventListener("resize", TestForResizableAreaControl, false);			
            } 
            else
            { 
				    document.attachEvent("onkeydown", HandleEvent, false);
       				document.body.onclick = HideFromClick;	
            } 

		}
		else
		{
			//	oMTPS_DD_PopUpDiv.style.display = "none";
			setTimeout(HideThisMenu, 0);			
		}
		
	}
	catch(err)
	{
		throw err;
	}
	e.cancelBubble = true;
	oMTPS_DD_Div.normalize();
	return;
}

// Handle the enter key for a section of a form, binding it to the provided submit buton 
function HandleEvent(event)
{ 
    var nav = window.Event ? true : false; 
    if (nav) { 
        return NetscapeEventHandler(event); 
    } else { 
        return MicrosoftEventHandler(); 
    } 
} 

function NetscapeEventHandler(e)
{ 
//trap for enter (13), escape (27) and "t" (84)
    if ((e.which == 13 || e.which == 27 || e.which == 84) && e.target.type != 'textarea' && e.target.type != 'submit')
     { 
		setTimeout(HideThisMenu, 0);
		document.removeEventListener("keydown", HandleEvent, false);
		e.cancelBubble = true;
        e.returnValue = false; 
        e.cancel = true; 
        e.preventDefault(); 
    } 
    return; 
} 

function MicrosoftEventHandler() { 
//trap for enter (13), escape (27) and "t" (84)
    if ((event.keyCode == 13 || event.keyCode == 27 || event.keyCode == 84 )&& event.srcElement.type != 'textarea' && event.srcElement.type != 'submit') { 
        event.returnValue = false; 
        event.cancel = true;
    	setTimeout(HideThisMenu, 0);
    	document.detachEvent("onkeydown", HandleEvent, false);
    	event.cancelBubble = true;
    } 
    return; 
}


//	Only used by IE
function HideFromClick(event)
{
	var objClicked = window.event.srcElement;
	var objParent = objClicked.parentNode.parentNode;
	
	if (objParent.id != oMTPS_DD_PopUpDiv.id && objParent.id != oMTPS_DD_Div.id ) 
	{
		setTimeout(HideThisMenu, 0);
		return;
	}
	else
	{
		window.event.cancelBubble = true;
		return;
	}
}

/// FF & NN only
function TestForResizableAreaControl(e)
{
	try
	{
	//	For keydown events
	if (e.type == "keydown")
	{
		//	alert(e.which);
		if (e.which == 84 || e.which == 13)
		{
			setTimeout(HideThisMenu, 0);
			document.removeEventListener("keydown", TestForResizableAreaControl, false);
			e.cancelBubble = true;
			return;
		}
	}
	else if (e.type == "resize")
	{
		setTimeout(HideThisMenu, 0);
		window.removeEventListener("resize", TestForResizableAreaControl, false);
		e.cancelBubble = true;
		return;		
	}
	
	// for mousedown event
		if (e.type == "click")
		{
			if (e.which == 1 || e.which == 32)
			{	
				var eNode = e.target;
				if (eNode.id.length == 0)
				{	//	alert("returning false");
					setTimeout(HideThisMenu, 0);
					document.removeEventListener("click", TestForResizableAreaControl, false);
					return false;
				}
				else
				{
					var pNode = document.getElementById(eNode.id).parentNode.parentNode;
					if (eNode.id != oMTPS_DD_PopUpDiv.id)
					{
						if (pNode.id != oMTPS_DD_PopUpDiv.id)
						{
							setTimeout(HideThisMenu, 0);
							document.removeEventListener("mousedown", TestForResizableAreaControl, false);
						}
					}			
					if (e.target.id == oMTPS_DD_ImgArrow.id)
					{
						setTimeout(HideThisMenu, 0);
						document.removeEventListener("mousedown", TestForResizableAreaControl, false);
					}
					if (e.target.id == oMTPS_DD_PanelLink.id)
					{
						setTimeout(HideThisMenu, 0);
						document.removeEventListener("mousedown", TestForResizableAreaControl, false);
					}
				}
				return;
			}
		}
	}
	catch(err)
	{
		throw err;
	}
}

// Persist Menu long enough for client to click check boxes
function HideThisMenu()
{
	oMTPS_DD_PopUpDiv.style.display = "none";
	oMTPS_DD_ImgArrow.src = ArrowOffPath;
	document.body.onclick = null;
	return;
}

//	Handle Image changes
function ChangeDropDownImage(boolOnOff)
{
	if (boolOnOff == true)
	{
		oMTPS_DD_ImgArrow.src = ArrowOnPath;
	}
	else
	{
		oMTPS_DD_ImgArrow.src = ArrowOffPath;
	}
}
//LanguageFilter for robot and printer devices
function SetLangFilterAll()
{
   FilterLanguageSpecificText("nu");
}
//	Set individual checkbox
function SetLangFilter(CodeSnipID,isExistLangFilter)
{
	try
	{
		if (CodeSnipID != null)
		{
			ToggleLang(CodeSnipID);
			 oServerBool = false;
		}
		SetFilterText(isExistLangFilter);
		SetCodeSnippetLangFilterCookie();	
	}
	catch(err)
	{
		throw err;
	}
	return;
}

/*Validación de Tecla Mayuscula en Forms*/
function capLock(e){
kc=e.keyCode?e.keyCode:e.which;
sk=e.shiftKey?e.shiftKey:((kc==16)?true:false);
if(((kc>=65&&kc<=90)&&!sk)||((kc>=97&&kc<=122)&&sk))
document.getElementById('caplock').style.visibility = 'visible';
else document.getElementById('caplock').style.visibility = 'hidden';
}

/*FIN.. Validación de Tecla Mayuscula en Forms*/

//	This method is only for changing the value on the client side
//	The server side code should read the cookie and set the checkbox prior to rendering 
function ToggleLang(strThis)
{
  
	var langArray = "";
	
	try
	{
		langArray = eval(strThis);
	}
	catch(err)
	{
		//	no script variables where written out by the server side code
		return;
	}
	
	try
	{
		
		for (i = 0; i < langArray.length; i++)
		{
			
			var thisCodeSnip = document.getElementById(langArray[i]);
			if(thisCodeSnip==null)
			continue;
   
			if (thisCodeSnip.className == "code")
			{
				thisCodeSnip.className = "codeHide";
				
			}
			else
			{
				thisCodeSnip.className = "code";
				
			}
		}
		if (langArray.length > 0)
		{
		  
		  var thisCodeSnipElement = document.getElementById(langArray[0]);
		  var thisCodeSnipParent = thisCodeSnipElement.parentNode.parentNode.parentNode.id;
		  thisCodeSnipParent += "_h";
		  var obj = document.getElementById(thisCodeSnipParent);
		  if(obj != null)
		  {
		    if (obj.innerHTML.indexOf("minus.gif") > 0)
		    {
		        thisCodeSnipElement.parentNode.parentNode.style.display = "block";
		    }
		    else
		    {
		        thisCodeSnipElement.parentNode.parentNode.style.display = "none";
		    }
		  }
		}		  
	}
	catch(err)
	{
		throw err;
	}
	return;
}


// set filter language test
function SetFilterText(isLangSpecTextExist)
{
	
	var spr = " : ";
	try
	{
		var intSetoMTPS_DD_PanelLinkText = 0;
		var objLastChecked = null;
		var cbxColl = oMTPS_DD_PopUpDiv.getElementsByTagName("input");
		
		for (var i = 0; i < cbxColl.length;i++)
		{
			if (cbxColl[i].checked == true)
			{
				intSetoMTPS_DD_PanelLinkText++;
				objLastChecked = cbxColl[i].value;
			}
		}
		if (intSetoMTPS_DD_PanelLinkText == 0)
		{
			oMTPS_DD_PanelLink.innerHTML = strConstLangFilterText + spr + strConstLangFilterNone;
			if (isLangSpecTextExist)
			FilterLanguageSpecificText("nu");
			
		}
		if (intSetoMTPS_DD_PanelLinkText == 1)
		{
			oMTPS_DD_PanelLink.innerHTML = strConstLangFilterText + spr + objLastChecked;
			if (isLangSpecTextExist)
			{
			  var devLang;
  			
			  switch (objLastChecked)
			  {
			    case "Visual Basic":
			    {
			       devLang = "vb"; break;
			    }
			    case "C#":
			    {
			       devLang = "cs"; break;
			    }
			    case "c#":
			    {
			       devLang = "cs"; break;
			    }
			    case "C++":
			    {
			       devLang = "cpp"; break;
			    }
			    case "c++":
			    {
			       devLang = "cpp"; break;
			    }
			    case "JScript":
			    {
			       devLang = "cs"; break;
			    }
			    case "JSharp":
			    {
			       devLang = "cs"; break;
			    }
			    case "J#":
			    {
			       devLang = "cs"; break;
			    }
			    default:
			    {
			       devLang = "nu"; break;
			    }
			  }
			  FilterLanguageSpecificText(devLang);
			} 
		}
		if (intSetoMTPS_DD_PanelLinkText > 1)
		{
			oMTPS_DD_PanelLink.innerHTML = strConstLangFilterText + spr + strConstLangFilterMulti;
			if (isLangSpecTextExist)
			FilterLanguageSpecificText("nu"); 	
		}
		if (intSetoMTPS_DD_PanelLinkText == oMTPS_DD_PopUpDiv.childNodes.length)
		{
			oMTPS_DD_PanelLink.innerHTML = strConstLangFilterText + spr + strConstLangFilterAll;
			if (isLangSpecTextExist)
			FilterLanguageSpecificText("nu"); 
		}	
		intSetoMTPS_DD_PanelLinkText = 0;
		objLastChecked = null;
	}
	catch(err)
	{
		throw err;
	}
	return;
}

// This function filters the languageSpecific Text from a page with multiple language syntax.
function FilterLanguageSpecificText(devLang)
{
  var oStyle = document.styleSheets["LanguageSpecificTextStyle"]
  if (oStyle != null)
  {
    oStyle.removeRule(0)
    oStyle.addRule("."+devLang, "display:inline", 0)
  }

}



//	This function redraws the selected code snippet controls,
//	based on the state of the check boxes in the drop down,
//	which is read from the cookie on the server side.
function CheckDropDownClientCookie(isExistLangText)
{
	var cbxColl = oMTPS_DD_PopUpDiv.getElementsByTagName("input");
	{
	  for (var i = 0; i < cbxColl.length;i++)
	  {
	    if (cbxColl[i].checked != true)
	    {
		    var tStr = cbxColl[i].getAttribute("arrayValue");
		    SetLangFilter(tStr,isExistLangText);
		  }
	  }
	}
	return;
}

// Set cookie on each event
// Function to set the Toc panel size
// Browser must support cookies and script
// "days" variable declared in ResizableArea Control, line # 156
function SetCodeSnippetLangFilterCookie()
{
    var daysToExpire = 60;
    var cookieDate = new Date();
	cookieDate.setTime(cookieDate.getTime()+(daysToExpire*24*360000));
    expires = "expires=" + cookieDate.toGMTString();
            
	if (window.navigator.cookieEnabled == true)
	{
		var cbxColl = oMTPS_DD_PopUpDiv.getElementsByTagName("input");
	  
		for (i = 0 ; i < cbxColl.length; i ++)
		{
			document.cookie = cbxColl[i].id + "_" + i + "=" + cbxColl[i].checked + "; " + expires;
		}
	}
	return;
}



var _expandCollapseIDPrefix;
var _expandAllText;
var _collapseAllText;
var _plusImgPath;
var _minusImgPath;
var _state; // 0=collapsed, 1=expanded

function EC_Init(ID,expandAllText,collapseAllText,plusImgPath,minusImgPath)
{
  _state = 1;
  _expandCollapseIDPrefix = ID;  
  _expandAllText = expandAllText;
  _collapseAllText = collapseAllText;
  _plusImgPath = plusImgPath;
  _minusImgPath = minusImgPath;

  // Determine initial state
  window.setTimeout(EC_InitState,0);
}

function EC_InitState()
{
  if (typeof(CollapsiblePanels) !== "undefined")
  {
    var count = CollapsiblePanels.length;
    for (var i=0; i<count; i++)
    {
      var ctrl = $find(CollapsiblePanels[i].id+"_x");
      if ( ctrl != null
        && ctrl.get_Collapsed())
      { // If any collapsible area is collapsed, set state to collapsed (i.e. display "Expand All")
          var img = $get(_expandCollapseIDPrefix+"_ECImg");
          var link = $get(_expandCollapseIDPrefix+"_ECLink");
          if ( img != null
            && link != null )
          {
            img.src = _plusImgPath;
            link.innerHTML = _expandAllText;
            _state = 0;
          }
          break;
      }
    }
  }
}

function EC_Click()
{
  var img = $get(_expandCollapseIDPrefix+"_ECImg");
  var link = $get(_expandCollapseIDPrefix+"_ECLink");
  if ( img != null
    && link != null )
  {
    if ( _state == 0 )
    {
      img.src = _minusImgPath;
      link.innerHTML = _collapseAllText;
      _state = 1;
    }
    else
    {
      img.src = _plusImgPath;
      link.innerHTML = _expandAllText;
      _state = 0;
    }
  }
  // Toggle each collapsible panel on this page
  if ( typeof(CollapsiblePanels) !== "undefined" )
  {
    var count = CollapsiblePanels.length;
    for ( var i=0; i<count; i++ )
    {
      var ctrl = $find(CollapsiblePanels[i].id+"_x");
      if ( ctrl != null )
      {
        if ( _state == 0 )
        {
          ctrl.collapsePanel();
        }
        else
        {
          ctrl.expandPanel();
        }
      }
    }
  }
}


if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();



function EyeBrowMenuBarSetHeight(TFly){
  var maxHeight = 200;
  var overflow = (TFly.DT.clientHeight > maxHeight);
    TFly.DT.style.height = ((overflow) ? maxHeight : TFly.DT.scrollHeight) + "px";
    TFly.DT.style.width = TFly.DT.scrollWidth + ((overflow) ? 20 :0) + "px";
  if(overflow) TFly.DT.style.overflow="auto"
}





function IsPageRated(objID,labelID, text, flyoutID, btn){
  obj = $get(objID)
  if (obj.Rated)
  { 
    flyout = $get(flyoutID)
    TFly_Popup(flyout,false)
    window.setTimeout(function(){btn.disabled=true}, 100);
    return true;
  }
  else
  {
    label = $get(labelID)
    
    if(label.timer){
      window.clearTimeout(label.timer)
    }else{
      label.className_ = label.className;
      label.innerHTML_ = label.innerHTML;
      label.className = 'WarningMessage';
      label.innerHTML = text;
    }

    label.timer = window.setTimeout(function(){
                            label.className = label.className_;
                            label.innerHTML = label.innerHTML_;
                            label.timer=null;
                         }
                      ,3000);
  }  
  return false;
}

function tbNavParent(navUrl)
{
    window.top.location.href = navUrl;
}
function RegisterAutoSubmit( objName, btnName,tag){
  window.onbeforeunload_autosubmit = window.onbeforeunload;
  window.onbeforeunload = function(){
                                 if(window.onbeforeunload_autosubmit)
                                    window.onbeforeunload_autosubmit()
                                 SubmitRating(objName, btnName,tag)
                              }
}

function SubmitRating(objName, btnName, tag){
  var obj = $get(objName)
  var btn = document.getElementById(btnName)
  if(obj && obj.Rated && btn){
      btn.disabled=false;
      btn.click();
      var d = new Date();
      d.setFullYear(d.getFullYear() +1)
      var CookieInfo = tag + "=" + escape("xxx") + ";expires="+d.toGMTString()+" path=/;"; 
      document.cookie = CookieInfo;
   }
}





var dragging = false;

function ra_resizeStart(e, splitter, leftSectionId)
{
  dragging = true;  
  window.ra_splitter = splitter;
  window.ra_leftSection = document.getElementById(leftSectionId);
  
  splitter.parrentOffsetX = ra_GetX(splitter.parentNode)  + e.clientX - ra_GetX(splitter)
  
  document.onmousemove = function(e) { if (!e) var e = window.event; ra_mouseMove(e) }
  document.onmouseup = function(e) { if (!e) var e = window.event; ra_resizeStop(e) }
  document.body.ondrag = function () { return !dragging; };
  document.body.onselectstart = function () { return !dragging; };
  
  return false;
}


function ra_resizeStop(e)
{
  document.onmousemove = null;
  document.onmouseup = null;
  splitter = window.ra_splitter;
  leftSection = window.ra_leftSection;

  ra_redaw(splitter, leftSection, splitter.offsetLeft)

  window.ra_element = null;
  dragging = false;
  
}
function HighlightSplitterBar(strObjName, intOnOff)
{       
   var sliderBar = document.getElementById(strObjName);
	
    if (intOnOff == 0)
    {
        sliderBar.style.backgroundImage ='url(/platform/controls/resizablearea/resources/lib_grippy1.gif)';
    }
    else
    {
        sliderBar.style.backgroundImage ='url(/platform/controls/resizablearea/resources/lib_grippy.gif)';
    }
   return;
}
function ra_redaw(splitter, leftSection, width )
{
	var date = new Date();
	date.setYear(date.getFullYear()+1); 

  if(width <= 30){//todo: add minwidth property
    leftSection.style.display = "none";
  	document.cookie = "toccollapsed=true; expires="+date.toGMTString();+"; path=/";
  	splitter.style.left ="0px";
  }else{
    leftSection.style.display = "block";
    splitter.style.left =width + "px";
  	leftSection.style.width = width + "px";
  	document.cookie = "toccollapsed=false; expires="+date.toGMTString();+"; path=/";
  	document.cookie = "tocwidth="+ width +"; expires="+date.toGMTString();+"; path=/";
   }
  if(window.ra_OnPageResize)
    ra_OnPageResize();  //rendered on the server side for IE 
}

function ra_mouseMove(e)
{
  var rightSectionMinWidth = 200;
  splitter = window.ra_splitter;
  x = e.clientX - splitter.parrentOffsetX;
  if(x <= 30) // //todo: add minwidth property
    x=0;
  else if(x >= splitter.parentNode.offsetWidth - splitter.offsetWidth - rightSectionMinWidth) 
    x = splitter.parentNode.offsetWidth - splitter.offsetWidth - rightSectionMinWidth 
  
  splitter.style.left=x + "px";
  return false;
}

function ra_GetX(oElement)
{
  var x = 0;
  while( oElement != null )
  {
    x += oElement.offsetLeft;
    oElement = oElement.offsetParent;
  }
  return x;

}


function ra_keyPress(e, splitterId, leftSectionId){
  var keyCode = (e==null) ? event.keyCode : e.which;
  
  if(keyCode == 116)
  {
		  var target = (e==null) ? event.srcElement : e.target;

	    if (target.tagName.toLowerCase() != "input" && target.tagName.toLowerCase() != "textarea" )
	    {
		    ra_OpenCollapse( splitterId, leftSectionId)
      }
      if(e==null)
       event.cancelBubble = true;
      else
       e.cancelBubble = true;
  }
}

function ra_OpenCollapse( splitterId, leftSectionId)
{
  var leftSection =  document.getElementById(leftSectionId)
  var splitter = document.getElementById(splitterId)
  if(splitter.offsetLeft == 0)
    ra_redaw(splitter, leftSection , parseInt(leftSection.style.width))
  else
    ra_redaw(splitter, leftSection , 0)
}




function tabs_onFocusSearch(sender)
{
  if(sender.isActive)
    return;
  sender.originalValue = sender.value
  sender.value = "";
  sender.className = "TabStrip_SearchBoxActive";
  sender.isActive = true;
}

function tabs_onBlurSearch(sender)
{
 if(sender.value.trim()=="")
 {
    sender.value = sender.originalValue;
    sender.className = "TabStrip_SearchBox";
    sender.isActive = false;
 }
}



var _contentID;
var _contentLocale;
var _contentVersion;
var _noTagsMessage;
var _errorMessage;
var _browseByTagTooltip;
var _removeTagTooltip;
var _currentBlockID = 0;
var _originatingUrl;

function TagEditor_AddATag(url,blockID)
{
	if ( url != "" )
	{	// Need to authenticate
		document.cookie = "edit=" + blockID;
		document.cookie = "scroll=" + blockID;
		document.location.href = url;
	}
	else
	{	// Already authenticated
		showTagEditorEditPanel(blockID);
		TagEditor_GetControl(blockID,'textbox').focus();
	}
	return false;
}

function TagEditor_AddTags(blockID)
{
  var value = TagEditor_GetControl(blockID,'textbox').value;
  if ( value != "" )
  {
	  _currentBlockID = blockID;
	  Microsoft.Mtps.Web.WebServices.TagWebService.AddTags( _contentID,
                                                          _contentLocale,
                                                          _contentVersion,
                                                          value,
                                                          blockID,
                                                          _browseByTagTooltip,
                                                          _removeTagTooltip,
                                                          _originatingUrl,
                                                          tagEditorChangeComplete,
                                                          tagEditorChangeFailure
                                                          );
	  showTagEditorViewPanel(blockID);
  }
  else
  {
	  TagEditor_GetControl(blockID,'message').innerHTML = _noTagsMessage;
  }
	return false;
}

function TagEditor_BrowseTag(url,blockID)
{
	document.cookie = "scroll=" + blockID;
	document.location.href = url;
	return false;
}

function TagEditor_CancelAddTag(blockID)
{
  showTagEditorViewPanel(blockID);
	return false;
}

//function TagEditor_ClickAddTag(evt)
//{
//  TagEditor_AddTags(TagEditor_GetBlockID(evt.target.id));
//  evt.preventDefault();
//}

//function TagEditor_ClickCancelAddTag(evt)
//{
//  TagEditor_CancelAddTag(TagEditor_GetBlockID(evt.target.id));
//  evt.preventDefault();
//}

function TagEditor_GetBlockID(controlID)
{
  var count = TagEditorControls.length;
  for ( var i=0; i<count; i++ )
  {
    var value = TagEditorControls[i];
    var idx = controlID.indexOf(value['prefix']);
    if ( idx != -1 )
    {
      return value['id'];
    }
  }
  return -1;
}

function TagEditor_GetControl(blockID,control)
{
  var count = TagEditorControls.length;
  for ( var i=0; i<count; i++ )
  {
    var value = TagEditorControls[i];
    if ( value['id'] == blockID )
    {
      return $get(value['prefix']+control);
    }
  }
}

function TagEditor_GetTags(blockID)
{
  var tags = "";
	var tagEditorBody = TagEditor_GetControl(blockID,'tags');
	if ( tagEditorBody )
	{
	  var childElems = tagEditorBody.children;
	  if ( childElems.length > 0 )
	  {
      // Deal with DIV that is inserted when a tag is added from client
	    if ( childElems[0].tagName == "DIV" )
	    {
	       childElems = childElems[0].children;
	    }

	    if ( childElems.length > 0 )
	    {
        // Get tag values from spans (each has two hyperlinks - we need the first)
	      for ( var i=0; i<childElems.length; i++)
	      {
	        var elem = childElems[i].children[0];
	        if ( elem.tagName == "A" )
	        {
            tags += elem.innerHTML + " ";
          }
	      }
	    }
	  }
	}
  return tags;
}

function TagEditor_Init(itemID,itemLocale,itemVersion,auth, originatingUrl)
{
  _contentID = itemID;
	_contentLocale = itemLocale;
	_contentVersion = itemVersion;
	_originatingUrl = originatingUrl;

	var cookieParts = document.cookie.split("; ");
	var crumb="";
	for (var i=0; i<cookieParts.length; i++)
	{
		var crumbs = cookieParts[i].split("=");
		if (crumbs[0] == "scroll"
		 && crumbs[1] != "")
		{
			scrollToTagEditor(crumbs[1]);
			removeTagEditorCookie("scroll");
		}
		if (crumbs[0] == "edit"
		 && crumbs[1] != ""
		 && auth == "true")
		{
			showTagEditorEditPanel(crumbs[1]);
		}
	}
}

function TagEditor_InitStrings(noTagsMessage,errorMessage,browseByTagTooltip,removeTagTooltip)
{
	_noTagsMessage = noTagsMessage;
	_errorMessage = errorMessage;
  _browseByTagTooltip = browseByTagTooltip;
  _removeTagTooltip = removeTagTooltip;
}

function TagEditor_KeyDown(evt)
{
  if ( evt.keyCode == 13 )
  { // Enter pressed - add the tags
    TagEditor_AddTags(TagEditor_GetBlockID(evt.target.id));
    evt.preventDefault();
	}
	else if ( evt.keyCode == 27 )
	{ // Escape pressed - cancel the operation
	  TagEditor_CancelAddTag(TagEditor_GetBlockID(evt.target.id));
    evt.preventDefault();
	}
	else
	{
	  return true;
	}
}

function TagEditor_RemoveTag(tag,url,blockID)
{
	if ( url != "" )
	{	// Need to authenticate
		document.cookie = "remove=" + tag + ":" + blockID;
		document.cookie = "scroll=" + blockID;
		document.location.href = url;
	}
	else
	{	// Already authenticated
		_currentBlockID = blockID;
		Microsoft.Mtps.Web.WebServices.TagWebService.RemoveTag( _contentID,
                                                            _contentLocale,
                                                            _contentVersion,
                                                            tag,
                                                            blockID,
                                                            _browseByTagTooltip,
                                                            _removeTagTooltip,
                                                            _originatingUrl,
                                                            tagEditorChangeComplete,
                                                            tagEditorChangeFailure );
	}
	return false;
}

function removeTagEditorCookie(name)
{
	document.cookie = name + "=; expires=Fri, 02-Jan-1970 00:00:00 GMT";
}

function scrollToTagEditor(blockID)
{
	var ctrl = TagEditor_GetControl(blockID,'textbox');
	if (ctrl)
	{
	  ctrl.scrollIntoView(false);
	}
}

function showTagEditorEditPanel(blockID)
{
	TagEditor_GetControl(blockID,'view').style.display = "none";
	TagEditor_GetControl(blockID,'edit').style.display = "";
	TagEditor_GetControl(blockID,'textbox').value = "";
	TagEditor_GetControl(blockID,'message').innerHTML = "";
	removeTagEditorCookie("edit");
}

function showTagEditorViewPanel(blockID)
{
	TagEditor_GetControl(blockID,'view').style.display = "";
	TagEditor_GetControl(blockID,'edit').style.display = "none";
	TagEditor_GetControl(blockID,'message').innerHTML = "";
}

function tagEditorChangeComplete(result)
{
	var elem = document.createElement( "div" );
	elem.innerHTML = result;
	elem.style.display = "inline";
	var tagEditorBody = TagEditor_GetControl(_currentBlockID,'tags');
	if ( tagEditorBody )
	{
	  tagEditorBody.innerHTML = "";
	  tagEditorBody.appendChild( elem );
	}
	removeTagEditorCookie("remove");
	_currentBlockID = 0;
}

function tagEditorChangeFailure(error)
{
	TagEditor_GetControl(_currentBlockID,'message').innerHTML = _errorMessage;
	TagEditor_GetControl(_currentBlockID,'message').title = error.get_message();
	removeTagEditorCookie("remove");
}



function TFly_Init(name,  offsetLeft, offsetTop, alignment, anyIter, anyTime, staticHover, popupHover, popupLatency, hideLatency, onInit, onPopup, onHide){
  var TFly = document.getElementById(name); 
  TFly.alignment = alignment;
  
  TFly.DT = document.getElementById(name+"_Popup")
  TFly.F = document.getElementById(name+"_Anim")
  
  TFly.oX = offsetLeft
  TFly.oY = offsetTop;

  TFly.AnyIter = anyIter;
  TFly.AnyTime = anyTime;

  TFly.popupLatency = popupLatency;
  TFly.hideLatency = hideLatency;
  TFly.onPopup = onPopup;
  TFly.onHide = onHide;
  
  TFly.IsHover=false;
  
  TFly.className_ = TFly.className;
  TFly.DT.className_=TFly.DT.className
  
  TFly.onmouseover = function(){TFly.IsHover=true; if(staticHover!=''){TFly.className=staticHover}; TFly_Popup(TFly,true);}
  TFly.onmouseout = function(){if(staticHover!=''){TFly.className=TFly.className_};TFly_Popup(TFly,false);TFly.DT.blur();TFly.IsHover=false;}

  if(document.all){
    TFly.onactivate = function(){if(!TFly.IsHover)TFly.onmouseover();}
    TFly.ondeactivate = function(){TFly.onmouseout();}
  }else{
    TFly.onfocus = function(){TFly.onmouseover()}
    TFly.onblur = function(){TFly.onmouseout()}
  }
 
 
  TFly.DT.onmouseover = function(){ TFly.IsHover=true; if(popupHover!=''){TFly.DT.className=popupHover;};TFly_Popup(TFly,true);}
  TFly.DT.onmouseout = function(){ if(popupHover!=''){TFly.DT.className=TFly.DT.className_};TFly_Popup(TFly,false);TFly.IsHover=false; }

  TFly_CallClientFunction(onInit, TFly)
}

function TFly_Reposition(TFly){
  var clientWidth = document.body.scrollWidth - 20; //scroller width
  var width = TFly.DT.offsetWidth;
  var absX = TFly.DT.offsetLeft 
  var d = TFly.DT
  while(d = d.offsetParent)
    absX += d.offsetLeft

  if(clientWidth<(absX+width)){
   var diff = clientWidth - absX -width
   TFly.DT.style.left = TFly.DT.offsetLeft + diff + "px"
  }
}

function TFly_CallClientFunction(name, TFly){
    if(name!=null &&  name!="")
      eval( name + "(TFly);");
}

function TFly_SetPosition(TFly, obj){
  obj.style.top = TFly.oY + TFly.offsetHeight+ "px";
  obj.style.left = TFly.oX + (TFly.offsetWidth - obj.offsetWidth )*(1+TFly.alignment)/2 + "px";
}

function TFly_Popup(TFly,value){
  if(TFly.timer!=null ) window.clearTimeout(TFly.timer)
  if(value){
    if(TFly.status=="on") return
    var timeout = (TFly.status=="active") ? 0 : TFly.popupLatency
    if(TFly.AnyIter>0 && TFly.AnyTime>0)
      TFly.timer = window.setTimeout(function(){TFly_AnimateStart(TFly,true,TFly.F.curIter);},timeout)
    else
      TFly.timer = window.setTimeout(function(){TFly_SetVisibility(TFly,true);},timeout)
  }else{
    if(TFly.status=="off") return
    var timeout = (TFly.status=="active") ? 0 : TFly.hideLatency
    if(TFly.AnyIter>0 && TFly.AnyTime>0)
      TFly.timer = window.setTimeout(function(){TFly_AnimateStart(TFly,false,TFly.F.curIter);},timeout)
    else
      TFly.timer = window.setTimeout(function(){TFly_SetVisibility(TFly,false);},timeout)
  }
}

function TFly_SetVisibility(TFly, value){
      if(value==true){
        TFly_SetPosition(TFly,TFly.DT);
        TFly.DT.style.visibility = "visible"
        TFly.style.zIndex = "999"
        TFly_Reposition(TFly);
      }else{
        TFly.DT.style.visibility = "hidden"
        TFly.style.zIndex = "0"
        TFly.DT.style.left = "-10000px"
      }
}

function TFly_AnimateStart(TFly, inout, curIter){
    if(TFly.F.timer!=null) window.clearTimeout(TFly.F.timer);
    if(curIter==null) curIter=0;
    if(TFly.status !="active"){
        TFly.status ="active";
        TFly.F.style.visibility = "visible";
        TFly.DT.style.visibility="hidden";
    }
    if(curIter<0 || curIter>TFly.AnyIter ){
        TFly.F.curIter = (curIter<1) ? 0 : TFly.AnyIter;
        TFly.status = (TFly.F.curIter==TFly.AnyIter) ? "on": "off";
        TFly.F.style.visibility = "hidden";
        TFly_SetPosition(TFly,TFly.DT);
        TFly.style.zIndex=(TFly.F.curIter==TFly.AnyIter) ? "999" : "0";
        if(TFly.F.curIter==TFly.AnyIter){
          TFly.status = "on";
          TFly_SetVisibility(TFly,true);
          TFly_CallClientFunction(TFly.onPopup, TFly)
        }else{
          TFly.status = "off";
          TFly_SetVisibility(TFly,false);
          TFly_CallClientFunction(TFly.onHide, TFly)
        }
    }else{
        var per = curIter*(95/TFly.AnyIter)+ 5;
        TFly.F.style.visibility = "hidden";
        TFly.F.style.width=TFly.DT.offsetWidth/100*per + "px";
        TFly.F.style.height=TFly.DT.offsetHeight/100*per + "px";
        TFly_SetPosition(TFly, TFly.F);
        TFly.F.style.visibility = "visible";
        var timeout = (per==100 ) ? 0 : TFly.AnyTime - (TFly.AnyTime/(TFly.AnyIter)*(curIter)); 
        curIter += (inout) ? 1:-1;
        TFly.F.timer = window.setTimeout(function(){TFly_AnimateStart(TFly, inout, curIter)},timeout);
        TFly.F.curIter = curIter;
    }
}




//________________________________________________________________________________
function UnloadToc()
{
  Sys.Application.remove_unload(UnloadToc);
  Sys.Application.remove_load(LoadToc);  
}


//________________________________________________________________________________
function LoadToc()
{
  Sys.Application.add_unload(UnloadToc);

  holder = document.getElementById('tocVectorTreeId');
  
  AsyncTocLoader();
}

//________________________________________________________________________________
function GetNextSegment()
{
  var segment = tocVector.nodes[tocIndex].id;
  tocIndex++;
  return segment;
}
    
//________________________________________________________________________________
function CreateHint( el )
{
  var tmp = el.parentNode;
  var s = "";
  
  while ((tmp != null) && (tmp.tagName == "LI"))
  {
    s = tmp.attributes.getNamedItem("name").value + "/" + s;
    tmp = tmp.parentNode;
    
    if ((tmp != null) && (tmp.tagName == "UL"))
    {
      tmp = tmp.parentNode;
    }
  }
  
  return s;
}

//________________________________________________________________________________
function WriteCookie( hint )
{
  document.cookie="TocHashCookie="+hint+"; expires=Wednesday, 01-Aug-2040 08:00:00 GMT";

}

//________________________________________________________________________________
function TocClick(e)
{
  if (window.event)
  {
    window.event.cancelBubble = true;
  }
  else
  {
    e.cancelBubble = true;
  }
     
  var srcEl = window.event ? window.event.srcElement : null;
  if ((srcEl == null) && (e.target != null))
  {
    srcEl = e.target;
  }

  if (srcEl.tagName == "IMG")
  {
    // they've clicked on one of the images
    if (srcEl.src == emptyImg)
    {
      // We've checked this node before and found nothing.  Move on, nothing to see here.
      return;
    }
    
    // adjust the image, retrieve new data as needed.
    if (srcEl.src == closedImg)
    {
      Expand( srcEl );
    }
    else
    {
      Collapse( srcEl );
    }
  }
  else if (srcEl.tagName == "A")
  {
    WriteCookie( CreateHint( srcEl ) );
  }
}

//________________________________________________________________________________
function FindHolder( container, id )
{
  var element;
  
  if (container != null)
  {
    for( x=0; x<container.childNodes.length; x++)
    {
      var elementName = container.childNodes[x].attributes.getNamedItem("name").value;
      if (elementName != null)
      {
        if ((elementName.length >= id.length) && (elementName.substr(0,id.length) == id))
        {
          return container.childNodes[x];
        }
      }
    }
  }
  return null;
}

//________________________________________________________________________________
function AsyncTocLoader()
{
  var highlightedElement = null;
  if (document.getElementById) 
  {
    if (typeof tocVector == "undefined")
    {
      return;
    }
    
    if (tocIndex < tocVector.nodes.length)
    {
      var nextUrl = hostbase + tocVector.nodes[tocIndex].url + ".aspx";
      var segment = GetNextSegment();
      holder = FindHolder( holder, segment );
      
      if (holder != null)
      {
        var i = holder.childNodes[0];
        i.src = loadingImg;

        var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        
        if (x)
        {
          x.onreadystatechange = function()
          {
            var id = segment;
            if (x.readyState == 4 && x.status == 200)
            {
              if (holder != null)
              {
                if (x.responseText.substr(0,4) == "<ul ")
                {
                  i.src = openImg;             
                  holder.innerHTML = holder.innerHTML + x.responseText;
                  var elements = holder.getElementsByTagName("UL");
                  // There is only one UL per Toc level.
                  holder = elements[0];
                  
                  if ((x.responseText.length > 5) && (holder != null))
                  {
                    x.abort();
                    AsyncTocLoader();
                  }
                  else
                  {
                    SetFocus(holder);
                    i.src = emptyImg;
                  }
                }
                else
                {
                    SetFocus(holder);
                    i.src = emptyImg;
                }
              }
              else
              {
                 i.src = emptyImg;
              }
            }
          }
        }
        x.open("GET", nextUrl, true);
        x.send("");
      }
    }
    else
    {
      if (holder != null)
      {
        SetFocus(holder.parentNode);
      }
    }
  }
}
//________________________________________________________________________________
function SetFocus(el)
{
  try
  {
    if (el != null)
    {
      var elements = el.getElementsByTagName("A");
      el.parentNode.parentNode.scrollIntoView(true);
      el.scrollIntoView(true);
      WriteCookie( CreateHint( elements[0] ) );
      elements[0].focus();
      elements[0].className = "tocSelected";
    }
  }
  catch(e)
  {
  }
}
     	        
//________________________________________________________________________________
function ajaxLoader(url)
{
  if (document.getElementById) 
  {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();			      
  }
    
  if (x)
  {
    x.open("GET", url, false);
    x.send("");
    var el = x.responseText;
    return el;
  }
}

//________________________________________________________________________________
function GetNodeRetrievalUrl( el )
{
  var parent = el.parentNode;
  return hostbase + "/"+parent.attributes.getNamedItem("name").value + ".aspx"; 
}

//________________________________________________________________________________
function FindSection( el )
{
  var parent = el.parentNode;
  return parent;
}

//________________________________________________________________________________
function FindSubSection( el )
{
  var parent = el.parentNode;
  var sections = parent.getElementsByTagName( "UL" );
  if (sections.count == 0)
  {
    return null;
  }
  else
  {
    return sections[0];
  }
}      


//________________________________________________________________________________
function Expand( el )
{
  var section;
  var subsection = FindSubSection( el );
  
  if (subsection == null)
  {
    el.src = loadingImg;
    
    // Subsection not attached yet. Go get it.                       
    var subsectionHtml = ajaxLoader( GetNodeRetrievalUrl( el ));
    
     // if we still don't have a subsection, change the image to empty
    if ((subsectionHtml == null) || (subsectionHtml.substr(0,4) != "<ul "))
    {
      el.src = emptyImg;
      return;
    }
    
    // We got one from the web site, so insert it.
    section = FindSection( el );
    section.innerHTML = section.innerHTML+subsectionHtml;
    var elements = section.getElementsByTagName( "UL" );
    subsection = elements[0];
    
    elements =  section.getElementsByTagName( "IMG" );
    el = elements[0];           
  }

  // open up the section and make it visible
  el.src = openImg;
  subsection.style.display ="block";
  subsection.style.visibility ="visible";
}

//________________________________________________________________________________
function Collapse( el )
{
  el.src = closedImg;
  var subsection = FindSubSection( el );
 
  if (subsection != null)
  {
    subsection.style.display ="none";
    subsection.style.visibility ="hidden";
  }
}
       





function DoSave(editorId, hfDataID, titleID, tDataID, headerID, saveID, cancelID, labelID,  lastTitle, tagTextBoxID, tagDataID, blockID)
{
  var editorObj = $find(editorId);
  var title = $get(titleID).value;
  var cont = editorObj.get_ModifiedContent();
  var label = $get(labelID);
  var tagTextBox = $get(tagTextBoxID);
  var tags = "";
  if (tagTextBox != null )
  {
	  tags = tagTextBox.value;
  }
  if(title == null || title.trim() == ""){
    label.style.display="";
    label.innerHTML = errEmptySubject;
    return false;
  }
  if(cont.trim() == ""
  || cont.trim() == '&nbsp;'
  || cont.trim() == "<br>"){
    label.style.display="";
    label.innerHTML = errEmptyContent;
    return false;
  }
  if (cont.trim() == editorObj.get_OriginalContent().trim()
   && title.trim() == lastTitle.trim()
   && tags.trim() == $get(tagDataID).value.trim()){
    label.style.display="";
    label.innerHTML = errSameContent;
    return false;
  }

  if( headerID!=null && headerID!="")
  {
    SwitchToView(headerID, editorId, titleID, saveID, cancelID, blockID);
  }
  
  $get(hfDataID).value = cont;
  $get(tDataID).value = title;
  $get(tagDataID).value = tags;
  return true;
}

function DoCancel(headerID, editorID, titleID, saveID, cancelID, labelID, blockID, hfDataID, tDataID){
  var label = $get(labelID);
  label.style.display="none";
  var bodyHF = $get(hfDataID);
  var titleHF = $get(tDataID);
  if ( bodyHF.value
    || titleHF.value )
  {
    $find(editorID).set_OriginalContent(bodyHF.value);
    $get(titleID).value = titleHF.value;
    bodyHF.value = "";
  }
  SwitchToView(headerID, editorID, titleID, saveID, cancelID, blockID);
}

function toggleEditUI(editorId, titleID, saveID, cancelID)
{   
    var titleLabel = $get(titleID);
    if (titleLabel)
    {
        if (titleLabel.style.display == "none")
            titleLabel.style.display = "block";
        else
            titleLabel.style.display = "none";
    }
    
    var saveButton = $get(saveID);
    if (saveButton)
    {
        if (saveButton.style.display == "none")
            saveButton.style.display = "";
        else
            saveButton.style.display = "none";
    }
    
    var cancelButton = $get(cancelID);
    if (cancelButton)
    {
        if (cancelButton.style.display == "none")
            cancelButton.style.display = "";
        else
            cancelButton.style.display = "none";
    }
}



function GetHistoryItems(btnLoad){
    var btn = $get(btnLoad);
    if(btn)
      //eval(btn.href)
      window.setTimeout(function() {eval(btn.href)},400);
}

function SwitchToEdit(headerID, inlineEditorID, titleID, saveID, cancelID, blockID, tagTextboxID, cpHistoryID)
{
  var tagEditor = TagEditor_GetControl(blockID,'panel');
  if ( tagEditor )
  {
  	tagEditor.style.display = "none";
  	var tagEditorTextbox = $get(tagTextboxID);
  	tagEditorTextbox.value = TagEditor_GetTags(blockID);
  }
  if ( cpHistoryID !== undefined )
  {
    var cpHistory = $find(cpHistoryID);
    cpHistory.set_Collapsed(true)
    var header =  $get(headerID);
    header.style.display = "none";
    header.parentNode.className = "wkViewerContainer_Edit";
  }
  try
  {
    $find(inlineEditorID).switchToEditMode();
    toggleEditUI(inlineEditorID, titleID, saveID, cancelID);
  }
  catch (e) {}
}

function SwitchToView(headerID, inlineEditorID, titleID, saveID, cancelID, blockID)
{
  var header =  $get(headerID);
  header.style.display = "block";
  header.parentNode.className="wkViewerContainer";

  $find(inlineEditorID).switchToViewMode();
  toggleEditUI(inlineEditorID, titleID, saveID, cancelID);

  var tagEditor = TagEditor_GetControl(blockID,'panel');
  if ( tagEditor )
  {
  	tagEditor.style.display = "";
  }
}

function wkItemHighlight(val,headerID,textID){
  var header = $get(headerID);
  var text = $get(textID);
  if(header.style.display == "none") val = false; // do not highlight in editMode
  if(val){
    header.className+="Hover";
    text.className+="Hover";
  }else{
    header.className = header.className.replace("Hover","");
    text.className = text.className.replace("Hover","");
  }
}




function wkScrollToView(elementID){
  $get(elementID).scrollIntoView();
  window.setTimeout("$get('"+elementID+"').focus()",0);
}

function wkAddNewItem(buttonID, newItemPanelID, editorID, titleID)
{
  if( $get(newItemPanelID).style.display == "block"){
      $get(newItemPanelID).scrollIntoView();
      window.setTimeout("$get('"+titleID+"').focus()",0);
    return;
  }
  $get(newItemPanelID).style.display = "block";
  $get(buttonID).className="ccAddLinkDisabled";
  $find(editorID).switchToEditMode();
  window.setTimeout("$get('"+titleID+"').focus()",0);
}

function wkRemoveNewItem(buttonID, newItemPanelID, editorID, labelID)

{
  $get(newItemPanelID).style.display = "none";
  $get(buttonID).className="ccAddLink";
  $get(buttonID).disabled = false;
  $get(labelID).innerHTML = "";
  $find(editorID).switchToViewMode();
}

function saveNewWikiItem(editorID, hfDataID, titleID, tDataID, labelID, newWikiItemPanelID, tagTextBoxID, tagDataID)
{
  var editorObj = $find(editorID);
  var title = $get(titleID).value;
  var cont = editorObj.get_ModifiedContent();
  var label = $get(labelID);
  var tagTextBox = $get(tagTextBoxID);
  var tags = "";
  if ( tagTextBox != null )
  {
  	tags = tagTextBox.value;
  }

  if(title == null || title.trim() == ""){
    label.innerHTML = errEmptySubject;
    return false;
  }
  if(cont.trim() == "" || cont.trim() == '&nbsp;'){
    label.innerHTML = errEmptyContent;
    return false
  }
  
  $get(hfDataID).value = cont;
  $get(tDataID).value = title;
  $get(titleID).value = title;
  $get(tagDataID).value = tags;
  editorObj.switchToViewMode();
  window.setTimeout(function(){$get(newWikiItemPanelID).style.display="none";},10);

  return true;
}

/*Fin Menu arriba*/


/*Scroller de noticias*/

//var pausecontent=new Array()
//
//pausecontent[0]='<a href="noticias/index.php?id=1"><br><em>Noticia 1</a>'
//pausecontent[1]='<a href="#"><br><em>Noticia 2</a>'
//pausecontent[2]='<a href="#"><br><em>Noticia 3</a>'
//pausecontent[3]='<a href="#"><br><em>Noticia 4</a>'
/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var pausecontent=new Array()
var pausecontent1=new Array()

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicatemouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
/*Fin Scroller de noticias*/

/*Visor de fotos MF*/
  // Funciones para el movimiento del Visor
    var fotos = new Array();   
  var moviendo = false;
    
  
      
  function strFoto(data, pos) {
    return '<a target="galeria" href="' + data[4] + '"><img hspace=5 class="foto" src="' + DirFotos(data[0], data[1]) + '" width=90 height=68 border="0"></a><br>' + data[2];
	
<!--	    return '<a href="' data[4] '); return false;">' + ''  +  data[4] + ' ></a><br>' + data[2];  -->
	
  }
  var visor_desde;
  var visor_hasta;
  function cargarvisor(paste, dif) {
    // Determina las 9 posiciones a dibujar del visor    
  	if (!dif) dif = 0;
  	  	   
    visor_desde = (primerafoto+dif)-2;  	
    if (visor_desde < 0) visor_desde = 0;
    
    visor_hasta = (primerafoto+dif)+7;
    if (visor_hasta > fotos.length) visor_hasta = fotos.length
    
    pos = ((primerafoto-visor_desde)*-100); // determina la posicion donde debe arrancar el visor
    
  	html = '<table border="0" cellpadding="0" cellspacing="0" id="visor" style="margin-left: ' + pos + 'px;"><tr>';
    for (f = visor_desde; f < visor_hasta; f++) {
      html += '<td class="df navtexto" style="font-family: Arial; font-size: 10px;" align="center">' + strFoto(fotos[f]) + '</td>';      
    }
    
    html += '</tr></table>';
      
    if (!paste) {
    	document.write(html);
    } else {
    	obj = document.getElementById('visor_content');
    	obj.innerHTML = html;    	
    }
  }
     
  function ObtenerPosicion() {    
    obj = document.getElementById("visor");
    posicion = obj.style.marginLeft;
    if (posicion == "") posicion = "0px";        
    posicion = parseInt(posicion.substr(0, posicion.length-2), 10);    
    return posicion;    
  }
  
  function mover(pixels) {
    obj = document.getElementById("visor");
            
    posicion = ObtenerPosicion()-pixels;    
    obj.style.marginLeft=posicion.toString()+'px';        
  }
  
  var posicion_limite;   
  function desplazar(pixeles) {
    posicion = ObtenerPosicion();
    if ((posicion_limite < (posicion-pixeles) && pixeles > 0) || (posicion_limite > (posicion-pixeles) && pixeles < 0)) {
      mover(pixeles);
      if (pixeles > 0)
        pixeles--;
      else
        pixeles++;      
            
      setTimeout("desplazar(" + pixeles + ");", 20);
    } else {
      obj = document.getElementById("visor");    
      obj.style.marginLeft=posicion_limite+'px';      
      
      // Controla donde queda ubicado
      if (primerafoto==0 && primermes==meses[0]) {
        begin();
      } else if (primerafoto==(fotos.length-5) && ultimomes==meses[meses.length-1]) {
        finish();
      } else {
        // Controla que se hayan cargado todas las imagenes
        obj = document.getElementById("visor");
        TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs        
        for (f = 0; f < TD.length; f++) {                    
          if (!TD[f].childNodes[0].childNodes[0].complete) {
            TD[f].innerHTML = "";
            TD[f].innerHTML = strFoto(fotos[visor_desde+f]);
          }          
        }
        
        // Habilita todos los botones del visor
        try {
        btn = document.getElementById('btn_previous');
        if (btn.style.visibility != 'visible') btn.style.visibility = 'visible';        
        btn = document.getElementById('btn_next');
        if (btn.style.visibility != 'visible' && primerafoto < (fotos.length-5)) btn.style.visibility = 'visible';        
        } catch (e) { }
        
        // Recarga la imagen del titulo por si se freno
        HeadReload();
      }      
      
      // Controla que si se esta a dos foto del mes anterior (siguiente temporalmente hablando), lo cargue
      if (primerafoto <= 5 && primermes < meses[0]) {      	      	      	
      	CargandoMes[array_search(meses, primermes)-1] = true;
        
      	VecesCargado = 0;
      	CargarMes(meses[array_search(meses,primermes)-1], "B");
      }
      
      // Controla que si se esta a dos foto del mes anterior (siguiente temporalmente hablando), lo cargue
      if (primerafoto >= (fotos.length-10) && ultimomes > meses[meses.length-1]) {
      	CargandoMes[array_search(meses,ultimomes)+1] = true;
      	
      	VecesCargado = 0;
      	CargarMes(meses[array_search(meses,ultimomes)+1], "A");
      }
      
      // Actualiza el link al calendario
      btn = document.getElementById('btn_calendar');
      btn.href = '/' + metroflog + '/calendar/' + (fotos[primerafoto][3]).substr(0,6);
      
      moviendo = false;      
    }
  }   
  
  var VecesCargado = 0;
  function CargarMes(mes, pos_foto) {
  	if (CargandoMes[array_search(meses, mes)] == true && VecesCargado < 3) {		    	
  		obj = document.createElement('SCRIPT');
		obj.setAttribute("type", "text/javascript");
		//obj.setAttribute("src", "http://ww2.metroflog.com/visor_js.php?uc=" + uc + "&ym=" + mes + "&date_format=" + date_format + "&pos=" + pos_foto);
		
		objDiv = document.getElementById('posJS_visor');
		objDiv.appendChild(obj);
		
		setTimeout("CargarMes(" + mes + ", '" + pos_foto + "');", 5000);  		
		VecesCargado++;
  	}
  }
  
  function begin() {     	
    obj = document.getElementById("visor");
    
    // vuelve al principio al visor
    obj.style.marginLeft = "0px";
    primerafoto=0;
    
    // Deshabilita el boton Anterior
    try {
    btn = document.getElementById('btn_previous');    
    btn.style.visibility = 'hidden';    
    
    // Habilita el boton Siguiente
    btn = document.getElementById('btn_next');    
    if (fotos.length > 5) btn.style.visibility = 'visible';    
    } catch (e) { }
    
    HeadReload();
  }
  function finish() {
    obj = document.getElementById("visor");
    
    // vuelve al principio al visor    
    primerafoto=(fotos.length-5);
    obj.style.marginLeft = ((primerafoto-visor_desde)*-100)+"px";
    
    // Deshabilita el boton Siguiente
    try {
    btn = document.getElementById('btn_next');
    btn.style.visibility = 'hidden';    
    
    // Habilita el boton de anterior
    btn = document.getElementById('btn_previous');
    if (fotos.length > 5) btn.style.visibility = 'visible';    
    } catch (e) { }
    
    HeadReload();
  }
  
  var cargandofoto_next = false;
  var cargandofoto_next_anim = false;
  function next() {        
  	// Controla que la proxima foto a mostrar ya se encuentre cargada  	
	if (!cargandofoto_next_anim) {
	  	cargandofoto_next = false;
		if (primerafoto+5 < fotos.length) {
			obj = document.getElementById("visor");
			TD = obj.childNodes[0].childNodes[0].childNodes;	    
			try {
				if (!TD[(primerafoto-visor_desde)+5].childNodes[0].childNodes[0].complete) cargandofoto_next = true;				
			} catch (e) {}
		}
	}
	
  	var pos_mes = array_search(CargandoMes, true, array_search(meses, ultimomes));  	  	
  	if (!moviendo && (pos_mes == -1 || (primerafoto+5) < fotos.length) && !cargandofoto_next) {
      if (primerafoto == 0)
      	posicion_limite = -100;      
      else
      	posicion_limite = -200;
      if (primerafoto < (fotos.length-5)) {             
      	moviendo = true;
      	frenar_mov = true;
        cargarvisor(true, 1);
      	primerafoto++;        
        desplazar(20);
      }
  	} else if (cargandofoto_next) {
  		if (!cargandofoto_next_anim) {
  			frenar_mov = false;
  			AnimacionCargando('next', false);
  			cargandofoto_next_anim = true;
  		}
  	} else if (pos_mes != -1 && (primerafoto+5) == fotos.length) {
    	frenar_mov = false;
  		AnimacionCargando('next', true);
    }    
  }
     
  var cargandofoto_prev = false;
  var cargandofoto_prev_anim = false;
  var frenar_mov = false;
  function previous() { 
	// Controla que la foto anterior a mostrar ya se encuentre cargada  	
	if (!cargandofoto_prev_anim) {
		cargandofoto_prev = false;
		if (primerafoto > 0) {
			obj = document.getElementById("visor");
			TD = obj.childNodes[0].childNodes[0].childNodes;	    
			try {
				if (!TD[(primerafoto-visor_desde)-1].childNodes[0].childNodes[0].complete) cargandofoto_prev = true;				
			} catch(e) { }
		}
	}
	
    var pos_mes = array_search(CargandoMes, true);
  	if (!moviendo && (pos_mes == -1 || meses[pos_mes] < primermes || primerafoto > 5) && !cargandofoto_prev) {
      if (primerafoto == 1)
      	posicion_limite = 0;
      else if (primerafoto == 2)
      	posicion_limite = -100;
      else
      	posicion_limite = -200;    
      if (primerafoto > 0) {              
      	moviendo = true;
      	frenar_mov = true;
        cargarvisor(true, -1);
      	primerafoto--;
        desplazar(-20);
      }
    } else if (cargandofoto_prev) {
  		if (!cargandofoto_prev_anim) {
  			frenar_mov = false;
  			AnimacionCargando('previous', false);
  			cargandofoto_prev_anim = true;
  		}
  	} else if (pos_mes != -1 && primerafoto == 5) {    	
    	frenar_mov = false;
  		AnimacionCargando('previous', true);
    }
  }
  
  var puntitos = "";
  var AnimacionCargando_activada = false;  
  function AnimacionCargando(btn_name, xmes) {   	  	  	
  	btn = document.getElementById('btn_'+btn_name); 	
  	  	
  	if (!xmes) {  		
  		if (btn_name == "next") {
	  		cargandofoto_next = false;
	  		if (primerafoto+5 < fotos.length) {
				obj = document.getElementById("visor");
				TD = obj.childNodes[0].childNodes[0].childNodes;	    
				try {
					if (!TD[(primerafoto-visor_desde)+5].childNodes[0].childNodes[0].complete) cargandofoto_next = true;				
				} catch (e) {}
	  		}
  		} else {
  			cargandofoto_prev = false;
	  		if (primerafoto > 0) {
				obj = document.getElementById("visor");
				TD = obj.childNodes[0].childNodes[0].childNodes;	    
				try {
					if (!TD[(primerafoto-visor_desde)-1].childNodes[0].childNodes[0].complete) cargandofoto_prev = true;				
				} catch(e) { }
			}
  		}
  	}
  	
  	if ((xmes && (array_search(CargandoMes, true) != -1 && ((btn_name == "next" && (primerafoto+5)==fotos.length) || (btn_name == "previous" && primerafoto==5)))) || (!xmes && ((btn_name == "next" && cargandofoto_next) || (btn_name == "previous" && cargandofoto_prev)))) {
  		puntitos = puntitos + ".";
		if (puntitos == "....") puntitos = "";
		espacios = "";
		for (i=puntitos.length; i < 3; i++) {
			espacios = espacios + "&nbsp;";
		}
		/*texto = strCargando2 + puntitos + espacios;
  		btn.innerHTML = texto;  */	
  		HeadReload();	
  		setTimeout("AnimacionCargando('" + btn_name + "', " + xmes + ")", 250);  		
	} /*else {		
		if (btn_name == 'next') {
			btn.innerHTML = text_siguiente + ' >';
			cargandofoto_next_anim = false;
			if (!frenar_mov) next();
		} else {
			btn.innerHTML = ' < ' + text_anterior;
			cargandofoto_prev_anim = false;
			if (!frenar_mov) previous();
		}
	}*/
  }
  
  // Funciones de seguridad para boton derecho
  function right(e) {    
    try {
    	if (e.preventDefault) e.preventDefault();
   	} catch (e) {}
    if ((navigator.appName == 'Netscape' && e.which == 3) || (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)) {
      alert(msg_botonderecho);
      return false;
    } else {
      return true;
    }
  }

  function trampa() {
    if(document.images) {
      for(i=0;i<document.images.length;i++) {
        document.images[i].onmousedown = right;
        if (navigator.appName == 'Microsoft Internet Explorer') document.images[i].onmouseup = right;
      }
    }
  }
  
  // Funcion que controla que todas las imagenes esten cargadas
  // Controla que se hayan cargado todas las imagenes  
  function ControlCargas() {	
	try {
	    obj = document.getElementById("visor");
	    TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
	    for (f = 0; f < TD.length; f++) {      
	      if (!TD[f].childNodes[0].childNodes[0].complete) {
	        TD[f].innerHTML = "";
	        TD[f].innerHTML = strFoto(fotos[visor_desde+f]);        
	      }
	    }
    } catch(e) {}    
    setTimeout("ControlCargas()", 10000);    
  }
  setTimeout("ControlCargas()", 10000);

  function DirFotos(ID, Key) {  
	IDt = "00000"+ID;
	IDt = IDt.substr(IDt.length - 6, 6);
		
	dir1 = IDt.substr(IDt.length - 3, 3);
	dir2 = IDt.substr(1, 2);
	dir3 = IDt.substr(0 ,1);
		
	pix = ID.toString().substr(ID.toString().length - 1, 1);	
	pix++;	
	
	if (ID.toString().length > 1) {
		pix_2 = ID.toString().substr(ID.toString().length - 2, 1);
		if (pix_2 >= 5) pix = pix + 10;
	}
	
	/*rootpath = "http://pic" + pix + ".metroflog.com/";	

	path = rootpath + "pictures/thumbnails";	
	
    uid = ID + "_" + Key;  
	return path + "/" + dir1 + "/" + dir2 + "/" + dir3 + "/" + uid + ".jpg";*/

	rootpath = "images/";	

	path = rootpath + "	";	
	
    uid = ID + Key;  
	return path + uid + ".gif";

  }
  
  function array_search(obj_array, search, start) {
	if (!start) start = 0;
  	for (s = start; s < obj_array.length; s++) {
		if (obj_array[s] == search) return s;
	}
	return -1;
  }
  
  // Porque algunos exploradores son una poronga
  function HeadReload() {
  	if ((navigator.appVersion).search('MSIE 6.0') != '-1') {  		
  		try {
  			obj = document.getElementById('img_header');
    		tmp_src = obj.src;
    		obj.src = '';
    		obj.src = tmp_src;
  		} catch(e) {}
  	}
  }

/*Fin Visor de fotos MF*/

/*Mapa del Sitio*/

function toggle(aID) {
		var listElt = document.getElementById(aID);
		listElt.style.display = ( listElt.style.display == "none" ) ? "block" : "none";
	}
	function toggleAll(willOpen) {
		var ulElems = document.getElementsByTagName("UL");
		for ( var i = 1; i < ulElems.length; i++ ) {
			ulElems[i].style.display = willOpen ? "block" : "none";
		}
	}

/*Fin Mapa del Sitio*/

/*Swap de Imagenes*/

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];}
}
/*Fin Swap de Imagenes*/


/********************INICIO LISTAS ACUERDOS*******************************************************************/

function validar1(cadena){
val = cadena.length;
  if(val > 0){
  			 sample.submit();
  }else{
  			alert('Debe Poner el  Nombre');		
			
  }
	return false;
}

function borrar_funcion()
{
if (confirm("Desea Borrar?")) {
}
else
{
return false
}	
}

//inicio funcion validar_garantia

function validar_garantia(){

if ( document.sample.equipo.value == "")
{
alert("El campo \"EQUIPO\" es obligatorio")
return false;
}
else
{//primer else
if (document.sample.marca.value == "" )
{
alert("El campo \"MARCA\" es obligatorio")
return false;
}
else
{//segundo else
if (document.sample.modelo.value == "")
{
alert("El campo \"MODELO\" es obligatorio")
return false;
}
else
{//tercer else
if (document.sample.entrega.value == "")
{
alert("El campo \"ENTREGA\" es obligatorio")
return false;
}

else
{//cuarto else
if (document.sample.recibe.value == "")
{
alert("El campo \"RECIBE\" es obligatorio")
return false;
}
else
{//quinto else
if (document.sample.provedor.value == "" && document.sample.sintesis.value == "")
{
alert("El campo \"PROVEEDOR\" es obligatorio")
return false;
}

else
{//sexto else
if (document.sample.status.value == "")
{
alert("El campo \"STATUS\" es obligatorio")
return false;
}

else
{//septimo else

if (document.sample.calendar.value == "")
{
alert("El campo \"FECHA (solo para el Status)\" es obligatorio")
return false;
}

else
{//octavo else

if (document.sample.calendar.value == "")
{
alert("El campo \"FECHA (solo para el Status)\" es obligatorio")
return false;
}

else
{//noveno else

if (document.sample.observaciones.value == "")
{
alert("El campo \"OBSERVACIONES\" es obligatorio")
return false;
}

else
{//decimo else

/*if (document.sample.trabajo1.value == "")
{
alert("El campo \"LUGAR\" es obligatorio")
return false;
}

else
{//onceavo else*/

if (document.sample.serie.value == "" || document.sample.inventario.value == "" )
{
alert("El campo \"No. SERIE\" y \"No. INVENTARIO\"es obligatorio")
return false;
}

if (confirm("Seguro Desea Guardar?")) {

}
else
{
return false
}

}//fin onceavo else
//}//fin decimo else
}//fin noveno else
}//fin octavo else

}//fin septimo else
}//fin sexto else
}//fin quinto else
}//fin cuarto else
}//fin tercer else

}//fin segundo else

}//fin primer else


} //fin funcion validar_garantia


function validar_no(cadena)
{
val1=cadena;
val=cadena.length;
if(val==1)
document.sample.no.value = "000"+val1;
if(val==2)
document.sample.no.value = "00"+val1;
if(val==3)
document.sample.no.value = "0"+val1;
if(val==4)
document.sample.no.value = val1;
}

function validar_noe(cadena)
{
val2=cadena;
va=cadena.length;
if(va==1)
document.sample.noe.value = "000"+val2;
if(va==2)
document.sample.noe.value = "00"+val2;
if(va==3)
document.sample.noe.value = "0"+val2;
if(va==4)
document.sample.noe.value = val2;
}

function validar_ano(cadena)
{
val=cadena.length;
if(val<4){
alert("Formato año 0000");
document.sample.ano.value =""; 
document.sample.ano.focus();
}
}

function validar_envio_modifica(){

if ( document.sample.tipo1.value == "")
{
alert(" LLene el campo Tipo")
return false;
}
else
{//primer else
if (document.sample.no.value == "" )
{
alert(" Llene el campo Numero")
return false;
}
else
{//segundo else
if (document.sample.ano.value == "")
{
alert(" Llene al campo Año")
return false;
}
else
{//tercer else
if (document.sample.asunto.value == "")
{
alert(" LLene el campo Asunto")
return false;
}

else
{//cuarto else
if (document.sample.resolucion.value == "")
{
alert(" LLene el campo Resolucion")
return false;
}
else
{//quinto else
if (document.sample.destino1.value == "" && document.sample.sintesis.value == "")
{
alert("Llene el campo Destino")
return false;
}

else
{//sexto else
if (document.sample.sintesis.value == "")
{
alert("Llene el campo Sintesis")
return false;
}

else
{//septimo else

if (confirm("Desea guardar los cambios?")) {

}
else
{
return false
}

}//fin septimo else

}//fin sexto else
}//fin quinto else
}//fin cuarto else
}//fin tercer else

}//fin segundo else

}//fin primer else


} //incio funcion validar_envio


function validar_envio(){

if ( document.sample.tipo1.value == "")
{
alert(" LLene el campo Tipo")
return false;
}
else
{//primer else
if (document.sample.no.value == "" )
{
alert(" Llene el campo Numero")
return false;
}
else
{//segundo else
if (document.sample.ano.value == "")
{
alert(" Llene al campo Año")
return false;
}
else
{//tercer else
if (document.sample.asunto.value == "")
{
alert(" LLene el campo Asunto")
return false;
}

else
{//cuarto else
if (document.sample.resolucion.value == "")
{
alert(" LLene el campo Resolucion")
return false;
}
else
{//quinto else
if (document.sample.destino1.value == "" && document.sample.sintesis.value == "")
{
alert("Llene el campo Destino")
return false;
}

else
{//sexto else
if (document.sample.sintesis.value == "")
{
alert("Llene el campo Sintesis")
return false;
}

else
{//septimo else

if (confirm("Seguro Desea Guardar?")) {

}
else
{
return false
}

}//fin septimo else

}//fin sexto else
}//fin quinto else
}//fin cuarto else
}//fin tercer else

}//fin segundo else

}//fin primer else


} //fin funcion validar_envio


/********************FIN LISTAS ACUERDOS*******************************************************************/
/********************modifica  LISTAS ACUERDOS*******************************************************************/


function envia2(pag){

    document.sample.action= pag 
    document.sample.submit() 
} 


function validar_borrar(f){
todos=document.getElementsByTagName('input');
for(x=0;x<todos.length;x++){
if(todos[x].checked){
var agree;
agree=confirm("Se va a Eliminar el registro.\n ESTA SEGURO?");

if(agree==true){
window.opener.location.reload();
 location.href=url;
}
return false;
}
}
alert("Al menos debes marcar 1");
return false;
}
function validar_modificar(f){
var agree;
agree=0;
todos=document.getElementsByTagName('input');
for(x=0;x<todos.length;x++){//for
if(todos[x].checked){//primer if 

agree=agree+1
}//fin primer else


}//fin for
	if(agree==1)
	{
	document.sample.target= "centro_lista_acuerdos"	 
    document.sample.action= "modificar_lista.php" 
    document.sample.submit()
	window.close()

	}
	else 
	{
		if(agree<1)
		{
		alert("Debe de marcar 1")
		}
		else
		{
			if(agree>1)
			{
			alert("Solo se puede marcar 1")
			}
		}
	}
}//fin funcion
function validar_modificar_aut(f){
var agree;
agree=0;
todos=document.getElementsByTagName('input');
for(x=0;x<todos.length;x++){//for
if(todos[x].checked){//primer if 

agree=agree+1
}//fin primer else


}//fin for
	if(agree==1)
	{
	document.sample.target= "centro_lista_acuerdos"	 
    document.sample.action= "modificar_lista_aut.php" 
    document.sample.submit()
	window.close()

	}
	else 
	{
		if(agree<1)
		{
		alert("Debe de marcar 1")
		}
		else
		{
			if(agree>1)
			{
			alert("Solo se puede marcar 1")
			}
		}
	}
}//fin funcion

function validar_modificar_garantia(f){
var agree;
agree=0;
todos=document.getElementsByTagName('input');
for(x=0;x<todos.length;x++){//for
if(todos[x].checked){//primer if 

agree=agree+1
}//fin primer else


}//fin for
	if(agree==1)
	{
	document.sample.target= "centro_lista_acuerdos"	 
    document.sample.action= "modificar.php" 
    document.sample.submit()
	window.close()

	}
	else 
	{
		if(agree<1)
		{
		alert("Debe de marcar 1")
		}
		else
		{
			if(agree>1)
			{
			alert("Solo se puede marcar 1")
			}
		}
	}
}//fin funcion

function validar_cambiar_status(f){
var agree;
agree=0;
todos=document.getElementsByTagName('input');
for(x=0;x<todos.length;x++){//for
if(todos[x].checked){//primer if 

agree=agree+1
}//fin primer else


}//fin for
	if(agree==1)
	{
	document.sample.target= "centro_lista_acuerdos"	 
    document.sample.action= "cambiar_status.php" 
    document.sample.submit()
	window.close()

	}
	else 
	{
		if(agree<1)
		{
		alert("Debe de marcar 1")
		}
		else
		{
			if(agree>1)
			{
			alert("Solo se puede marcar 1")
			}
		}
	}
}//fin funcion

function imprimir_reportes(){

	document.sample.target= "_blank"	 
    document.sample.action= "reportes.php" 
    document.sample.submit()
	
	
}//fin funcion


/********************FIN modifica  LISTAS ACUERDOS*******************************************************************/



/********************Inicio Consulta lista juzgados ****************************************************************/
function ini_lista_consulta()
{
document.sample.actor.disabled=false
document.sample.demandado.disabled=true
document.sample.actor_op.disabled=false
document.sample.actor_op.checked=true

document.sample.demandado_op.disabled=false
document.sample.demandado.value="NO APLICA"
document.sample.actor.value=""

}
function lista_consulta_general()
{
document.sample.partes.checked=false
document.sample.actor_op.checked=false
document.sample.demandado_op.checked=false
document.sample.actor.disabled=true
document.sample.demandado.disabled=true
document.sample.actor_op.disabled=true
document.sample.demandado_op.disabled=true


document.sample1.distrit.disabled=false
document.sample.juzgado.disabled=false
document.sample.no.disabled=false
document.sample.ano.disabled=false
document.sample.calendar.disabled=false
document.sample.demandado.value="NO APLICA"
document.sample.actor.value="NO APLICA"
document.sample.calendar.value=""
document.sample.no.value=""
document.sample.ano.value="2008"




}
function lista_consulta_parte()
{
document.sample1.general.checked=false
document.sample1.distrit.disabled=true
document.sample.juzgado.disabled=true
document.sample.no.disabled=true
document.sample.ano.disabled=true
document.sample.calendar.disabled=true

document.sample.actor_op.disabled=false
document.sample.demandado_op.disabled=false
document.sample.actor_op.checked=true
document.sample.demandado_op.checked=false
document.sample.actor.disabled=false
document.sample.demandado.disabled=true
document.sample.demandado.value="NO APLICA"
document.sample.actor.value=""
document.sample.calendar.value="00-00-0000"
document.sample.no.value="0000"
document.sample.ano.value="0000"

}
function lista_consulta_actor_op()
{
document.sample.demandado_op.checked=false
document.sample.demandado.value="NO APLICA"
document.sample.demandado.disabled=true
document.sample.actor.disabled=false
document.sample.actor.value=""

}
function lista_consulta_demandado_op()
{
document.sample.actor_op.checked=false
document.sample.actor.value="NO APLICA"
document.sample.actor.disabled=true
document.sample.demandado.disabled=false
document.sample.demandado.value=""

}

/********************Inicio Consulta lista juzgados ****************************************************************/



function valida_envio_consulta_lista()
{


if(document.sample.distrit.value=="" )
{
alert("Agrege El Distrito")
return false 
}
else
{
if(document.sample.juzgado.value == "" && document.sample.no.value =="" && document.sample.calendar.value==""  && document.sample.actor.value=="" && document.sample.tipo1.value=="")
{
alert("Llene al menos un campo para continuar con la búsqueda")
return false 
}
}
}
/********************FIN Consulta lista juzgados ****************************************************************/

/********************INICIO listas sala constitucional ****************************************************************/

function validar_noe_const(cadena)
{
val1=cadena;
val=cadena.length;
if(val==1)
document.sample.noe.value = "000"+val1;
if(val==2)
document.sample.noe.value = "00"+val1;
if(val==3)
document.sample.noe.value = "0"+val1;
if(val==4)
document.sample.noe.value = val1;
}
function validar_noj_const(cadena)
{
val1=cadena;
val=cadena.length;
if(val==1)
document.sample.noj.value = "000"+val1;
if(val==2)
document.sample.noj.value = "00"+val1;
if(val==3)
document.sample.noj.value = "0"+val1;
if(val==4)
document.sample.noj.value = val1;
}
function validar_not_const(cadena)
{
val1=cadena;
val=cadena.length;
if(val==1)
document.sample.not.value = "000"+val1;
if(val==2)
document.sample.not.value = "00"+val1;
if(val==3)
document.sample.not.value = "0"+val1;
if(val==4)
document.sample.not.value = val1;
}

/* INICIO .---- Juicio de Protección*/

function valida_envio_lista_jpdh()

{
		if(document.sample.id_tipo.value==4)	
		{			
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Juicio de Protección");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Síntesis del Acuerdo");
								return false	
								}	
								
							}
							
					}			
		}
	
	
		if(document.sample.id_tipo.value==5)	
		{
			
				if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Juicio de Protección");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Sintesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
						
			
	
		}
	
		if(document.sample.id_tipo.value==11)	
		{
			
			
				if(document.sample.noe.value=="")
					{
						alert("Ingrese el Número de Juicio de Protección");
						return false	
					}
					else
					{	   
						if(document.sample.tip_a.checked==false)
						{
						alert("Seleccione si es Directo o Indirecto");
						return false	
						}
						else
						{				
							if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}
							else
							{
									if(document.sample.not.value=="")
									{
									alert("Ingrese el Número de Toca");
									return false	
									}	
									
									else
									{
										
										if(document.sample.sintesis.value=="")
										{
										alert("Ingrese la Sintesis del Acuerdo");
										return false	
										}	
										
									}
									
							}
			
						}
		
					}
			
	
		}


}

/* FIN .---- Juicio de Protección*/


/* INICIO .---- Recurso de Inconformidad*/

function valida_envio_lista_rec_inconformidad()

{
		if(document.sample.id_tipo.value==7)	
		{	
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Recurso de Inconformidad");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Sintesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
		} 
}

/* FIN .---- Recurso de Inconformidad*/

/* INICIO .---- Acción por Omisión Legislativa*/

function valida_envio_lista_omision()

{
		if(document.sample.id_tipo.value==8)	
		{	
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Omisón Legislativa");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Sintesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
		} 
}

/* FIN .---- Recurso de Acción por Omisión Legislativa*/

/* INICIO .---- Duda de Ley*/

function valida_envio_duda()

{
		if(document.sample.id_tipo.value==6)	
		{	
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Expediente de duda de Ley");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Síntesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
		} 
}

/* FIN .---- Duda de Ley*/

/* INICIO .---- Acción de Inconstitucionalidad*/

function valida_envio_lista_accion()

{
		if(document.sample.id_tipo.value==9)	
		{	
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Acción de Inconstitucionalidad");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Sintesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
		} 
}

/* FIN .---- Acción de Inconstitucionalidad*/

/* INICIO .---- Controversias Constitucionales*/

function valida_envio_lista_controversia()

{
		if(document.sample.id_tipo.value==10)	
		{	
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Controversias Constitucionales");
				return false	
			}
			else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Sintesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
		} 
}

/* FIN .---- Controversias Constitucionales*/

/* INICIO .---- Excusas*/

function valida_envio_lista_excusas()
{
	if(document.sample.id_tipo.value==12)	
		{			
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Excusa");
				return false	
			}
			else
			{				
				if(document.sample.noj.value=="")
			    {
				alert("Ingrese el Número de Juicio");
				return false	
			    }
				else
				{				
					if(document.sample.not.value=="")
					{
					alert("Ingrese el Número de Toca");
					return false	
					}
					else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Síntesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
	
				}

			}
			
			
		}
	
		if(document.sample.id_tipo.value==13)	
		{
			
				if(document.sample.noe.value=="")
					{
						alert("Ingrese el Número de Toca");
						return false	
					}
					else
					{				
						if(document.sample.magdo.value=="")
						{
						alert("Seleccione el Magistrado");
						return false	
						}
						else
						{				
							if(document.sample.mp.value=="")
							{
							alert("Ingrese el Ministerio Público");
							return false	
							}
							else
							{
									if(document.sample.resolucion.value=="")
									{
									alert("Seleccione la Resolución");
									return false	
									}	
									
									else
									{
										
										if(document.sample.sintesis.value=="")
										{
										alert("Ingrese la Síntesis del Acuerdo");
										return false	
										}	
										
									}
									
							}
			
						}
		
					}
						
			
	
		}
	
		if(document.sample.id_tipo.value==14)	
		{
			
			
				if(document.sample.noe.value=="")
					{
						alert("Ingrese el Número de Cuadernillo Auxiliar");
						return false	
					}
					else
					{				
						if(document.sample.mp.value=="")
						{
						alert("Ingrese el Ministerio Público");
						return false	
						}
						else
						{				
							if(document.sample.delito.value=="")
							{
							alert("Ingrese el Delito");	
							return false	
							}
							else{
								if(document.sample.resolucion.value=="")
								{
								alert("Seleccione la Resolución");
								return false	
								}	
							
								else
								{
								
									if(document.sample.sintesis.value=="")
									{
									alert("Ingrese la Síntesis del Acuerdo");
									return false	
									}	
								}
										
									
									
							}
			
						}
		
					}
			
	
		}

}

/* FIN .---- Excusas*/


/* INICIO .---- Recurso de Queja*/

function valida_envio_lista_sala_const()

{
		if(document.sample.id_tipo.value==1)	
		{			
			if(document.sample.noe.value=="")
			{
				alert("Ingrese el Número de Cuadernillo de Amparo");
				return false	
			}
			else
			{				
				if(document.sample.anoj.value=="")
			    {
				alert("Ingrese el Número de Juicio de Amparo");
				return false	
			    }
				else
				{				
					if(document.sample.not.value=="")
					{
					alert("Ingrese el Número de Toca");
					return false	
					}
					else
					{
						 	if(document.sample.resolucion.value=="")
							{
							alert("Seleccione la Resolución");
							return false	
							}	
							
							else
							{
								
								if(document.sample.sintesis.value=="")
								{
								alert("Ingrese la Síntesis del Acuerdo");
								return false	
								}	
								
							}
							
					}
	
				}

			}
			
			
		}
	
		if(document.sample.id_tipo.value==2)	
		{
			
				if(document.sample.noe.value=="")
					{
						alert("Ingrese el Número de Toca");
						return false	
					}
					else
					{				
						if(document.sample.magdo.value=="")
						{
						alert("Seleccione el Magistrado");
						return false	
						}
						else
						{				
							if(document.sample.mp.value=="")
							{
							alert("Ingrese el Miniterio Publico");
							return false	
							}
							else
							{
									if(document.sample.resolucion.value=="")
									{
									alert("Seleccione la Resolución");
									return false	
									}	
									
									else
									{
										
										if(document.sample.sintesis.value=="")
										{
										alert("Ingrese la Síntesis del Acuerdo");
										return false	
										}	
										
									}
									
							}
			
						}
		
					}
						
			
	
		}
	
		if(document.sample.id_tipo.value==3)	
		{
			
			
				if(document.sample.noe.value=="")
					{
						alert("Ingrese el Número de Cuadernillo Auxiliar");
						return false	
					}
					else
					{				
										
							if(document.sample.mp.value=="")
							{
							alert("Ingrese el Agente del Ministerio Público");
							return false	
							}
							else
							{
									if(document.sample.resolucion.value=="")
									{
									alert("Seleccione la Resolución");
									return false	
									}	
									
									else
									{
										
										if(document.sample.sintesis.value=="")
										{
										alert("Ingrese la Síntesis del Acuerdo");
										return false	
										}	
										
									}
									
							}
			
						
		
					}
			
	
		}


}

/* FIN .---- Recurso de Queja*/

/********************FIN listas sala constitucional ****************************************************************/



/********************INICIO Captura lista sala ****************************************************************/

function validar_autorizar()
{	
if(confirm("Despues de Autorizada no Podra Modificar"))
{
	
}
else
{
return false
}
}
function listas_publicada_envia()
{	

	
/*	document.sample.target= "centro_lista_acuerdos"	 
    document.sample.action= "captura_lista.php" 
    document.sample.submit()
	window.close()*/
}
/********************FIN Captura lista sala ****************************************************************/

/********************INICIO Captura lista Tribunal Conciliacion y Arbitraje ****************************************************************/

function valida_envio_lista_trib_con_arb()
{
	if(document.sample.id_tipo.value=="")	
	{
	alert("Seleccione el Tipo");
	return false
	}
	else{
		if(document.sample.noe.value=="")	
		{
		alert("Seleccione el Numero");
		return false	
		}
		else{ 
			if(document.sample.anoe.value=="")	
			{
			alert("Seleccione el Año");
			return false	
			}
			else{
				if(document.sample.sintesis.value=="")	
				{
				alert("Ingrese la Sintesis del Documento");
				return false	
				}
			}
		}
	}
}

/********************FIN Captura lista Tribunal Conciliacion y Arbitraje ****************************************************************/


/********************Inicio Consulta lista salas ****************************************************************/
function ini_lista_consulta_sala()
{
document.sample.actor.disabled=false
document.sample.demandado.disabled=true

document.sample.actor_op.disabled=false
document.sample.actor_op.checked=true
document.sample.demandado_op.disabled=false
document.sample.demandado.value="NO APLICA"
document.sample.actor.value=""

}
function lista_consulta_general_sala()
{
document.sample.partes.checked=false
document.sample.actor_op.checked=false
document.sample.demandado_op.checked=false
document.sample.actor.disabled=true
document.sample.demandado.disabled=true
document.sample.actor_op.disabled=true
document.sample.demandado_op.disabled=true


document.sample.sala.disabled=false
document.sample.no.disabled=false
document.sample.ano.disabled=false
document.sample.calendar.disabled=false
document.sample.demandado.value="NO APLICA"
document.sample.actor.value="NO APLICA"
document.sample.calendar.value=""
document.sample.no.value=""
document.sample.ano.value="2008"




}
function lista_consulta_parte_sala()
{
document.sample.general.checked=false
document.sample.sala.disabled=true

document.sample.no.disabled=true
document.sample.ano.disabled=true
document.sample.calendar.disabled=true

document.sample.actor_op.disabled=false
document.sample.demandado_op.disabled=false
document.sample.actor_op.checked=true
document.sample.demandado_op.checked=false
document.sample.actor.disabled=false
document.sample.demandado.disabled=true
document.sample.demandado.value="NO APLICA"
document.sample.actor.value=""
document.sample.calendar.value="00-00-0000"
document.sample.no.value="0000"
document.sample.ano.value="0000"

}
function lista_consulta_actor_op_sala()
{
document.sample.demandado_op.checked=false
document.sample.demandado.value="NO APLICA"
document.sample.demandado.disabled=true
document.sample.actor.disabled=false
document.sample.actor.value=""

}
function lista_consulta_demandado_op_sala()
{
document.sample.actor_op.checked=false
document.sample.actor.value="NO APLICA"
document.sample.actor.disabled=true
document.sample.demandado.disabled=false
document.sample.demandado.value=""

}

/********************Inicio Consulta lista salas ****************************************************************/



function valida_envio_consulta_lista_sala()
{
	
if( document.sample.noe.value =="" && document.sample.no.value =="" && document.sample.calendar.value=="" && document.sample.sala.value=="" && document.sample.actor.value=="")
{
alert("Llene al menos un campo mas para continuar con la búsqueda")
return false 
}
}
/********************FIN Consulta lista salas ****************************************************************/

/********************Inicio Consulta Trib Conc Arb ****************************************************************/

function ini_lista_consulta_trib_con()
{
document.sample.actor.disabled=true
document.sample.demandado.disabled=true
document.sample.actor_op.disabled=true
document.sample.demandado_op.disabled=true
document.sample.demandado.value="NO APLICA"
document.sample.actor.value="NO APLICA"

}
function lista_consulta_general_trib_con()
{
document.sample.partes.checked=false
document.sample.actor_op.checked=false
document.sample.demandado_op.checked=false
document.sample.actor.disabled=true
document.sample.demandado.disabled=true
document.sample.actor_op.disabled=true
document.sample.demandado_op.disabled=true


document.sample.id_tipo.disabled=false
document.sample.no.disabled=false
document.sample.ano.disabled=false
document.sample.calendar.disabled=false
document.sample.demandado.value="NO APLICA"
document.sample.actor.value="NO APLICA"
document.sample.calendar.value=""
document.sample.no.value=""
document.sample.ano.value="2008"




}
function lista_consulta_parte_trib_con()
{
document.sample.general.checked=false
document.sample.id_tipo.disabled=true

document.sample.no.disabled=true
document.sample.ano.disabled=true
document.sample.calendar.disabled=true

document.sample.actor_op.disabled=false
document.sample.demandado_op.disabled=false
document.sample.actor_op.checked=true
document.sample.demandado_op.checked=false
document.sample.actor.disabled=false
document.sample.demandado.disabled=true
document.sample.demandado.value="NO APLICA"
document.sample.actor.value=""
document.sample.calendar.value="00-00-0000"
document.sample.no.value="0000"
document.sample.ano.value="0000"

}
function lista_consulta_actor_op_trib_con()
{
document.sample.demandado_op.checked=false
document.sample.demandado.value="NO APLICA"
document.sample.demandado.disabled=true
document.sample.actor.disabled=false
document.sample.actor.value=""

}
function lista_consulta_demandado_op_trib_con()
{
document.sample.actor_op.checked=false
document.sample.actor.value="NO APLICA"
document.sample.actor.disabled=true
document.sample.demandado.disabled=false
document.sample.demandado.value=""

}


function valida_envio_consulta_lista_trib_con_alb()
{
if(document.sample.partes.checked==true)
{
if(document.sample.actor.value=="")
{
alert("Llene el Campo habilitado para continuar con la búsqueda")
return false
}
if(document.sample.demandado.value=="")
{
alert("Llene el Campo habilitado para continuar con la búsqueda")
return false
}
}
if(document.sample.general.checked==true)
{
if(document.sample.id_tipo.value == "")
{ alert("Seleccione el Tipo") 
return false
}
else
{	
if( document.sample.no.value =="" && document.sample.calendar.value=="" )
{
alert("Llene al menos un campo mas para continuar con la búsqueda")
return false 
}
}
}

}
/********************FIN Consulta lista Trib Conc Arb ****************************************************************/



/********************Abrir Popup Modal ****************************************************************/

function abrirModal(pagina)
                {
                    var vReturnValue;
                    
                    
                    //if(navigator.userAgent.indexOf("MSIE 5") >= 0)                    
                        vReturnValue = window.showModalDialog(pagina,"","dialogHeight: 600px; dialogWidth:500	px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
                    //else               
                    //    vReturnValue = window.popup(pagina,"","dialogHeight: 280px; dialogWidth: 300px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
                    
                    if(vReturnValue != null && vReturnValue == true)
                    {
                       __doPostBack('BtnBuscar','');
                        return vReturnValue    
                    }
                 /*   else
                    {                           
                        return false;
                    }*/
                }
				
				
/********************Fin Popup Modal ****************************************************************/				


/********************Desplegar Contenido ****************************************************************/				

// definiciones basicas
OCULTO="none";
VISIBLE="block";
function mostrar(blo) {
document.getElementById(blo).style.display=VISIBLE;
document.getElementById('ver_off').style.display=VISIBLE;
document.getElementById('ver_on').style.display=OCULTO;
}
function ocultar(blo) {
document.getElementById(blo).style.display=OCULTO;
document.getElementById('ver_off').style.display=OCULTO;
document.getElementById('ver_on').style.display=VISIBLE;
}
/********************Fin Popup Modal ****************************************************************/				

/********************Carga pagina ajax  ****************************************************************/				


function llamarasincrono(url, id_contenedor){
	
var pagina_requerida = false
if (window.XMLHttpRequest) {// Si es Mozilla, Safari etc
pagina_requerida = new XMLHttpRequest()
} else if (window.ActiveXObject){ // pero si es IE
try {
pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){ // en caso que sea una versión antigua
try{
pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
pagina_requerida.onreadystatechange=function(){ // función de respuesta
cargarpagina(pagina_requerida, id_contenedor)
}
pagina_requerida.open('POST', url, true) // asignamos los métodos open y send
pagina_requerida.send(null)
}
// todo es correcto y ha llegado el momento de poner la información requerida
// en su sitio en la pagina xhtml
function cargarpagina(pagina_requerida, id_contenedor){
if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(id_contenedor).innerHTML=pagina_requerida.responseText
}

/********************fin carga pagina ajax ****************************************************************/				

function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
/*********************************************************************************/
/************************ Funcion que llama al archivo consulta.php pasando estos valores &idciudad="+idciudad como si fuera por url**************/
function lamar_asunto_radicado(){
  materia = document.getElementById('materia').value;//obtenemos el valor de select ciudad
	divResultado = document.getElementById('combo_sala');// obtenemos el objeto doden va a ser impreso el resultado que es el div combo
	ajax= objetoAjax();// creamo el objeto ajax o inicializamos
	ajax.open("POST", "archivos/fraccion_viii/consulta_salas.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			// result es lo que nos devuelve el objeto ajax.responseText, que es lo que imprimimos en el archivo consulta.php		
			result = ajax.responseText;		
			//divResultado es el div reservado para mostrar el resultado			
			  divResultado.innerHTML = result;
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
// aqui agregamos las variables que vamos a pasar al archivo que llamemos en ajax.open como si fueran pasadas por URL
	ajax.send("&materia="+materia);
}
/////////////////////////////////////////////////////////////////////////////////////////

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_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_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 modales(mod){
/*window.parent.document.getElementById('moda_es').innerHTML = '<input  id="moda9" value="moda9" name="moda9" alt="directorio/busqueda_nombre.php?keepThis=true&TB_iframe=true&height=230&width=650"  class="thickbox" type="button"  border="0" style="background:#FFFFFF; border-color:#FFFFFF " />'
*/
window.parent.document.getElementById(mod).click();
}

function modales1(mod,ids){

/*window.parent.document.getElementById('moda_es').innerHTML = '<input  id="moda9" value="moda9" name="moda9" alt="directorio/busqueda_nombre.php?keepThis=true&TB_iframe=true&height=230&width=650"  class="thickbox" type="button"  border="0" style="background:#FFFFFF; border-color:#FFFFFF " />'
*/
//window.parent.document.getElementById(mod).value=ids;
window.parent.document.getElementById(mod).click();
}


 function modalesPagWeb(mod,id){

window.parent.document.getElementById('pagB').innerHTML = '<input  id="ver_sent1" title="Pagina Web" name="ver_sent" alt="verpaginas.php?keepThis=true&TB_iframe=true&height=600&width=700" class="thickbox" value="'+id+'"  border="0" style="background:#FFFFFF; border-color:#FFFFFF " />'

window.parent.document.getElementById(mod).click();
}
 function modalesInf2010(){

/*window.parent.document.getElementById('moda_es').innerHTML = '<input  id="moda9" value="moda9" name="moda9" alt="directorio/busqueda_nombre.php?keepThis=true&TB_iframe=true&height=230&width=650"  class="thickbox" type="button"  border="0" style="background:#FFFFFF; border-color:#FFFFFF " />'
*/
window.parent.document.getElementById('spots').click();
}

function modales4(mod,ids)
{
	window.document.getElementById(mod).alt ='comentario.php?z='+ids+'&keepThis=true&TB_iframe=true&height=180&width=400';
	window.document.getElementById('cap_com').click();

}


function modales3(mod,ids)
{
	window.document.getElementById(mod).alt ='comentario_regresa.php?z='+ids+'&keepThis=true&TB_iframe=true&height=180&width=400';
	window.document.getElementById('cap_com').click();

}







