<!-- Marcado de las casillas

function marcaNum(field1,field2,total) {
	total = total * 1;
    if ((field2.length > 1) && (field2.length < (total+1))) {  // de 2 a total + 1 elementos
      if (field1.checked) {
        for (i = 0; i < field2.length; i++) {
	      field2[i].checked = true;
	      comprueba(field2[i]); } }
      else {
        for (i = 0; i < field2.length; i++) {
          field2[i].checked = false;
	      comprueba(field2[i]); } } }
    else if (field2.length = 1) {                        // 1 elemento
      if (field1.checked) {
	      field2.checked = true;
	      comprueba(field2); }
      else {
          field2.checked = false;
	      comprueba(field2); } }
}

function marcaNum3(field1,field2,field3,total) {	// modificación para doble checkox
	total = total * 1;
    if ((field2.length > 1) && (field2.length < (total+1))) {  // de 2 a total + 1 elementos
      if (field1.checked) {
        for (i = 0; i < field2.length; i++) {
	      field2[i].checked = true;
	      field3[i].checked = true;
	      comprueba(field2[i]);
	      comprueba(field3[i]); } }
      else {
        for (i = 0; i < field2.length; i++) {
          field2[i].checked = false;
          field3[i].checked = false;
	      comprueba(field2[i]);
	      comprueba(field3[i]); } } }
    else if (field2.length = 1) {                        // 1 elemento
      if (field1.checked) {
	      field2.checked = true;
	      field3.checked = true;
	      comprueba(field2);
	      comprueba(field3); }
      else {
          field2.checked = false;
          field3.checked = false;
	      comprueba(field2);
	      comprueba(field3); } }
}

<!-- Sombreado de celdas
ie = document.all?1:0

function comprueba(casilla){
  if (casilla.checked) sombrea(casilla);
  else des_sombrea(casilla);
  }

function sombrea(celda){
  if (ie) { while (celda.tagName!="TR") { celda=celda.parentElement; } }
  else { while (celda.tagName!="TR") { celda=celda.parentNode; } }
  celda.className = "H";
  }

function des_sombrea(celda){
  if (ie) { while (celda.tagName!="TR") { celda=celda.parentElement; } }
  else { while (celda.tagName!="TR") { celda=celda.parentNode; } }
  celda.className = "";
  } 

<!-- Corrección de formato numérico de "," a "."
function normaliza(dato1) {
  var cad ="";
  var celda1 = eval('document.form1.' + dato1 + '.value');
  var celda11 = eval('document.form1.' + dato1);
  for (i=0; i<celda1.length; i++) {
	if (celda1.charAt(i) != ',') {
	  cad = cad + celda1.charAt(i); }
	else cad = cad + '.';  }
  celda11.value = cad;
}

<!--  Ir a URL
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

<!-- Iguala celdas de texto a valor de combobox
function iguala(b_valor,valor) {
  valor.value = b_valor;
  }
  
<!-- Alfa de texto en las celdas de texto. Efecto 'desactivada'
function fcolor(casilla,campo) {
  if (casilla.checked) {
  campo.style.color = '#000000';
  } else {
  campo.style.color = '#cccccc';
  }
}

<!-- Elimina caracteres raros

