function confirmLink(theLink, theText){
    if (theText == '' || typeof(window.opera) != 'undefined') {
        return true;
    }
    var is_confirmed = confirm(theText);
    if (is_confirmed) {
        theLink.href += '&confirmado=1';
    }
    return is_confirmed;
}

function doPreview(wich, where){
	var objFile = document.getElementById(wich); //imagen
	var objImg = document.getElementById(where); //preview
	objImg.src = objFile.value;
}

function openWin(ventana){
	var w = 0, h = 0, popW = 300, popH = 180;
	
   	w = window.innerWidth;
   	h = window.innerHeight;
   	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
    popupWindow=open(''+ventana+'','PasGas','resizable=no,scrollbars=no,width='+popW+',height='+popH+',top='+topPos+',left='+leftPos);
    if (popupWindow.opener == null)
		popupWindow.opener = self;
}

function abrirVentana(ventana,popW,popH,nombre_ventana){
	if (nombre_ventana == undefined){
		var nom = 'Window';
	} else {
		var nom = nombre_ventana;
	}
	var w = 0, h = 0;
	
   	w = window.innerWidth;
   	h = window.innerHeight;
   	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
    popupWindow=open(''+ventana+'',nom,'resizable=no,scrollbars=yes,width='+popW+',height='+popH+',top='+topPos+',left='+leftPos);
    if (popupWindow.opener == null)
		popupWindow.opener = self;
}

function test(form) {
  if (form.nombre.value == "" || form.direccion.value == "" || form.telefono.value == "" || form.email.value == "" ||
	  form.banco.value == "" || form.agencia.value == "" || form.digito.value == "" || form.cuenta.value == ""){
    alert("Debe ingresar la información requerida");
	return false;
  } else {
  	return true;
  }
}

function testr(form) {
  if (form.nombre.value == "" || form.apellido.value == "" || form.telefono1.value == "" || form.averia.value == ""){
    alert("Debe ingresar la información requerida");
	return false;
  } else {
  	return true;
  }
}

function tests(form) {
  if (form.nombre.value == "" || form.direccion.value == "" || form.telefono.value == "" || 
	  form.email.value == "" || form.texto.value == ""){
    alert("Debe ingresar la información requerida");
	return false;
  } else {
  	return true;
  }
}

function getOptions(elemento) {
	window.frames['iframeOculto'].location = 'carga_dinamica.php?elemento='+elemento;
}

function fillSelect(arrOptions) {
	var cantidad = arrOptions.length;
	var mi_objeto = document.frmSelect.subelemento;

	mi_objeto.options.length = 0;
	
	for (i = 0; i < cantidad; i++) {
		mi_objeto.options[i] = new Option(arrOptions[i].nombre);
		mi_objeto.options[i].value = arrOptions[i].id;
	}
	mi_objeto.options[0].selected = true;
}

function hideDiv(){
	if (document.getElementById){
		document.getElementById('hideshow').style.visibility = 'hidden';
	} else {
		if (document.layers){
			document.hideshow.visibility = 'hidden';
		} else {
			document.all.hideshow.style.visibility = 'hidden';
		}
	}
}

function showDiv(){
	if (document.getElementById){
		document.getElementById('hideshow').style.visibility = 'visible';
	} else {
		if (document.layers) {
			document.hideshow.visibility = 'visible';
		} else {
			document.all.hideshow.style.visibility = 'visible';
		}
	}
}

function highlight_div(checkbox_node){
    label_node = checkbox_node.parentNode;

    if (checkbox_node.checked){
		label_node.style.backgroundColor='#990000';
		label_node.style.color='#ffffff';
	} else {
		label_node.style.backgroundColor='#ffffff';
		label_node.style.color='#000000';
	}
}