function CaricaFoto(img)
{
	foto1= new Image();
	foto1.src=(img);
	Controlla(img);
}

function Controlla(img)
{
	if((foto1.width!=0)&&(foto1.height!=0))
	{
		viewFoto(img);
	}
	else
	{
		funzione="Controlla('"+img+"')";
		intervallo=setTimeout(funzione,20);
	}
}

function viewFoto(img)
{
	largh=foto1.width-20;
	altez=foto1.height-20;
	stringa="width= "+largh+",height= "+altez;
	finestra=window.open(img,"",stringa);
}

function updateDestinations()
{
	$.getJSON('/destinations_101_ro_airport_'+$('#source').val(), function(data){
		
		$('#destination').empty();

		$.each(data, function(i, val) {
			$('#destination').append('<option value="'+i+'" label="'+val+'">'+val+'</option>'); 
		});
	});
}

function customRange(input)
{ 
    return {minDate: (input.id == "valability_end" ? $("#valability_start").datepicker("getDate") : null), 
        maxDate: (input.id == "valability_start" ? $("#valability_end").datepicker("getDate") : null)}; 
}

