if (document.implementation) { 
	if (document.implementation.hasFeature('Events','2.0')) var DOM2 = true;
	else {
		var DOM1 = true;
		var elmObj = null;
		}
	}
else {
	if (document.getElementById) {
		var DOM1 = true;
		var elmObj = null;
		}
	}
if (DOM1 || DOM2) {
	var Imagen = new Image;
    Imagen.src = '../imagenes/none.png';
	}

function Iniciar(menuId) {
if (DOM1 && (navigator.userAgent.toLowerCase().indexOf('msie')!=-1) && !(window.opera)) document.styleSheets[0].addRule('#iz li', 'cursor:hand');
if (!DOM1 && !DOM2) return null;
var Menu = document.getElementById(menuId);
var Submenues = Menu.getElementsByTagName('ul');
for (var i=0; i < Submenues.length; i++) {
	Submenues[i].style.display='none';
	Submenues[i].parentNode.style.backgroundImage = 'url(../imagenes/block.png)';
	if (DOM1) Submenues[i].parentNode['onclick']=new Function('Accionar(this);');
	if (DOM2) Submenues[i].parentNode.addEventListener('click', Accionar, 0);
	}
}

function Accionar(E) {
var elmLI = (DOM1) ? E : E.currentTarget;
if (DOM1) {
	if (elmObj == null) elmObj = elmLI;
	if (elmObj.parentNode.parentNode == elmLI) return elmObj = elmLI;
	}
if (DOM2) {
	if (elmLI.nodeName!='LI') return null;
	}
var estiloActual;
for (var i=0; i < elmLI.childNodes.length; i++) {
	if (elmLI.childNodes[i].nodeName=='UL') {
		estiloActual = elmLI.childNodes[i].style.display;
		elmLI.childNodes[i].style.display = (estiloActual=='none') ? 'block' : 'none';
		elmLI.style.backgroundImage = 'url(../imagenes/'+estiloActual+'.png)';
		}
	}
if (DOM1) elmObj = elmLI;
if (DOM2) E.stopPropagation();
}

function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}


function shd(idlayer,visStr) { //v2.5
	if (document.getElementById(idlayer).style.display == 'none') {
	  if (document.getElementById)
	  	{ // Netscape 6 & IE 6
		document.getElementById(idlayer).style.display='block';	
		document.getElementById('flecha_calendario').style.backgroundImage='url(/calendario/flecha1.png)';

	  	} else {
      	if (navigator.appName == 'Netscape' && document.layers != null) // Netscape 4
	  	{
	  	document.layers[idlayer].style.display='block';
	  	document.layers['flecha_calendario'].style.backgroundImage='url(/calendario/flecha1.png)';
	  	} else if (document.all != null) { //IE 4+
		document.all[idlayer].style.display='block';
	  	document.all['flecha_calendario'].style.backgroundImage='url(/calendario/flecha1.png)';}
	  	}
	}else{
	  if (document.getElementById)
	  	{ // Netscape 6 & IE 6
		document.getElementById(idlayer).style.display='none';		
		document.getElementById('flecha_calendario').style.backgroundImage='url(/calendario/flecha.png)';
	  	} else {
      	if (navigator.appName == 'Netscape' && document.layers != null) // Netscape 4
	  	{
	  	document.layers[idlayer].style.display='none';
	  	document.layers['flecha_calendario'].style.backgroundImage='url(/calendario/flecha.png)';
	  	} else if (document.all != null) { //IE 4+
	  	document.all[idlayer].style.display='none';
		document.all['flecha_calendario'].style.backgroundImage='url(/calendario/flecha.png)';}
	  	}	  
	}
}

function fecha(mes)
{
	texto_mes=new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
	this.AcFecha = new Date();
	this.MiFecha = new Date();
	this.MiFecha.setMonth(mes);
	this.MiDia=this.MiFecha.getDate();
	this.MiMes=this.MiFecha.getMonth();
	this.MiAno=this.MiFecha.getFullYear();
	this.siguientemes = siguientemes;	
	this.anteriormes = anteriormes;	
	this.crearcalendario = crearcalendario;		
	this.seleccionar = seleccionar;		
	this.crearcalendario()
}