function remove_XS_whitespace(item)
{
  item.value = item.value.replace(/\r/g, " ");
  item.value = item.value.replace(/[^ áÁéÉíÍóÓúÚñÑ€ªºÅåÖöØøÆæ!¡·¿çÇ¬¨´A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");
  item.value = item.value.replace(/'/g, "");
  item.value = item.value.replace(/ +/g, " ");  
  item.value = item.value.replace(/^\s/g, "");
  item.value = item.value.replace(/\s$/g, "");	
  if (item.value == ' '){item.value = ''};
}
function remove_XS_whitespace2(item)  //idem pero añade cambio de linea
{
  item.value = item.value.replace(/\r/g, "<br>");
  item.value = item.value.replace(/[^ áÁéÉíÍóÓúÚñÑ€ªºÅåÖöØøÆæ!¡·¿çÇ¬¨´A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");
//  item.value = item.value.replace(/'/g, "");
  item.value = item.value.replace(/ +/g, " ");  
  item.value = item.value.replace(/^\s/g, "");
  item.value = item.value.replace(/\s$/g, "");	
  if (item.value == ' '){item.value = ''};
}

//-->

function valorcombo(direccion, valor)   //abre la dirección que indica el combo
{
  direccion = direccion + valor;
  MM_goToURL('parent',direccion);
  return document.MM_returnValue;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// abre ventanas básico
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger) {

// by E Michael Brandt of ValleyWebDesigns.com - Please leave this comment intact.

	alt=alt
	if (bgcolor=="") {
		bgcolor="#ebebeb";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

    if(w<740){
      var lift=0.90;
    }
    if(w>=740 & w<835){
      var lift=0.91;
    }
    if(w>=835){
      var lift=0.93;
    }

	if (imageWidth>w){	
		byFactor = w / imageWidth;			
		imageWidth = w;
		imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
		byFactor = h / imageHeight;
		imageWidth = (imageWidth * byFactor);
		imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
		imageHeight=imageHeight*lift;
		imageWidth=imageWidth*lift;
	}

	var posLeft=0
	var posTop=0
	
	if (hugger=="hug image") {
		posTop = (scrHeight-imageHeight)/2;
		posLeft = ((w-imageWidth)/2);
		scrHeight = imageHeight-adj;
		scrWidth = imageWidth-adj;
 	}
	
	imageHeight=imageHeight-adj;
	imageWidth=imageWidth-adj;

	newWindow = window.open("","foto_fietspad","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'\&nbsp\;______________________________________________________________________\&nbsp\;</title><meta http-equiv=\"imagetoolbar\" content=\"no\"><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td align="center">');
	newWindow.document.write('<img src='+imageName+' alt=\"' + alt + '\&nbsp\;::\&nbsp\;Click\&nbsp\;para\&nbsp\;cerrar\&nbsp\;::\" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function JustSoFlashWindow(flashName,imageWidth,imageHeight,alt,bgcolor,hugger) {

// by E Michael Brandt of ValleyWebDesigns.com - Please leave this comment intact.

imageName = flashName;

	alt= "Mapa de " +alt+ " ________________________________________________"
	if (bgcolor=="") {
		bgcolor="#ebebeb";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

    if(w<740){
      var lift=0.90;
    }
    if(w>=740 & w<835){
      var lift=0.91;
    }
    if(w>=835){
      var lift=0.93;
    }

	if (imageWidth>w){	
		byFactor = w / imageWidth;			
		imageWidth = w;
		imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
		byFactor = h / imageHeight;
		imageWidth = (imageWidth * byFactor);
		imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
		imageHeight=imageHeight*lift;
		imageWidth=imageWidth*lift;
	}

	var posLeft=0
	var posTop=0
	
	if (hugger=="hug image") {
		posTop = (scrHeight-imageHeight)/2;
		posLeft = ((w-imageWidth)/2);
		scrHeight = imageHeight-adj;
		scrWidth = imageWidth-adj;
 	}
	
	imageHeight=imageHeight-adj;
	imageWidth=imageWidth-adj;

	newWindow = window.open("","mapa__fietspad","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop+",resizable=yes");
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>');
	newWindow.document.write('</head><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor);  
	newWindow.document.write('><table width=100% border="0" cellspacing="0" cellpadding="0" height=100%><tr><td align="center">');
	newWindow.document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%">');
	newWindow.document.write('<param name="movie" value=' +flashName+ ' ><param name="quality" value="high"><param name="bgcolor" value="#ebebeb">');
	newWindow.document.write('<embed src=' +flashName+ ' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed>');
	newWindow.document.write('</object>');
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}
