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.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.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];}
}


var nscp = (navigator.appName == "Netscape")
var ismc = (navigator.appVersion.indexOf("Mac") != -1)
var vers = parseFloat(navigator.appVersion.substring(22,25))
function getObj(obj){
	if (nscp){
		compLayr = document.layers[obj]
	}else{
		compLayr = eval("document.all." + obj + ".style")
	}
	return compLayr
}

function marqueeStop(){
	document.getElementById("marquesina").stop();
}
function marqueePlay(){
	document.getElementById("marquesina").start();
}


function llamarasincrono(url, id_contenedor){
	var pagina_requerida = false
	if (window.XMLHttpRequest) {
		pagina_requerida = new XMLHttpRequest()
	} else if (window.ActiveXObject){
		try {
			pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
		pagina_requerida.onreadystatechange=function(){
		cargarpagina(pagina_requerida, id_contenedor)
	}
	pagina_requerida.open('GET', url, true) 
	pagina_requerida.send(null)
}
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
}
function AmpliarFuente()
{
	for(var j=0; j<document.styleSheets.length; j++) {
		for(var i=0; i<document.styleSheets[j].rules.length; i++) {
			if (document.styleSheets[j].rules.item(i).selectorText == ".nota_titulo" || document.styleSheets[j].rules.item(i).selectorText == ".nota_texto" || document.styleSheets[j].rules.item(i).selectorText == ".nota_titulo_link") {
				var f = document.styleSheets[j].rules.item(i).style.fontSize;
				if (f != "") {
					var c = parseInt(f.substring(0,f.length - 2));
					if(!isNaN(c)) {
						document.styleSheets[j].rules.item(i).style.fontSize = (c + 2) + "px";
					}
				}
			}
		}
	}
}
function ReducirFuente()
{
	for(var j=0; j<document.styleSheets.length; j++) {
		for(var i=0; i<document.styleSheets[j].rules.length; i++) {
			if (document.styleSheets[j].rules.item(i).selectorText == ".nota_titulo" || document.styleSheets[j].rules.item(i).selectorText == ".nota_texto" || document.styleSheets[j].rules.item(i).selectorText == ".nota_titulo_link") {
				var f = document.styleSheets[j].rules.item(i).style.fontSize;
				if (f != "") {
					var c = parseInt(f.substring(0,f.length - 2));
					if(!isNaN(c)) {
						document.styleSheets[j].rules.item(i).style.fontSize = (c - 2) + "px";
					}
				}
			}
		}
	}
}

function imprime_seleccion(x) {
  var ficha = document.getElementById("seleccion_imprimir_"+x);
  var imprime="<html>";
  imprime+="<head>";
  imprime+="<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
  imprime+="<link rel='stylesheet' href='css/style.css' type='text/css' />";
  imprime+="</head>";
  imprime+="<body>"+ficha.innerHTML;
  imprime+="<p class=texto_1>"+window.location+"</p>";
  
  
  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( imprime );
  ventimp.document.close();
  ventimp.print();
  //ventimp.close();
}
  
function addBookmark(x,y) {
  if (window.external){
    external.AddFavorite("http://"+y,x)
  }else{
    alert("Su navegador no soporta esta operación.");
  }
}  

function votar(x){
	var marcado = -1;
	f="form_encuesta_"+x;
	with (document.forms[f]){
		for ( var i = 0; i < item.length; i++ ) {
			if ( item[i].checked ) {
				marcado = i+1;
			}
		}
		if ( marcado == -1 ){
			window.alert("Debes seleccionar alguna opción" ) ;
		}else{
			llamarasincrono("externos/votar.asp?id="+x+"&item="+marcado, "seccion_encuesta_"+x);
		}
	}
}


function formulario_enviar_por_email(){
	var ErrorTXT="Debes completar el destinatario y tu nombre.";
	DatosOK=true;
	email   = document.form_enviar_por_email.email.value;
	nombre  = document.form_enviar_por_email.nombre.value;
	
	if(email=="" || nombre=="") {
		DatosOK=false;
	}	
	if (! DatosOK) {
		alert(ErrorTXT);
		return false;
	} else {
		return true;
	}
	
}

function formulario_comentario(){
	var f = "formulario_comentario";
	var msg_txt = "Debes completar los siguientes campos:\n\n";
	var DatosOK=true;
	var datos="?seccion="+f;
	
  for(var i=0; i < document.forms[f].elements.length; i++) {
		var campo = document.forms[f].elements[i];
		datos+="&"+campo.name+"="+campo.value;
		if (campo.id=="requerido" && campo.value==""){
			msg_txt+="   · " + campo.name + ".\n";
			DatosOK=false;
		}
	}
	if (! DatosOK) {
		alert(msg_txt);
	} else {
		llamarasincrono("externos/formulario_comentario.asp"+datos, "div_"+f);
	}
}
function formulario_buscador(){
	var ErrorTXT="Antes debes ingresar la palabra que querés buscar.";
	DatosOK=true;
	if(document.form_buscador.buscar.value=="" || document.form_buscador.buscar.value==document.form_buscador.buscar.defaultValue) {
		DatosOK=false;
	}	
	if (! DatosOK) {
		alert(ErrorTXT);
		return false;
	} else {
		return true;
	}
}
function formulario_gral(f){

	var msg_txt = "Debes completar los siguientes campos:\n\n";
	var DatosOK=true;
	var datos="?seccion="+f;
	
  for(var i=0; i < document.forms[f].elements.length; i++) {
		var campo = document.forms[f].elements[i];
		datos+="&"+campo.name+"="+campo.value;
		if (campo.id=="requerido" && campo.value==""){
			msg_txt+="   · " + campo.name + ".\n";
			DatosOK=false;
		}
	}
	if (! DatosOK) {
		alert(msg_txt);
	} else {
		llamarasincrono("externos/formulario_gral.asp"+datos, "div_"+f);
	}
}


function cambia_calendario(mes,ano){
	llamarasincrono("externos/calendario.asp?mes="+mes+"&ano="+ano, "calendario");
}