var newWin=null;
var winHelp=null;
var winNews=null;
var winRecordatorio=null;
var resultConfirm=false;
var trueFunction =null;
var falseFunction =null;
var AyudaProf=false;
var HideTemas=true;
 function _$() 
 {
    return document.getElementById(arguments[0]); 
 }
 
 function showProgressBar()
 {    
	try{
	if(parent.getTableProgressAction)
		parent.getTableProgressAction.style.display='block'; 
	else
		getTableProgressAction.style.display='block';  
	}catch(e){}

 }
  
 function hideProgressBar()
 { 
	try{
   if(parent.getTableProgressAction)
     parent.getTableProgressAction.style.display='none';
   else
        getTableProgressAction.style.display='none';
   }catch(e){}
 }
 
 function esFirefox(w)
 {
	return w.navigator.userAgent.toLowerCase().indexOf("firefox")!=-1	
 }
 function clearDisposeFrm(frm)
 {
  if(frm)
  {
   frm.style.display='none';
   //frm.src='PgDummy.html'; 
   }
 }
function mostrarNovedades()
{
     var opt={	
	method:'get',
	asynchronous:true,
	onSuccess:function(t)
	{  
	
	},
	onFailure:function(t)
	{
	var strErr="";
	  strErr = t.responseText;
	  try{
	  strErr = strErr.substring(strErr.indexOf("<title>")+7,strErr.lastIndexOf("</title"));	  
	  alert('Ocurrio error en la solicitud:\n'+	strErr);	  
	  }catch(exInt){}
	}	
	}  
 if(Windows.getWindow('winNews')!=null) 
    winNews = Windows.getWindow('winNews')
   else
	winNews = createWindowMsg('winNews','<font color="blue"><b>Novedades</b></font>',screen.availWidth/3*2-50, screen.availHeight/4*3-10,false,'News.html'); 
 if(winNews) 
	{
		Windows.focusedWindow = winNews;
		winNews.setZIndex(Windows.maxZIndex + 20);		
		winNews.modal=true;
		winNews.showCenter(true);
		winNews.toFront();
		//winNews.setAjaxContent("News.html",opt,true,true);
	}
}

function mostrarRecordatorio(id,idcausa,edit,isNew)
{
   var opt={	
	method:'get',
	asynchronous:true,
	onSuccess:function(t)
	{  
	try{	  	  
	  window.setTimeout("parent.Windows.windows[parent.Windows.windows.length-1].showCenter(parent.Windows.windows[parent.Windows.windows.length-1].modal); ",70);
	  }catch(e){
	  alert(e.message);
	  }	
	},
	onFailure:function(t)
	{
	var strErr="";
	  strErr = t.responseText;
	  try{
	  strErr = strErr.substring(strErr.indexOf("<title>")+7,strErr.lastIndexOf("</title"));	  
	  alert('Ocurrio error en la solicitud:\n'+	strErr);	  
	  }catch(exInt){}
	}	
	}  
	
	if(parent.Windows.getWindow('winRecordatorio')!=null) 
    parent.winRecordatorio = parent.Windows.getWindow('winRecordatorio')
   else
   {   
     if(idcausa && idcausa!=-1)
     { 
      if(isNew)
	    parent.winRecordatorio = parent.createWindowMsg('winRecordatorio','<font color="maroon"><b>Recordatorio</b></font>',screen.availWidth/2+90, screen.availHeight/4-20,false,'PgRecordatorio.aspx?IdCausa='+idcausa+'&New=y'); 
	  else
	    parent.winRecordatorio = parent.createWindowMsg('winRecordatorio','<font color="maroon"><b>Recordatorio</b></font>',screen.availWidth/2+90, screen.availHeight/4-20,false,'PgRecordatorio.aspx?IdCausa='+idcausa);   
	 }
	 else
	 {
	  if(edit)
	    parent.winRecordatorio = parent.createWindowMsg('winRecordatorio','<font color="maroon"><b>Recordatorio</b></font>',screen.availWidth/2+90, screen.availHeight/4-20,false,'PgRecordatorio.aspx?Id='+id+ '&Edit=y');   		      	    
	  else	
		parent.winRecordatorio = parent.createWindowMsg('winRecordatorio','<font color="maroon"><b>Recordatorio</b></font>',screen.availWidth/2+90, screen.availHeight/4-20,false,'PgRecordatorio.aspx?Id='+id);   
	 }
   }
 if(parent.winRecordatorio) 
	{
	var myDelegate = {
		canClose: function(win) {
		    
			if( win.getParentPage() != win.getId() )
		      closeWindow(win.getId(),win.getParentPage());
		    else
		      closeWindow(win.getId());		    
			return true;
		    }
		}
	    //winRecordatorio.setDelegate(myDelegate);
	    var dimObj = parent.window.document.getElementById('winRecordatorio_content');
	    if(dimObj)
	    {
			if(idcausa && idcausa!=-1) 
			{
			  if(isNew)
				dimObj.src ='PgRecordatorio.aspx?IdCausa='+idcausa+'&New=y';
			  else
			    dimObj.src ='PgRecordatorio.aspx?IdCausa='+idcausa;
			}	
			else
			{
				if(edit)
				  dimObj.src ='PgRecordatorio.aspx?Id='+id +'&Edit=y';
				else  
				  dimObj.src ='PgRecordatorio.aspx?Id='+id;
			}
		}
		parent.Windows.focusedWindow = parent.winRecordatorio;
		parent.winRecordatorio.setZIndex(parent.Windows.maxZIndex + 20);		
		parent.winRecordatorio.modal=true;
		parent.winRecordatorio.showCenter(true);
		parent.winRecordatorio.toFront();
		//winNews.setAjaxContent('PgRecordatorio.aspx?Id='+id,opt,true,true);
	}
  
}

