
// VALIDACION DEL FORMULARIO DE CONTACTO
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;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener un e-mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un numero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es necesario.\n'; }
  } if (errors) alert('Por favor, revise el formulario:\n'+errors);
  document.MM_returnValue = (errors == '');
}

//

function validarFormularioContacto(elform) {
	var todok = true;
	var msgerror='';
	if (elform.nombre.value == "") {msgerror+='- Debe introducir su NOMBRE.'; todok=false;}
	if (!todok) { alert(msgerror); return false; } else { return true ;}
}

// CAMBIO DE COLOR ONMOUSEOVER SOBRE TABLE,TR o TD
function micolor(obj,colorobj) {
	obj.style.backgroundColor=colorobj
	}
// CAMBIO DE IMAGEN DE FONDO ONMOUSEOVER SOBRE TABLE,TR o TD
function mifondo(obj,imgobj) {
	obj.style.backgroundImage= "url(imgobj)";
	}
// CAMBIO DE COLOR DEL BORDE ONMOUSEOVER SOBRE TABLE,TR o TD
function micolorborde(obj,colorobj) {
	obj.style.borderColor=colorobj
	}
	
// PARA INSERTAR OBJETOS FLASH Y EVITAR EL PROBLEMA DE SEGURIDAD CON IE
function ObjetoFlash(id,archivo,ancho,alto,bgcolor,clase){
var str1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"';
var str2 = 'width='+ ancho +' height='+ alto +' id='+ id +' class="'+ clase +'">';
var str3 = '<param name="movie" value="'+ archivo +'" />';
var str4 = '<param name="quality" value="high" /><param name="menu" value="false" /><param name="allowScriptAccess" value="sameDomain" />';
var str5 = '<param name="menu" value="false" />';
var str6 = '<param name="bgcolor" value="'+ bgcolor +'"/>';
if (bgcolor=='transparent'){ str6 = '<param name="wmode" value="'+ bgcolor +'"/>'; }
var str7 = '<embed src="'+ archivo +'" quality="high" width="'+ ancho +'" height="'+ alto +'" name="'+ id +'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
var str8 = ' bgcolor="'+ bgcolor +'" /></object>';
if (bgcolor=='transparent'){ str8 = ' wmode="'+ bgcolor +'" /></object>'; }
document.write(str1+str2+str3+str4+str5+str6+str7+str8);
}
