//=========================================================
//    気圧配置図
//=========================================================

var ItemTabs = "ItemTabs";
var dispSw = false;

//=========================================================
// タブメニュー

var Item = ['00','01','02','03','04',"05"];
var CloudsItem = "00";

function disp(s) {

	if (s=="chart") { // 実況天気図
		document.getElementById("pressure").style.display = "none";
		document.getElementById("chart").style.display = "block";
		setTab(ItemTabs,2);
		$.cookie('pressure_menu', s);

	} else if (s == "movie") {
		movie();
	} else if (s == "print") {
		printAll();
	} else { // 気圧配置図
		if(s == "") s = (dispSw)?"day":"week";

		if (s == "week") {
			document.getElementById("week0").style.display = "none";
			document.getElementById("week1").style.display = "block";
			dispSw = true;
			setTab(ItemTabs,1);
		} else { 
			document.getElementById("week0").style.display = "block";
			document.getElementById("week1").style.display = "none";
			dispSw = false
			setTab(ItemTabs,0);
		}
		document.getElementById("pressure").style.display = "block";
		document.getElementById("chart").style.display = "none";

		$.cookie('pressure_menu', s, { path: '/', expires: 365 });
	}
}

//=========================================================

function movie() {

	var url = "./pressure_mv.htm";
	var name = "気圧配置図動画";
	var para = "width=310,height=340" +
			",scrollbars=no"+
			",dependent=yes" +
			",resizable=yes";

	var win = window.open(url, name, para);
  win.focus();
}

//=========================================================

function printAll()
{
	var	nowUrl = location.href;
	document.open();
	document.writeln("<HTML lang=\"ja-JP\">");
	document.writeln("<head>");
	document.writeln("<script type=\"text/javascript\">");
	document.writeln("var count = 0;");
	document.writeln("if (navigator.appName.charAt(0) == \"N\")");
	document.writeln("++count;");
	document.writeln("function backUrl()");
	document.writeln("{");
	document.writeln("if (count)");
	document.writeln("location.href = \"" + nowUrl + "\";");
	document.writeln("++count;");
	document.writeln("}");
	document.writeln("var speed = 1000;");
	document.writeln("var blink = true;");
	document.writeln("var msg = '印刷ダイアログが表示されるまで、しばらくお待ちください';");
  document.writeln("function statusMsg()")
  document.writeln("{")
  document.writeln("setTimeout(\"statusMsg()\", speed);");
  document.writeln("if (blink) {");
	document.writeln("window.status = msg;");
	document.writeln("} else {");
	document.writeln("window.status = '';");
	document.writeln("}");
	document.writeln("blink = !blink;");
  document.writeln("}");
	document.writeln("</script></head>");
	document.writeln("<body onfocus=\"backUrl()\" onload=\"print()\" bgcolor=\"#FFFFFF\">");
	document.writeln("");
	document.writeln("");
	document.writeln("");
	document.writeln("<div align='center'>");
	for (var i = 0; i < 8; i++) {
		var src = "<img src='/imagefiles/jmap/jmap"
					 + i + ".png' width='255' height='236'>";
		document.writeln(src);
		if (i % 2) {
			document.writeln("<br>")
		} else {
			document.writeln("<img src='/img/_sp.gif' width='40'>")
		}
	}
	document.writeln("</div>");
	document.writeln("</body>");
	document.writeln("</html>");
	document.close();
//	statusMsg();
}

//=========================================================

$(function(){

	var argv = getUrlVars(); 

	if (argv['menu']) {
		var s = argv['menu'];
		disp(s);
	} else if ($.cookie('pressure_menu') != "") {
		var s = $.cookie('pressure_menu');
		disp(s);
	}

});



