/* base.js
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

	1. プルダウンメニュー
	2. 都市間距離測定
	3. 世界の天気と気温
	
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/



/* ------------------------------------------------------------
	1. プルダウンメニュー
   ------------------------------------------------------------*/
/* pull down menu */
$(document).ready(function(){
$("li#nav-popup").hover(
		function(){ $("div#popup-section").show()},
		function(){ $("div#popup-section").hide()}
	);
	if (document.all) {
		$("li#nav-popup").hoverClass ("sfHover");
	}
});

$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover( 
function() { $(this).addClass(c);  },
function() { $(this).removeClass(c); }
);
});
};

/* ------------------------------------------------------------
	2. 都市間距離測定 
   ------------------------------------------------------------*/

var Orig=new Array();
var Dest=new Array();
var nm=0;
var tc=0;
function DoCalc(form) {
from_airport=form.from.options[form.from.selectedIndex].value;
dest_airport=form.to.options[form.to.selectedIndex].value;

if (from_airport=="" || dest_airport=="") {
alert("発着地をご選択下さい");
}
else {
Orig=from_airport.split("/");
Dest=dest_airport.split("/");
d=Math.acos(Math.sin(Orig[2])
*Math.sin(Dest[2])
+Math.cos(Orig[2])
*Math.cos(Dest[2])
*Math.cos(Orig[4]-Dest[4]));
nm=Math.round(6369*d);
if (Math.sin(Dest[4]-Orig[4]) < 0) {
tc=Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])*Math.cos(d))
/(Math.sin(d)*Math.cos(Orig[2])));
} 
else { 
tc=2*Math.PI
-Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])
*Math.cos(d))/(Math.sin(d)
*Math.cos(Orig[2])));
}
tc=Math.round(tc*(180/Math.PI));
message=(Orig[0] + " to " + Dest[0] + "\n\n");

message+=(Math.round(nm*1)+"Km ");
destance=(Math.round(nm*1)+"Km ");
form.destance.value=destance;
   }
}

/* ------------------------------------------------------------
	3. 世界の天気と気温
   ------------------------------------------------------------*/

function CityTemp(){
    alink=document.flink.slink;
    mlink=alink.options[alink.selectedIndex].value;
    window.open(mlink,"","width=267,height=43");
}
