function doNothing(){
}

function initFunction(){
	document.timetable.reset();
	eval("popMonth(document.timetable.monthyear, 0, " + getCurrentMonth() + ", " + getCurrentFullYear() + ", POSITIVE_INFINITY, POSITIVE_INFINITY);");
	eval("setDays(document.timetable.day,getCurrentMonth());");
	day = document.timetable.day;	 
	   for (j = 0; j < day.length; j++) {
	     if (parseInt(day.options[j].value) == parseInt(getCurrentDate())) {
		          day.selectedIndex = j;		  
        	  break;
          }
	   }  
}

function cityCheck(form) {
	
		popCityName='http://www.aircanada.com.br/cities/pop_citytimetable.html';
			
	if (!checkCity(form.origin, form.org)){
	    if (!matchAmbiArray){
 			win=window.open(popCityName,'newWindow__timetable_orgerr__timetable_origin','width=390,height=400');
    		return false;
        }
   		else{
        	var word = form.org.value;
        	if (word.toUpperCase() == "NEW YORK"){
        		word = "NEW+YORK";
        	}
			window.open(popCityName,'newWindow__timetable_orgamberr__timetable_origin','width=400,height=400');
	        matchAmbiArray = false;
    	    return false;
   		}
  	}
 	if (!checkCity(form.destination, form.dest)) {
    	if (!matchAmbiArray){
     		win=window.open(popCityName,'newWindow__timetable_desterr__timetable_destination','width=390,height=400');
   			return false;
       }
       else{
  	        var word = form.dest.value;
  			if (word.toUpperCase() == "NEW YORK"){
        		word = "NEW+YORK";
        	}
    		window.open(popCityName,'newWindow__timetable_destamberr__timetable_destination','width=400,height=400');
	    	matchAmbiArray = false;
    	    return false;
  	   }
 	}

  	return true;
}			
	
function checkDate(day,month){
	fullmonth = month.options[month.selectedIndex].text;
	for (i=0;i<12;i++)
		if(fullmonth == months[i][0])
			{ monthval = i+1; break;}
	if (monthval == parseInt(getCurrentMonth())){	
		   if (parseInt(day.options[day.selectedIndex].value) < parseInt(getCurrentDate()))
		   {  day.selectedIndex =  parseInt(getCurrentDate()) -1;
		     return; }
	}
}	

function submitTimetable(form){

	var errorFlag=false;
	if (cityCheck(document.timetable) == false)
		errorFlag=true;
	else
		if (form.origin.value == "") {
			document.getElementById("Loc_e").style.display='block';
			document.getElementById("inpage").style.display='block';
			document.getElementById("inpageUser").style.display='block';
			document.getElementById("ip-Loc").style.display='block';
	    	return false;
    }
		if (form.destination.value == "") {
			document.getElementById("Loc_e").style.display='block';
			document.getElementById("inpage").style.display='block';
			document.getElementById("inpageUser").style.display='block';
			document.getElementById("ip-Loc").style.display='block';
	    	return false;
    }
		//alert("etste");
		setFormFields();
		
	
	//return !errorFlag;	
}

function setFormFields() {
		document.timetable.year.value = getYear(document.timetable.monthyear.value, document.timetable.day);
		document.timetable.month.value = getMonthFromOpt(document.timetable.monthyear);
		aWin=window.open('','Wait','width=650,height=500,top=50,left=50,resizable,scrollbars'); 
		aWin.focus();
		document.timetable.target="Wait";
		
}

function initFlightStatus(){
}


