function escribe(obj){ 
document.Demo.NomSistema.value=obj.options[obj.selectedIndex].text; 
} 

function comprobar_email($email){ 
    $mail_correcto = 0; 
    //compruebo unas cosas primeras 
    if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){ 
       if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) { 
          //miro si tiene caracter . 
          if (substr_count($email,".")>= 1){ 
             //obtengo la terminacion del dominio 
             $term_dom = substr(strrchr ($email, '.'),1); 
             //compruebo que la terminación del dominio sea correcta 
             if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){ 
                //compruebo que lo de antes del dominio sea correcto 
                $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1); 
                $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1); 
                if ($caracter_ult != "@" && $caracter_ult != "."){ 
                   $mail_correcto = 1; 
                } 
             } 
          } 
       } 
    } 
    if ($mail_correcto) 
       return 1; 
    else 
       return 0; 
} 

  function ValidarEmail(email){
    if( email.indexOf('@',0) <= 0  || email.indexOf(';',0) != -1
     || email.indexOf(' ',0) != -1 || email.indexOf('/',0) != -1
     || email.indexOf(';',0) != -1 || email.indexOf('<',0) != -1
     || email.indexOf('>',0) != -1 || email.indexOf('*',0) != -1
     || email.indexOf('|',0) != -1 || email.indexOf('`',0) != -1
     || email.indexOf('&',0) != -1 || email.indexOf('$',0) != -1
     || email.indexOf('!',0) != -1 || email.indexOf('"',0) != -1
     || email.indexOf(':',0) != -1 )
       { return false; }
    else return true;
    }

function valida_campos(){
if (document.Demo.Empresa.value==''){
   alert("Por favor introduzca el NOMBRE DE LA EMPRESA.");
   document.Demo.Empresa.focus();
   }
else if (document.Demo.Sistema.value==0){
   alert("No ha seleccionado ningún SISTEMA.");
   document.Demo.Sistema.focus();
   }
else if (document.Demo.Solicitante.value==''){
   alert("Por favor escriba el NOMBRE de quien SOLICITA el sistema.");
   document.Demo.Solicitante.focus();
   }
else if (document.Demo.Direccion.value==''){
   alert("Por favor llene el campo DIRECCION.");
   document.Demo.Direccion.focus();
   }
else if (document.Demo.Ciudad.value==''){
   alert("Por favor llene el campo CIUDAD.");
   document.Demo.Ciudad.focus();
   }
else if (document.Demo.ProvDeptoEdo.value==''){
   alert("Por favor llene el campo PROVINCIA/DEPTO/EDO.");
   document.Demo.ProvDeptoEdo.focus();
   }
else if (document.Demo.Pais.value==''){
   alert("Por favor llene el campo PAIS.");
   document.Demo.Pais.focus();
   }
else if (document.Demo.Email.value==''){
   alert("No ha escrito su dirección de correo.");
   document.Demo.Email.focus();
   }
else if (ValidarEmail(document.Demo.Email.value)==0){
   alert("La dirección de correo no es válida.");
   document.Demo.Email.focus();
   }
else document.Demo.submit();
}

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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
