// JavaScript Document
function foco(elemento) {
	//elemento.style.border = "1px solid #000000";
	elemento.style.background="#FFFFCC";
}
function no_foco(elemento) {
	//elemento.style.border = "1px solid #999999";
	elemento.style.background="#FFFFFF";
}

function ver(capa) {
	document.getElementById(capa).style.visibility = "visible";
	document.getElementById(capa).style.display = "inline";
}

function ocultar(capa){
	document.getElementById(capa).style.visibility = "hidden";
	document.getElementById(capa).style.display = "none";
}

function mostrar(capa) {
	if(document.getElementById(capa)) {
		if (document.getElementById(capa).style.visibility == "visible"){
			document.getElementById(capa).style.visibility = "hidden";
			document.getElementById(capa).style.display = "none";
		}
		else {
			document.getElementById(capa).style.visibility = "visible";
			document.getElementById(capa).style.display = "inline";
		}
	}
}

function checkSoloNum(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		/*alert("Por favor digiet solo numeros.")*/
		return false;
	}
		return true;
}

function Valida_Formulario() {
var retorno=true, argumentos=Valida_Formulario.arguments, mensaje='', mensaje2='';
	for(i=0; i<(argumentos.length-2); i+=3){
		elemento=argumentos[i];
		valorcampo=document.form1.elements[elemento].value;
		mensaje2+="\n"+elemento+":["+valorcampo+"]";
		if(valorcampo!=""){
		}
		else {
			mensaje+='\nEl campo: '+argumentos[i+1]+', debe ser diligenciado';
			retorno=false;
		}
	}
	if(retorno==false)
		//alert(mensaje2);
		alert(mensaje);
	document.errores=retorno;
}
function popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function iFrameHeight() {
	var h = 0;
	if ( !document.all ) {
		h = document.getElementById('wrap').contentDocument.height;
		document.getElementById('wrap').style.height = h + 60 + 'px';
	} else if( document.all ) {
		h = document.frames('wrap').document.body.scrollHeight;
		document.all.wrap.style.height = h + 20 + 'px';
	}
}


function resultado(div,parametro){
	document.getElementById(div).innerHTML= "<br><div align='center'><img src='imagenes/loader.gif'></div>";
	fecha=new Date();//Solución al cache
	new Ajax.Updater(div,parametro + "&estampa="+fecha.getTime(), {asynchronous:true, evalScripts:true});
}

function agregar(){
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
      var url="http://www.huila.com/";
      var titulo="Huila.com :: Tu Comunidad ::";
      window.external.AddFavorite(url,titulo);
   }
   else {
      if(navigator.appName == "Netscape")
         alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks");
   }
} 

function openModalDialog(nombre, pagina) {
	var win = new Window('modal_window', {className: "alphacube", title: nombre ,width:550, height:400, zIndex:1500, opacity:1, resizable: true, url: pagina})
	win.setDestroyOnClose();
	win.showCenter(true);
	//win.show(true);
}
