var IE = document.all?true:false;
var CONS_menu1_left = 157;
var CONS_menu2_left = 340;
var CONS_menu3_left = 420;
var CONS_menu4_left = 254;

function $(id){
	var e = document.getElementById(id);
	return (e != null ? e : document.createElement());	
}

function blurMenu($id,$set){
	if ($set){
		document.getElementById('btn_' + $id).className = 'active';
	}else{
		document.getElementById('btn_' + $id).className = '';
	}
}

function load(){
	window.onresize = chSize;
	chSize();
}

function chSize(){
	if (IE){
		t = (1002 - document.body.offsetWidth) / 2;
	}else{
		t = (1024 - document.body.offsetWidth - 16) / 2;
		t -= 2;
	}
	$('menu1Container').style.left = ((IE ? (CONS_menu1_left + 8) : CONS_menu1_left) - t) + 'px';
	$('menu2Container').style.left = ((IE ? (CONS_menu2_left + 8) : CONS_menu2_left) - t) + 'px';
	$('menu3Container').style.left = ((IE ? (CONS_menu3_left + 8) : CONS_menu3_left) - t) + 'px';
	$('menu4Container').style.left = ((IE ? (CONS_menu4_left + 8) : CONS_menu4_left) - t) + 'px';
}

function menus_flotantes_CSS() {
	document.writeln('<style type="text/css">');

	document.writeln('/* MENUES FLOTANTES */');
	document.writeln('.menus');
	document.writeln('{');
	document.writeln('	background-image: url(img/submenu_bg.jpg);');
	document.writeln('	background-repeat: repeat-x;');
	document.writeln('	background-color: #e6e6e6;');
	document.writeln('	background-position: left top;');
	document.writeln('	filter:alpha(opacity=90);');
	document.writeln('	-moz-opacity:.90;');
	document.writeln('	opacity:.90;');
	document.writeln('	font-family:Arial, Helvetica, sans-serif;');
	document.writeln('	margin-left: 10px;');
	document.writeln('	font-size: 10px;');
	document.writeln('}');
	document.writeln('.menus a{');
	document.writeln('	display: block;');
	document.writeln('	width: 100%;');
	document.writeln('	color:#000000;');
	document.writeln('	font-size: 10px;');
	document.writeln('	text-decoration: none;');
	document.writeln('	padding-top: 8px;');
	document.writeln('	padding-right: 5px;');
	document.writeln('	padding-bottom: 6px;');
	document.writeln('	padding-left: 10px;');
	document.writeln('	filter:alpha(opacity=90);');
	document.writeln('	-moz-opacity:.90;');
	document.writeln('	opacity:.90;');
	document.writeln('}');
	document.writeln('.menus a:hover{');
	document.writeln('	color: #FF0000;');
	document.writeln('}');

	document.writeln('</style>');
}

function open_popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features)
}

function popup_weather() {
  window.open('http://espanol.weather.com/weather/tenday/ARBA0009?day=1&vert=WeatherCity&pres=Buenos+Aires%2C+Argentina#day','a','location=no,left=50,top=50,width=325,height=480,scrollbars=yes')
}

function popup_campana() {
  window.open('zonificacion.jpg','a','location=no,left=50,top=50,width=600,height=600,scrollbars=yes')
}

function zoomText(Accion,Elemento){
	//inicializacion de variables y parámetros 
	var obj=document.getElementById(Elemento);
	var max = 180 //tamaño máximo del fontSize
	var min = 70 //tamaño mínimo del fontSize
	if (obj.style.fontSize==""){
		obj.style.fontSize="100%";
	}
	actual=parseInt(obj.style.fontSize); //valor actual del tamaño del texto 
	incremento=10;// el valor del incremento o decremento en el tamaño 
	
	//accion sobre el texto 
	if( Accion=="reestablecer" ){
		obj.style.fontSize="100%"
	}
	if( Accion=="aumentar" && ((actual+incremento) <= max )){
		valor=actual+incremento;
		obj.style.fontSize=valor+"%"
	}
	if( Accion=="disminuir" && ((actual+incremento) >= min )){
		valor=actual-incremento;
		obj.style.fontSize=valor+"%"
	}
}

var min=8;
var max=18;
function increaseFontSize() {
	var p = document.getElementsByTagName('p');
	for(i=0;i<p.length;i++) {
		if(p[i].style.fontSize) {
			var s = parseInt(p[i].style.fontSize.replace("px",""));
		} else {
			var s = 10;
		}
		if(s!=max) {
			s += 1;
		}
		p[i].style.fontSize = s+"px"
	}
}
function decreaseFontSize() {
	var p = document.getElementsByTagName('p');
	for(i=0;i<p.length;i++) {
		if(p[i].style.fontSize) {
			var s = parseInt(p[i].style.fontSize.replace("px",""));
		} else {
			var s = 10;
		}
		if(s!=min) {
			s -= 1;
		}
		p[i].style.fontSize = s+"px"
	}
}
function resetFontSize() {
	var p = document.getElementsByTagName('p');
	for(i=0;i<p.length;i++) {
		var s = 10;
		p[i].style.fontSize = s+"px"
	}
}