function chequea() {
  
  if( isBlanco(document.fm.nombre.value) ) {
    alert( "Geben Sie bitte Ihren Vornamen ein." );
    window.document.fm.nombre.focus();
    window.document.fm.nombre.select();
    return false;
  }
  
  if( isBlanco(document.fm.apellido.value) ) {
    alert( "Geben Sie bitte Ihren Nachnamen ein.." );
    window.document.fm.apellido.focus();
    window.document.fm.apellido.select();
    return false;
  }
  
  if( isBlanco(document.fm.comentario.value) ) {
    alert( "Geben Sie einen Kommentar ein." );
    window.document.fm.comentario.focus();
    window.document.fm.comentario.select();
    return false;
  }
  
  if( !isValidEmail(document.fm.email.value) ) {
    alert( "\"" + document.fm.email.value + "\" ist keine gueltige e-mail Adresse. !" ); 
    window.document.fm.email.focus();
    window.document.fm.email.select();
    return false;
  }

  return true;
}

function CheckEmail() {
  if( !isValidEmail(document.news.email.value) ) {
    alert( "\"" + document.news.email.value + "\" ist keine gueltige e-mail Adresse. !" ); 
    window.document.news.email.focus();
    window.document.news.email.select();
    return false;
  }

  return true;
}


function limpia()
{
  document.fm.nombre.value = "";
  document.fm.apellido.value = "";
  document.fm.comentario.value = "";
  document.fm.email.value = "";

   return true;
}


function isBlanco(texto)
{
  largo = texto.length
  for( i=0; i < largo ; i++ )
    if( texto.charAt(i) != " " )
      return false;

  return true;
}

function isFecha(texto)
{
  largo = texto.length
  if( largo == 0 )
    return false;
  if( (texto.charAt(1) == "/") || (texto.charAt(1) == "-") || (texto.charAt(1) == ".") )
    texto = "0" + texto;
  if( (texto.charAt(4) == "/") || (texto.charAt(4) == "-") || (texto.charAt(4) == ".") )
    texto = texto.substring(0, 3) + "0" + texto.substring(3, largo + 1);
    
  fecha = "";
  for( i=0; i < largo ; i++ ) {
    if( (texto.charAt(i) != "/") && (texto.charAt(i) != "-") )
      fecha = fecha + texto.charAt(i);
  }
  
  dia = fecha.substring(0, 2);
  mes = fecha.substring(2, 4);
  ano = fecha.substring(4, largo + 1); 
  
  if( !isNumber(dia) )
    return false;
  if( !isNumber(mes) )
    return false;
  if( !isNumber(ano) )
    return false;
  if( (parseInt(dia, 10) > 31) || (parseInt(dia, 10) < 1) )
    return false;
  if( (parseInt(mes, 10) > 12) || (parseInt(mes, 10) < 1) )
    return false;
  if( (mes == "04") || (mes == "06") || (mes == "09") || (mes == "07") || (mes == "08") || (mes == "11") ) {
    if( parseInt(dia, 10) > 30 )
      return false;
  }
  
  if( mes != "02" )
    return true;
    
  x1 = Math.floor((Math.abs(parseInt(ano, 10) - 2000))/4);
  x2 = ((Math.abs(parseInt(ano, 10) - 2000))/4);
  if( x1 != x2 ) // No bisiesto
    feb = 28;
  else
    feb = 29;
    
  if( parseInt(dia, 10) > feb ) {
    return false;
  }
  
  return true;
}


function isDigit(caracter)
{
  if( (caracter.charAt(0) >= "0") && (caracter.charAt(0) <= "9") )
    return  true;
    
  return false;
}


function isNumber(texto)
{
  largo = texto.length
  if( largo == 0 )
    return false;
  for( i=0; i < largo ; i++ )
    if( !isDigit(texto.charAt(i)) )
      return false;
      
  return true;
}


function isFloat(texto, separador)
{
      largo = texto.length;
      if (largo == 0)
              return false;
      if (isNumber(texto))
              return true;
      if ((index= texto.indexOf(separador)) == -1)
              return isNumber(texto);
      entero  = texto.substring(0, index)
      decimal = texto.substring(index + 1, largo)
      if (!isNumber(entero))
              return false;
      if (!isNumber(decimal))
              return false;
  return true
}


function isValidEmail(texto)
{ 
  var addressIsValid = false; 
  var invalidPatterns = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
  var validPatterns = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 

  if( window.RegExp ) { 
    if( !invalidPatterns.test(texto) && validPatterns.test(texto) ) { 
      addressIsValid = true; 
    }
    else { 
      addressIsValid = false; 
    } 
  }
  else {
    if( texto.indexOf("@") >= 0 ) 
      addressIsValid = true; 
  } 

  return addressIsValid; 
}