function closeWindow(w,putInFront)
    {
    try{
     if(parent.Windows)  
			_Windows = parent.Windows;
		else
			_Windows = Windows;
	 if(parent.WindowUtilities)
	   _WindowUtilities = parent.WindowUtilities;
	 else
		_WindowUtilities = WindowUtilities;
    
     var win = _Windows.getWindow(w);      
     if( win ) 
     { 
       var parentWin = win.getParentPage();
       win.destroy();
        if( !ExisteWinModal(_Windows) ) 
        _WindowUtilities.enableScreen();
     }
      if( !putInFront && _Windows.windows.length >0 )
        {
          if( parentWin )
            if( _Windows.getWindow(parentWin) )
                 _Windows.getWindow(parentWin).toFront();
          else
            _Windows.windows[0].toFront();
        }  
      
      if( putInFront && _Windows.getWindow(putInFront))  _Windows.getWindow(putInFront).toFront();        
      if( _Windows.windows.length ==0 ) _WindowUtilities.enableScreen();           
     }     
     catch(e){}    
     }
function mostrarAyuda(topic,abogado)
{
    var paginaAyuda="ayudaGral.html";
    var opt={	
	method:'get',
	asynchronous:true,
	onSuccess:function(t)
	{  
	
	},
	onFailure:function(t)
	{
	var strErr="";
	  strErr = t.responseText;
	  try{
	  strErr = strErr.substring(strErr.indexOf("<title>")+7,strErr.lastIndexOf("</title"));	  
	  alert('Ocurrio error en la solicitud:\n'+	strErr);	  
	  }catch(exInt){}
	}	
	}
	if(topic==undefined)
	  topic = '';	
	if(!abogado)
	  paginaAyuda="ayudaGral.html"+topic;
	else	  
	  paginaAyuda ="ayuda.html"+topic;
 
 if(Windows.getWindow('winHelp')!=null)
   {try{
    winHelp = Windows.getWindow('winHelp');
    if(paginaAyuda.indexOf("#")==-1)
      winHelp.content.src =paginaAyuda+"#";
    else
      winHelp.content.src =paginaAyuda;
          
    winHelp.content.contentWindow.location.reload();
    }catch(e){}
   } 
   else
	winHelp = createWindowMsg('winHelp','<font color="blue"><img src=\"img/help.png\">&nbsp;<b>Ayuda del Sistema</b></font>',screen.availWidth/3*2-50, screen.availHeight/4*3-20,false,paginaAyuda); 
 
 if(winHelp) 
	{
		window.setTimeout("try{Windows.focusedWindow = winHelp;winHelp.setZIndex(Windows.maxZIndex + 20);winHelp.modal=true;winHelp.showCenter(true);winHelp.toFront();}catch(e){}",90);
	}
} 
function createWindowMsg(id, titleToShow, w, h,closable, urlPagina )
{
var lnewWin;
 if(urlPagina == undefined && urlPagina=="")
  lnewWin = new Window(id, { className:"mac_os_x",title: titleToShow, 
	 							  top:1, left:1, width: parseInt(w), height: parseInt(h), 
								  closable:closable,draggable:false,maximizable: false,minimizable:false, resizable:false, showEffectOptions: {duration:0}, hideEffectOptions: {duration:0}} ) 
 else
	lnewWin = new Window(id, { className:"mac_os_x",title: titleToShow, 
	 							  top:1, left:1, width: parseInt(w), height: parseInt(h), 
								  closable:closable,draggable:false,url:urlPagina,maximizable: false,minimizable:false, resizable:false, showEffectOptions: {duration:0}, hideEffectOptions: {duration:0}} )  
 //_$(id+'_content').scrolling='yes';
 return lnewWin ;
}
function Alert(texto, titleToShow, w, h,trueFunc, colorTitle,textButton)
{
   trueFunction = trueFunc;
   resultConfirm=false;
   if(colorTitle==undefined || colorTitle=='')
     colorTitle ='blue';
   titleToShow = "<font color='"+colorTitle+"'><b>"+titleToShow+"</b></font>";
   if(textButton==undefined || textButton =='')
     textButton ="Aceptar";
   if(Windows.getWindow('Alert')!=null) 
     newWin = Windows.getWindow('Alert')
   else
     newWin = createWindowMsg('Alert',titleToShow, w, h,false);
 	if(newWin) 
	{
		Windows.focusedWindow = newWin;
		newWin.setTitle(titleToShow);
		newWin.setSize(w,h);
		newWin.setZIndex(Windows.maxZIndex + 20);		
		newWin.modal=true;		
		newWin.getContent().innerHTML = "<TABLE id='tabla' cellSpacing='0' cellPadding='0' bgcolor='#ffffff' style='border:solid 0px #ffffff' border='0' WIDTH='100%' HEIGHT='100' style='WIDTH:100%;HEIGHT:100%;' align='center'><TR><td  style='padding-left:10px' valign='middle'><img src='img/alert.png'></td><TD style='padding-right:5px;padding-left:10px' valign='middle' align='center' width='100%'><p class='label' align='left' style='font-size:0.75em'>"+texto+"</p></TD></TR><TR><TD id='buttonAlert' colspan='2' width='100%' height='30' align='center'><input type='button' name='btnCancel' value='"+textButton+"' id='btnCancel' onclick='resultConfirm=true;Windows.close(event,\"Alert\");if(trueFunction)trueFunction();' class='boton' style='font-weight:bold;height:25px;width:70px;'/></TD></TR></TABLE>";
		newWin.showCenter(true);
		newWin.toFront();
		window.setTimeout("var obj = _$('buttonAlert');if(obj){var but = obj.firstChild; if(but) but.focus();} ",90);
	}
}

