function validarEmail(obj) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(obj.value)){
	  return true;
  } else {
   alert("Error email");
   obj.focus();
   return false;
  }
}

function submitCheckin(){

		document.loginForm.submit();

}

function createSelectCityCheckin()
{
		AirportsCheckin.sort(sortByName);
		var aux = AirportsCheckin.length - 1;
		for (var i=0; i < aux; i++)
		{
				NewOpt =  new Option(AirportsCheckin[i].name + " ("+AirportsCheckin[i].code+")", AirportsCheckin[i].code);    //same as the HTML option > tag 
				document.getElementById('CityCode').options[i] =  NewOpt; //put the new option in the select box
				if(document.getElementById('RL2').value==AirportsCheckin[i].code)
				{
					document.getElementById('CityCode').options[i].selected=true;
				}		
		}
}

function sortByName(a, b) {
    var x = a.name.toLowerCase();
    var y = b.name.toLowerCase();
	x = SpChar(x);
	y = SpChar(y);
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function SpChar(Text)
{
	var chara="";
	var code="";
	for (var j = 0; j < Text.length; j++)
	{
		var Char=Text.charCodeAt(j);
		switch(Char)
		{
			case 225:
			chara+="a";
			break;
			case 233:
			chara+="e";
			break;
			case 237:
			chara+="i";
			break;
			case 243:
			chara+="o";
			break;
			case 250:
			chara+="u";
			break;
			case 193:
			chara+="A";
			break;
			case 201:
			chara+="E";
			break;
			case 205:
			chara+="I";
			break;
			case 211:
			chara+="O";
			break;
			case 218:
			chara+="U";
			break;
			case 241:
			chara+="n";
			break;
			case 209:
			chara+="n";
			break;
			default:
			chara+=Text.charAt(j);
			break;
		}
		code+="_"+Text.charCodeAt(j);	
	}
return chara;
}
