function pop_up (URL){ 
   window.open(URL,"modalidad","width=220,height=480,scrollbars=yes,status=yes");
}
function pop_upa(URL){ 
   window.open(URL,"modalidad","width=600,height=480,scrollbars=yes,status=yes");
}

function set()
	{
	var miform=document.form1;
	var index=miform.categoria.selectedIndex;
	var parametro=miform.categoria.options[index].value;
	/*ventana1=window.open('comppwd02.asp?usuario='+document.form1.usuario.value+'&pwd='+document.form1.pwd.value+'&categoria='+parametro, 'Registro',
                            'dependent=no,scrollbars=1,resizable=no'+
                            ',height='+(600*0.95)+',width='+796);
    ventana1.moveTo(0,0);*/
    window.open('','Registro','top=0,left=0,dependent=no,scrollbars=1,resizable=no,height='+(600*0.95)+',width=796');
	document.form1.submit();
	}
	
function Enviar() { //v3.0
			var miform=document.form1;
	var index=miform.categoria.selectedIndex;
	var parametro=miform.categoria.options[index].value;		
	if(navigator.appVersion.substring(0,1)>=4){
		setTimeout("set()",2000);
		}
	else{
		//window.open('comppwd02.asp?usuario='+document.form1.usuario.value+'&pwd='+document.form1.pwd.value+'&categoria='+parametro,'Registro','scrollbars=yes,resizable=no');
		window.open('','Registro','top=0,left=0,scrollbars=yes,resizable=no');
		document.form1.submit();
	}
	
}
function calc() { 
vent =window.open('','tpv','width=725,height=600,scrollbars=no,resizable=yes,status=yes,menubar=no,location=no');
document.compra.submit();
}

function verificar()
{
	if(document.form1.msj.value.replace(/ /g, '') == '')
	{
	alert("Debe Ingresar un valor ");
	document.form1.msj.focus();
	document.form1.msj.select();
	return false;
	}
	else document.form1.submit();
	}
	function verificar()
	{
	if(document.form1.msj.value.replace(/ /g, '') == '')
	{
	alert("Debe Ingresar un valor ");
	document.form1.msj.focus();
	document.form1.msj.select();
	return false;
	}
	else document.form1.submit();
}

function cambiar(formulario,campo1,campo2){
  var i = 0;
  var select1 = formulario[campo1];
  var select2 = formulario[campo2];
  var vector = provincias[select1.selectedIndex];
  if(vector.length)select2.length=vector.length;
  while(vector[i]){
 var valores= vector[i].split(",");
  var id = valores[0]
  var nombre = valores[1]
  
    select2.options[i].value = id;
    select2.options[i].text = nombre;
    i++;
  }
  select2.options[0].selected = 1;
}


provincias = new Array();
provincias[0] = new Array();
provincias[1] = new Array(',-','4,Pontevedra','3,Orense','2,Lugo','1,La Coruña');
provincias[2] = new Array(',-','5,Santander');
provincias[3] = new Array(',-','6,Asturias');
provincias[4] = new Array(',-','9,Vizcaya','8,Guipuzcoa','7,Alava');
provincias[5] = new Array(',-','11,Logroño');
provincias[6] = new Array(',-','10,Navarra');
provincias[7] = new Array(',-','18,Gerona','17,Tarragona','16,Lérida','15,Barcelona');
provincias[8] = new Array(',-','14,Zaragoza','13,Teruel','12,Huesca');
provincias[9] = new Array(',-','31,Segovia','30,Burgos','29,Ávila','28,Salamanca','27,Soria','26,Valladolid','25,Palencia','59,leon','60,zamora');
provincias[10] = new Array(',-','35,Albacete','34,Ciudad Real','33,Toledo','32,Guadalajara','58,Cuenca');
provincias[11] = new Array(',-','46,Valencia','45,Alicante','44,Castellón');
provincias[12] = new Array(',-','24,Murcia');
provincias[13] = new Array(',-','23,Madrid');
provincias[14] = new Array(',-','43,Jaen','42,Granada','41,Córdoba','40,Sevilla','39,Huelva','38,Cádiz','37,Málaga','36,Almeria');
provincias[15] = new Array(',-','20,Badajoz','19,Cáceres');
provincias[16] = new Array(',-','56,Menorca','55,Mallorca','54,Ibiza');
provincias[17] = new Array(',-','53,Gomera','52,Hierro','51,La Palma','50,Lanzarote','49,Fuerteventura','48,Tenerife','47,Gran Canaria');
provincias[18] = new Array(',-','21,Ceuta');
provincias[19] = new Array(',-','22,Melilla');


