function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
 function accion(src) {
	if(event.srcElement.tagName == 'TD'){
		src.children.tags('A')[0].click();
	}
 }
 
  function cambioColorOn(src,color) {
	if (!src.contains(event.fromElement)) {
	 src.bgColor = color;
	}
 }

 function cambioColorOff(src,color) {
	if (!src.contains(event.toElement)) {
	 src.bgColor = color;
	}
 }
 
  function activarText(src,color) {
 if (!src.contains(event.fromElement)) {
	 src.style.cursor = 'hand';
	 src.children.tags('A')[0].style.color = color;
	}
 }
 function desactivarText(src,color) {
	if (!src.contains(event.toElement)) {
	 src.style.cursor = 'default';
	 src.children.tags('A')[0].style.color = color;
	}
 }
function isEmpty(s)
	{   
		return ((s == null) || (s.length == 0))
	}

function validar(formu)
{
	if ((isEmpty(formu.email.value)))
	{
		alert("El campo e-mail no puede estar vacio");formu.email.focus( );
	}
	else
		{
			formu.submit()
		}
}


function validarcuestionario(formu)
{
	if ((isEmpty(formu.compania.value))) {
		alert("El campo compañia no puede estar vacio");formu.compania.focus( );
	}else	{
		if ((isEmpty(formu.Contacto.value))){
				alert("El campo Contacto no puede estar vacio");formu.Contacto.focus( );
			}else	{
				if ((isEmpty(formu.E_mail.value))){
					alert("El campo E-mail no puede estar vacio");formu.E_mail.focus( );
				}else	{
					if ((isEmpty(formu.Telefono.value))){
						alert("El campo Telefono no puede estar vacio");formu.Telefono.focus( );
					}else	{
						if ((isEmpty(formu.Direccion.value))){
							alert("El campo Direccion no puede estar vacio");formu.Direccion.focus( );
						}else	{
							if ((isEmpty(formu.cp.value))){
								alert("El campo código postal no puede estar vacio");formu.cp.focus( );
							}else	{
								if ((isEmpty(formu.Localidad.value))){
									alert("El campo Localidad no puede estar vacio");formu.Localidad.focus( );
								}else	{
									if ((isEmpty(formu.Provincia.value))){
										alert("El campo Provincia no puede estar vacio");formu.Provincia.focus( );
									}else	{
										if (!(isNumber(formu.cp.value)) ){
											alert("El campo código postal no es numérico");formu.cp.focus( );
										}else	{
											if (!(isNumber(formu.Telefono.value)) ){
												alert("El campo Telefono no es numérico");formu.Telefono.focus( );
											}else	{
												formu.submit()
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
}
function isDigit (c)
{  
	return ((c >= "0") && (c <= "9"))
}

function isNumber (s)
{   var i;
    var dotAppeared;
    dotAppeared = false;
    //if (isEmpty(s)) 
      // if (isNumber.arguments.length == 1) return defaultEmptyOK;
       //else return (isNumber.arguments[1] == true);
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if( i != 0 ) {
            if ( c == "." ) {
                if( !dotAppeared )
                    dotAppeared = true;
                else
                    return false;
            } else     
                if (!isDigit(c)) return false;
        } else { 
            if ( c == "." ) {
                if( !dotAppeared )
                    dotAppeared = true;
                else
                    return false;
            } else     
                if (!isDigit(c) && (c != "-") || (c == "+")) return false;
        }
    }
    return true;
}