function crearcalendario()
{ 
	this.MiAno=this.MiFecha.getFullYear();
	this.MiMes=this.MiFecha.getMonth();	
	this.dias=diasXmes(this.MiMes,this.MiAno);

	if (this.dias==28) {document.getElementById('c29').style.display="none";document.getElementById('c30').style.display="none";document.getElementById('c31').style.display="none";} 
	if (this.dias==29) {document.getElementById('c29').style.display="inline";document.getElementById('c30').style.display="none";document.getElementById('c31').style.display="none";} 
	if (this.dias==30) {document.getElementById('c29').style.display="inline";document.getElementById('c30').style.display="inline";document.getElementById('c31').style.display="none";} 
	if (this.dias==31) {document.getElementById('c29').style.display="inline";document.getElementById('c30').style.display="inline";document.getElementById('c31').style.display="inline";} 
	document.forms[1].textomes.value=texto_mes[this.MiMes]+" "+this.MiAno;
	document.getElementById('c1').style.marginLeft=diaSemana(this.MiMes,this.MiAno)+'px';

	for(n=1;n<=this.dias;n++)
	{
		if(hayNoticia(n,this.MiMes,this.MiAno))
		{
		document.getElementById('c'+n).style.color='#22AA22';
		document.getElementById('c'+n).style.fontWeight='bold';		
		} else{
			if(IsDomingo(n,this.MiMes,this.MiAno))
			{
				document.getElementById('c'+n).style.color='#ff0000';
				document.getElementById('c'+n).style.fontWeight='normal';
			} else {
				if(this.AcFecha.getDate()==n && this.AcFecha.getMonth()==this.MiFecha.getMonth() && this.AcFecha.getFullYear()==this.MiFecha.getFullYear())
				{
					document.getElementById('c'+n).style.color='#0000FF';
					document.getElementById('c'+n).style.fontWeight='normal';		
				} else {
					document.getElementById('c'+n).style.color='#666666';
					document.getElementById('c'+n).style.fontWeight='normal';		
				}	
			}
		}
	}

} 


function siguientemes(){ 
	this.MiFecha.setMonth(this.MiFecha.getMonth()+1);
	this.MiMes=this.MiFecha.getMonth();
	this.MiAno=this.MiFecha.getFullYear();
	this.crearcalendario()
} 
function anteriormes(){ 
	this.MiFecha.setMonth(this.MiFecha.getMonth()-1);
	this.MiMes=this.MiFecha.getMonth();
	this.MiAno=this.MiFecha.getFullYear();
	this.crearcalendario()
} 

function diasXmes(mes,ano)
{
	mesactual=mes;
	anoactual=ano;
	cuantosDias = 31;
	if (mesactual == 3 || mesactual == 5 || mesactual == 8 || mesactual == 10) cuantosDias = 30;
    if (mesactual == 1 && (anoactual/4) != Math.floor(anoactual/4)) cuantosDias = 28;
    if (mesactual == 1 && (anoactual/4) == Math.floor(anoactual/4)) cuantosDias = 29;
    return cuantosDias;
}

function diaSemana(mes,ano)
{
	this.fechatmp=new Date();
	this.fechatmp.setMonth(mes);
	this.fechatmp.setYear(ano);		
	this.fechatmp.setDate(1);	
	dia=this.fechatmp.getDay();
	if(dia==0) dia=7
	dia--;
	dia=(dia*20);
	return dia
}
function IsDomingo(dia,mes,ano)
{
	this.fechatmp=new Date();
	this.fechatmp.setMonth(mes);
	this.fechatmp.setYear(ano);	
	this.fechatmp.setDate(dia);	
	dia=this.fechatmp.getDay();
	if(dia==0) { return true; } else {return false; }
}
function hayNoticia(dia,mes,ano)
{
	dia=String(dia);
	mes=String(mes);
	ano=String(ano);
	fech = dia+mes+ano;
	for (nt=0; nt<=numero_noticia; nt++){
		if(noticias[nt]==fech) {
			return true; 
		}
	}
	return false;
	
}

function seleccionar(dia)
{
	this.MiFecha.setDate(dia);
	this.MiDia=this.MiFecha.getDate();
	document.forms[0].not_fecha.value=(this.MiDia+"/"+(this.MiMes+1)+"/"+this.MiAno);	
	shd('calendario','none');	
}
function recomendar()
{
document.getElementById('frmrecomendar').submit();
}

function confirmarLink(theLink, mensaje)
{
var confirmarMnsj  = 'Realmente desea ';
    // Confirmacion para Opera
    if (confirmarMnsj == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var confirmado = confirm(confirmarMnsj + ' :\n\n' + mensaje);
    if (confirmado) {
        theLink.href += '&confirmado=1';
    }

    return confirmado;
}