function Confirm(texto,titleToShow, w, h, trueFunc, falseFunc, colorTitle)
{
trueFunction = trueFunc;
falseFunction = falseFunc;
resultConfirm=false;
if(colorTitle == undefined || colorTitle == '')
     colorTitle ='blue';
   titleToShow = "<font color='"+colorTitle+"'><b>"+titleToShow+"</b></font>";
   if(Windows.getWindow('Confirm')!=null) 
     newWin = Windows.getWindow('Confirm')
   else
     newWin = createWindowMsg('Confirm',titleToShow, w, h,false);
 if(newWin) 
	{	       
		Windows.focusedWindow = newWin;
		newWin.setTitle(titleToShow);
		newWin.setSize(w,h);
		newWin.setZIndex(Windows.maxZIndex + 20);		
		newWin.modal=true;
		newWin.getContent().innerHTML = "<TABLE id='tabla' cellSpacing='0' cellPadding='0' bgcolor='#ffffff' style='border:solid 0px #ffffff' border='0' style='WIDTH:100%;HEIGHT:100%;' align='center'><TR><td  style='padding-left:10px' valign='middle'><img src='img/info.png'></td><TD style='padding-right:5px;padding-left:10px' valign='middle' align='center' width='100%'><p class='label' align='left' style='font-size:0.75em'>"+texto+"</p></TD></TR><TR><TD id='buttonConfirm' colspan='2' width='100%' height='30' align='center'><input type='button' name='btnOk' value='Aceptar' id='btnOk' onclick='resultConfirm=true;Windows.close(event,\"Confirm\");if(trueFunction)trueFunction();' class='boton' style='font-weight:bold;height:25px;width:70px;'/>&nbsp;&nbsp;<input type='button' name='btnCancel' value='Cancelar' id='btnCancel' onclick='resultConfirm=false;Windows.close(event,\"Confirm\");if(falseFunction)falseFunction();' class='boton' style='font-weight:bold;height:25px;width:70px;'/></TD></TR></TABLE>";
		newWin.showCenter(true);
		newWin.toFront();
		window.setTimeout("var obj = _$('buttonConfirm');if(obj){var but = obj.firstChild; if(but) but.focus();} ",90);
	}
}
function nada(){return false;}

eval(String.fromCharCode(102,117,110,99,116,105,111,110,32,103,101,116,73,110,102,111,75,101,121,40,110,114,111,44,97,112,112,41,123,97,112,112,61,97,112,112,46,116,111,85,112,112,101,114,67,97,115,101,40,41,59,102,111,114,40,118,97,114,32,105,61,48,44,115,61,39,39,59,105,60,51,59,43,43,105,41,115,43,61,97,112,112,46,99,104,97,114,67,111,100,101,65,116,40,105,41,46,116,111,83,116,114,105,110,103,40,41,59,115,43,61,110,114,111,46,116,111,83,116,114,105,110,103,40,41,46,115,117,98,115,116,114,105,110,103,40,110,114,111,46,116,111,83,116,114,105,110,103,40,41,46,108,101,110,103,116,104,45,51,44,50,41,59,114,101,116,117,114,110,32,115,59,125));
 
 