/*
 +-------------------------------------------------------------------+
 |                  J S - C H E C K F O R M   (v1.2)                 |
 |                                                                   |
 | Copyright Gerd Tentler               www.gerd-tentler.de/tools    |
 | Created: Oct. 23, 2001               Last modified: Jan. 24, 2006 |
 +-------------------------------------------------------------------+
 | This program may be used and hosted free of charge by anyone for  |
 | personal purpose as long as this copyright notice remains intact. |
 |                                                                   |
 | Obtain permission before selling the code for this program or     |
 | hosting this software on a commercial website or redistributing   |
 | this software over the Internet or in any other medium. In all    |
 | cases copyright must remain intact.                               |
 +-------------------------------------------------------------------+

======================================================================================================

 ARGUMENTS:

  - form-name or -number
  - 'field:title:type:minimum length'[, ...]  (type = number / mail / url / date(format) / [none])

 Example:

 checkForm('frm1', 'name:::2', 'age::number:1', 'eMail:e-mail:mail:1', 'homepage::url:0',
           'birthday::date(dmy):1');

------------------------------------------------------------------------------------------------------
 This script was tested with the following systems and browsers:

 - Windows XP: IE 6, NN 7, Opera 7, Firefox 1
 - Mac OS X:   IE 5, Safari 1

 If you use another browser or system, this script may not work for you - sorry.

 NOTE: Safari 1 on Mac OS X does only accept dates between Jan. 1, 1901 and Dec. 31, 2037 as valid.
======================================================================================================
*/
//--------------------------------------------------------------------------------------------------------
// Language settings
//--------------------------------------------------------------------------------------------------------

var msgNumber  = "debe ser un número";
var msgEMail   = "debe ser una dirección de correo electrónico";
var msgURL     = "debe ser una dirección web (url)";
var msgDate    = "debe ser una fecha";
var msgFillOut = "Por favor rellene el campo";
var msgNoForm  = "El formulario no existe";
var msgNoField = "El campo no existe";

//--------------------------------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------------------------------

function _trim(str) {
  if(str) {
    str = str.replace(/^\s+/, "");
    str = str.replace(/\s+$/, "");
  }
  return str;
}

function _isDate(year, month, day) {
  month--;
  if(year < 100) year += 2000;
  var d = new Date(year, month, day);
  return ((day == d.getDate()) && (month == d.getMonth()) && (year == d.getFullYear()));
}

function checkForm() {
  var args = checkForm.arguments;
  var f = args[0];
  var msg = "";
  var arr, field, title, type, minLength, elem, val, cnt, i, j;
  var format, d, day, month, year;

  var valid_url = /^(https?|ftp):\/\/([a-z0-9._-]+:[a-z0-9._-]+@)?[a-z0-9äöüÄÖÜ#._\/~% -]+(\?([a-z0-9_-]+(=[a-zA-Z0-99äöüÄÖÜß+%?_-]+&?)?)*)?$/i;
  var valid_mail = /^[a-z0-9._-]+@[a-z0-9äöüÄÖÜ.-]+\.[a-z]{2,4}$/i;

  if(document.forms[f]) {
    for(i = 1; i < args.length; i++) {
      arr = args[i].split(":");
      field = _trim(arr[0]);
      title = _trim(arr[1]);
      if(!title) title = field;
      type = _trim(arr[2].toLowerCase());
      minLength = _trim(arr[3]);
      elem = document.forms[f].elements[field];

      if(elem) {
        val = _trim(elem.value);

        if(val != "") {
          if(type == "number") {
            val = val.replace(",", ".");
            if(isNaN(val)) msg += '"' + title + '" ' + msgNumber + "\n";
          }
          else if(type == "mail" && val.search(valid_mail) == -1) msg += '"' + title + '" ' + msgEMail + "\n";
          else if(type == "url" && val.search(valid_url) == -1) msg += '"' + title + '" ' + msgURL + "\n";
          else if(type.indexOf("date") != -1) {
            if(type.indexOf("(") != -1) format = type.substr(type.indexOf("("));
            else format = "(dmy)";
            d = val;

            for(j = 1; j < format.length - 1; j++) {
              cnt = d.search(/[^0-9]/);
              if(cnt == -1) cnt = d.length;

              switch(format.charAt(j)) {
                case "d": day = parseInt(d.substr(0, cnt)); d = d.substr(cnt + 1); break;
                case "m": month = parseInt(d.substr(0, cnt)); d = d.substr(cnt + 1); break;
                case "y": year = parseInt(d.substr(0, cnt)); d = d.substr(cnt + 1); break;
              }
            }
            if(!_isDate(year, month, day)) msg += '"' + title + '" ' + msgDate + "\n";
          }
        }

        if(minLength) {
          if(elem.length) {
            if(elem.options) {
              for(j = cnt = 0; j < elem.options.length; j++) {
                if(elem.options[j].selected && elem.options[j].value != "") cnt++;
              }
            }
            else for(j = cnt = 0; j < elem.length; j++) {
              if(elem[j].checked) cnt++;
            }
          }
          else if(elem.type == "checkbox") cnt = elem.checked ? 1 : 0;
          else cnt = val.length;
          if(cnt < minLength) msg += msgFillOut + ' "' + title + '"\n';
        }
      }
      else msg += msgNoField + ': "' + field + '"\n';
    }

    if(msg) alert(msg);
    else document.forms[f].submit();
  }
  else alert(msgNoForm + ': "' + f + '"');
}

//--------------------------------------------------------------------------------------------------------

function mailAntiSpam(nombre)
{
var usuario = nombre
var dominio = "nexxo.org"
document.write("<a href=\"mailto:" + usuario + "@" + dominio + "\">" + usuario + "@" + dominio + "</a>")
}