function ChequeaCV() {
  if( isBlanco(document.job.Nombre.value) ) {
    alert( "Geben Sie bitte Ihren Vornamen ein." );
    window.document.job.Nombre.focus();
    window.document.job.Nombre.select();
    return false;
  }
  
  if( isBlanco(document.job.Apellido.value) ) {
    alert( "Geben Sie bitte Ihren Nachnamen ein." );
    window.document.job.Apellido.focus();
    window.document.job.Apellido.select();
    return false;
  }
  
  if( isBlanco(document.job.Ciudad.value) ) {
    alert( "Geben Sie bitte Ihren Ort ein." );
    window.document.job.Ciudad.focus();
    window.document.job.Ciudad.select();
    return false;
  }

  if( isBlanco(document.job.Pais.value) ) {
    alert( "Geben Sie bitte Ihren Land ein." );
    window.document.job.Pais.focus();
    window.document.job.Pais.select();
    return false;
  }

  if( isBlanco(document.job.Fono.value) ) {
    alert( "Geben Sie bitte Ihren Telefon ein." );
    window.document.job.Fono.focus();
    window.document.job.Fono.select();
    return false;
  }

  if( isBlanco(document.job.File.value) ) {
    alert( "Geben Sie bitte Ihren Lebenslauf vitae ein." );
    window.document.job.File.focus();
    window.document.job.File.select();
    return false;
  }

  if( !isValidEmail(document.job.Mail.value) ) {
    alert( "\"" + document.job.Mail.value + "\" ist keine gueltige e-mail Adresse. !" ); 
    window.document.job.Mail.focus();
    window.document.job.Mail.select();
    return false;
  }

  return true;
}

function LimpiaCV()
{
  document.job.Nombre.value = "";
  document.job.Apellido.value = "";
  document.job.Ciudad.value = "";
  document.job.Pais.value = "";
  document.job.Fono.value = "";
  document.job.Celular.value = "";
  document.job.File.value = "";
  document.job.Mail.value = "";

   return true;
}

 

function check_number() {
  var keycode = window.event.keyCode;
  if( keycode >=37 && keycode <=40 ) return true;  // arrow left, up, right, down  
  if( keycode >=48 && keycode <=57 ) return true;  // key 0-9

  if( keycode ==110 || keycode ==190  ) return true;  // dot
  if( keycode ==47) return true; // Slash "/"
 if( keycode == 191) return true; // Slash "/"
  if( keycode == 189) return true; // Dat "-"
  if( keycode ==8  ) return true;  // backspace
  if( keycode ==9 ) return true;  // tab
  if( keycode ==45 ||  keycode ==46 || keycode ==35 || keycode ==36) return true;  // insert, del, end, home
  
  alert ("In diesem Feld sind Zahlen und Bindestrich erlaubt. Für weitere Hinweise steht Ihnen das Kommentarfeld zur Verfügung.");  
  //return false;
  event.returnValue = false;
}
function check_Email()
{
if(!(/[0-9a-zA-Z_\.\-]+@[0-9a-zA-Z_\.\-]+.[a-zA-Z]+/ig).test(fm.Email.value))
	{
	alert("Bitte geben Sie eine gültige E-Mailadresse ein.");
	fm.Email.focus();
	return false;
	}

}
  
   
   function GoToTravel()
  {
    var strCodigos, strCode;
    if( document.MainForm.InfoList.selectedIndex >= 0 && document.MainForm.InfoList.options[document.MainForm.InfoList.selectedIndex].value != -1 ) {
      strCodigos = document.MainForm.InfoList.options[document.MainForm.InfoList.selectedIndex].value;
      //document.write();
      for( i=0; i < strCodigos.length ; i++ ) {
        if( strCodigos.charAt(i) == '#' )
		 
          strCode = strCodigos.substr(-3, i );
      }
      window.location.href='travel.php?travelID='+ strCode;
      window.focus();
    }
    else
      alert( '<?=$aLangTxt["InfoMapText1"];?>' );    
  } 
    function GoToTravel2()
  {
    var strCodigos, strCode;
    if( document.MainForm.InfoList.selectedIndex >= 0 && document.MainForm.InfoList.options[document.MainForm.InfoList.selectedIndex].value != -1 ) {
      strCodigos = document.MainForm.InfoList.options[document.MainForm.InfoList.selectedIndex].value;
      //document.write();
      for( i=0; i < strCodigos.length ; i++ ) {
        if( strCodigos.charAt(i) == '#' )
		 
          strCode = strCodigos.substr(-3, i );
      }
      window.location.href='travel_en.php?travelID='+ strCode;
      window.focus();
    }
    else
      alert( '<?=$aLangTxt["InfoMapText1"];?>' );    
  } 
 function DeleteOption()
  {
    var i, Selected = false;
    document.MainForm.strCodes.value = "";
    
    for( i = 0; i < document.MainForm.InfoList.options.length; i++ ) {
		
      if( document.MainForm.InfoList.options[i].value != -1 && document.MainForm.InfoList.options[i].selected ) {
		//document.MainForm.InfoList.options[i].selected += document.MainForm.strCodes.value ;
		// document.write(document.MainForm.InfoList.length);
		 document.MainForm.strCodes.value += document.MainForm.InfoList.options[i].value + '###';
		//document.MainForm.strCodes.value += document.MainForm.InfoList.options[i].value+'###';
        Selected = true;
		  
      }
	  
    }

    if( !Selected ) {
      alert( 'uuuuuuuuuuuuuu' );    
      return;
    }
    
    document.MainForm.submit();
  }
      
      
  function CloseWindow() {
    window.close();
  }
  //
   function submitForm( p_strUrl ) {
  document.search.action = p_strUrl;
  document.search.submit();
  }

  function onSubmitPage( p_strUrl ) {
  document.displaypic.action = p_strUrl;
  document.displaypic.submit();
  }
 