function reSubmit(form, href, target) {
	if (target != null)
		form.target = target;
	form.action = href;
	form.submit();
}

function ayuda(programa) {
	window.open(programa, 'Ayuda', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=550,height=400');
}

function setCheckboxs(forma, nombre, valor){
	e = forma.elements;
	for(i=0;i<e.length;i++){
		if (e[i].type == 'checkbox' && e[i].name == nombre) {
			e[i].checked = valor;
		}
	}
}

function abreVentana(url, width, height) {
	window.open(url, 'nic','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height);
}

function abreVentanaConStatus(url, width, height) {
	window.open(url, 'nic','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height);
}

function remote(url, protocol) {

	remote_site = '/es/';

	if (window.opener == null) {
		window.location = remote_site+url;
	} else {
		window.opener.location=remote_site+url;
	};
}

function encode(text) {
	var s = "";
	for(var i = 0; i < text.length; i++) {
		var c = text.charAt(i);
		switch(c) {
			case '[': s += "[["; break;
			case ']': s += "]]"; break;
			case '<': s += "[]"; break;
			case '>': s += "]["; break;
			default: s += c;
		}
	}
	return s;
}

