// VALIDA FORMULARIO DE BUSQUEDA NOTICIAS
function valBuscadorNot() {
	var form = document.formNot;
	var Min = 4;
	if(form.buscar.value != "" && form.buscar.value.length <= Min) {
		alert("La palabra debe ser mayor a "+Min+" caracteres.");
		form.buscar.focus();
		return false;
	}
	if(form.buscar.value == "" || form.buscar.value == null) {
		alert("Debe Ingresar texto a buscar.");
		form.buscar.focus();
		return false;
	}
	form.submit();
}

// SECCION COMERCIAL
// VALIDA FORMULARIO DE BUSQUEDA
function valBusqueda() {
	var form = document.formComercial;
	if(form.namempresa.value != "" && form.namempresa.value.length <= 3) {
		alert("La palabra debe ser mayor a 3 caracteres.");
		form.namempresa.focus();
		return false;
	}
	if(form.namempresa.value == "" && form.rubro.value == 0) {
		alert("Debe ingresar una palabra o rubro para la bsqueda.");
		form.rubro.focus();
		return false;
	}
	formulario.submit();
}

<!-- INICIA FUNCIONES DESPLAZAMIENTOS DE DETALLES BUSQUEDA COMERCIAL -->
function abrirCerrar(div,boton) {
	var inOut = document.getElementById('inOut'+boton).value;
	theImg = document.getElementById(boton);
	if(inOut == 'abajo') {
		$(div).slideDown("slow");
//		theImg.setAttribute("src","img/"+boton+"_sel.jpg");
		document.getElementById('inOut'+boton).value='arriba';
	} else {
		$(div).slideUp("slow");
//		theImg.setAttribute("src","img/"+boton+".jpg");
		document.getElementById('inOut'+boton).value='abajo';
	}
}
function swapImage(div,boton) {
	theImg = document.getElementById(boton);
	var inOut = document.getElementById('inOut'+boton).value;
	if(inOut == 'abajo') {
		theImg.setAttribute("src","comercial/img/"+boton+"_roll.jpg");		
	} else {
		theImg.setAttribute("src","img/"+boton+"_sel_roll.jpg");
	}
}
function restoreImage(div,boton) {
	theImg = document.getElementById(boton);
	var inOut = document.getElementById('inOut'+boton).value;
	if(inOut == 'abajo') {
		theImg.setAttribute("src","img/"+boton+".jpg");
	} else {
		theImg.setAttribute("src","img/"+boton+"_sel.jpg");
	}
}
<!-- FIN FUNCIONES DESPLAZAMIENTOS DE DETALLES BUSQUEDA COMERCIAL -->


	function openPopup( strURL, intWidth, intHeight, blnNewWindow ) { //zubin
		//alert('z');
		var intScreenHeight = 0;
		//	get screen height
		if( parseInt( navigator.appVersion ) > 3 ) {
			intScreenHeight = screen.availHeight;
			if( !intScreenHeight ) {
				intScreenHeight = screen.height;
			}
		} else if(
			navigator.appName == "Netscape" && 
			parseInt( navigator.appVersion ) == 3 && 
			navigator.javaEnabled()
		) {
			var jToolkit = java.awt.Toolkit.getDefaultToolkit();
			var jScreenSize = jToolkit.getScreenSize();
			intScreenHeight = jScreenSize.height;
		} else {
			alert( 'Can\'t detect screen resolution' );
			return;
		}
		//	adjust dimensions if necessary
		if( intHeight > intScreenHeight ) {
			intHeight = intScreenHeight - 10;
		}
		if( blnNewWindow ) {
			//	new window
			var openPopup = window.open( strURL,"Organigrama",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + intWidth + ',height=' + intHeight );
			openPopup.focus();
		} else {
			//	same window
			window.resizeTo( intWidth, intHeight );
		}
		return;
	}
	
function popupWindow(url,ancho,alto) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+ ancho + ',height=' + alto +',screenX=150,screenY=150,top=150,left=150')
}

function popupScroll(url,ancho,alto) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+ ancho + ',height=' + alto +',screenX=150,screenY=150,top=150,left=150')
}

