// JavaScript Document
// funciones para la realizacion de ciertas acciones del navegador 
function Acciones(){
}
Acciones.adjustWindow = function(){// (: Ajusta ventana emergente al contenido
	if (window.sizeToContent){
		window.sizeToContent();
	}else{
		window.resizeTo(600, 500);
		var dialog_width = 603 - document.body.clientWidth;
		var str = navigator.appVersion; 
		var pos = str.indexOf("MSIE 7.0");
		if(pos>=0){
			dialog_height = 85/* - document.body.clientHeight*/;
		}else{
			var pos=str.indexOf("Safari");
			if(pos>=0){
				dialog_height = 40/* - document.body.clientHeight*/;
			}else{
				dialog_height = 63/* - document.body.clientHeight*/;
			}
		}
		window.resizeTo(50, 40);
		window.resizeTo((document.body.scrollWidth + dialog_width), (document.body.scrollHeight + dialog_height));
	}
}
Acciones.openSinToolbar = function(form, win_name){// (: Abre la ventana sin barra de herramientas 
	window.open('',win_name,'width=0, height=0, resizable=yes, scrollbars=no, toolbar=0');
	window.setTimeout('document.'+form+'.submit()',0);
}
Acciones.AllSelected = function(table, master_box){// (: Selecciona el checkbox maestro
	var checkboxes = document.getElementById(table).getElementsByTagName("input");
	var masterBox = true;
	for (i=0; i<checkboxes.length; i++) {
		if (checkboxes[i].checked == false && checkboxes[i].type == "checkbox"){
			document.getElementById(master_box).checked=false;
			var masterBox = false;
		};
	}
	if (masterBox==true){;
		document.getElementById(master_box).checked=true;
	};
}
Acciones.SelectAll = function(table, master_box){// (: Selecciona los que dependen del checkbox maestro
	var checkboxes = document.getElementById(table).getElementsByTagName('input');
	if (document.getElementById(master_box).checked){
		var checado = true;
	}else{
		var checado = false;
	}
	for (i=0; i<checkboxes.length; i++) {
		if (checkboxes[i].type == "checkbox"){
			checkboxes[i].checked = checado;
		}
	}
}
Acciones.confirmForm = function(form, mensaje){// (: Envia una mensaje de confirmacion
	var answer=confirm(mensaje);
	if (answer){;
		document.getElementById(form).submit();
	}
}