function video(URL){ 
   window.open(URL,"ventana","width=352,height=240,scrollbars=no") 
}

<!-- INICIA DESHABILIDAR BOTON DERECHO -->
/*
function disableselect(e) {
	return false 
}
function reEnable() {
	return true 
}
	document.onselectstart=new Function ("return false") 
	if (window.sidebar){ 
		document.onmousedown=disableselect 
		document.onclick=reEnable 
	} 


// Internet Explorer
	window.onload = function() {     
		document.getElementById("fulltext").onselectstart = function() {          
			return false;     
		}
		document.getElementById("TextTitular").onselectstart = function() {          
			return false;     
		}
// Firefox     
		document.onmousedown = function() {
			return false;
	}
}
*/
<!-- FIN DESHABILIDAR BOTON DERECHO -->

<!-- INICIO ZOOMTEXT -->
var minsize = 10;
var maxsize = 18;
var defecto = 13;
var actual = 12;

function Mastexto(div){
	actual = actual+1;
	if (actual > maxsize) {
	actual = maxsize
	}
	var divID = document.getElementById(div);
	divID.style.fontSize = actual+"px";
	// px porque estoy usando css
}

function Menostexto(div) {
	actual = actual-1;
	if (actual < minsize) {
	actual = minsize
	}
	var divID = document.getElementById(div);
	divID.style.fontSize = actual+"px";
}
function Normal(div) {
	actual = defecto;
	var divID = document.getElementById(div);
	divID.style.fontSize = actual+"px";
}
<!-- FIN ZOOMTEXT -->



<!-- INICIO CUENTA REGRESIVA TELETON -->
function contador() {
	hoy = new Date();
	evento = new Date("Nov 31 2007 22:00:00");
	dias = (evento - hoy) / 1000 / 60 / 60 / 24;
	diasRedondeado = Math.floor(dias);
	horas = (evento - hoy) / 1000 / 60 / 60 - (24 * diasRedondeado);
	horasRedondeado = Math.floor(horas);
	minutos = (evento - hoy) / 1000 /60 - 
	(24 * 60 * diasRedondeado) - (60 * horasRedondeado);
	minutosRedondeado = Math.floor(minutos);
	segundos = (evento - hoy) / 1000 - (24 * 60 * 60 * diasRedondeado) - 
	(60 * 60 * horasRedondeado) - (60 * minutosRedondeado);
	segundosRedondeado = Math.round(segundos);	
	segundosRedondeado = (segundosRedondeado < 10) ? "0"+segundosRedondeado : segundosRedondeado;
	minutosRedondeado = (minutosRedondeado < 10) ? "0"+minutosRedondeado : minutosRedondeado;
	horasRedondeado = (horasRedondeado < 10) ? "0"+horasRedondeado : horasRedondeado;
	numberCountdown.innerText = horasRedondeado + ":" + minutosRedondeado + ":"+ segundosRedondeado;  
	newtime = window.setTimeout("contador();", 1000);
}
<!-- FIN CUENTA REGRESIVA TELETON -->

<!-- INICIO LIMITA LONGITUD DE TEXTAREA -->
function maximaLongitud(texto,maxlong) {
	var tecla, in_value, out_value;
	
	if (texto.value.length > maxlong) {
	in_value = texto.value;
	out_value = in_value.substring(0,maxlong);
	texto.value = out_value;
	return false;
	}
	return true;
}
<!-- FIN LIMITA LONGITUD DE TEXTAREA -->

<!-- INICIO AGREGAR A FAVORITOS Y PAGINA DE INICIO -->
function agregar(){
	//Para internet explorer
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
		var url="http://www.portaldemelipilla.cl/"; //Cambia esta dirección por la de tu web
		var titulo="Portal de Melipilla"; //Cambia esta nombre por el de tu web
		window.external.AddFavorite(url,titulo);
	} else {
	//Para Netscape y Firefox
	if(navigator.appName == "Netscape")
		alert ("Presione Crtl+D para agregar a este sitio en sus Bookmarks");  //Puedes personalizar este mensaje
	}
}

<!-- FINAL AGREGAR A FAVORITOS Y PAGINA DE INICIO -->