// JavaScript Document
var win,win2;
	
	function openWin(url,name,width,height) {
	var options = "width=" + width + ",height=" + height + ",top=0,Left=0,resizable=1";
	sub = window.open(url,'OpenWindow',options);
	sub.resizeTo(width, height);
}

	function openWin2(url,name,width,height) {
	var options = "width=" + width + ",height=" + height + ",top=0,Left=0,resizable=1,scrollbars=yes";
	sub2 = window.open(url,name,options);
	sub2.resizeTo(width, height);
}

function closeWin() {
	if (sub && !sub.closed) sub.close();
	if (sub2 && !sub2.closed) sub2.close();
}

function openerWin(url) {
	opener.location.href=url;
}

	var set_Year=2006;
	var set_Mon=6;
	var set_Day=9;
	var set_Hour=20+7;
	// 時差＋７時間で計算
	var set_Min=30;
	var set_Sec=0;
				  
function WorldCup() {
	if(!document.getElementById) return;
	var obj = document.getElementById("wcup");
	var now = new Date();
	var xday = new Date();
	
	xday.setYear(set_Year);
	xday.setMonth(set_Mon-1);
	xday.setDate(set_Day);
	xday.setHours(set_Hour);
	xday.setMinutes(set_Min);
	xday.setSeconds(set_Sec);
	
	var dif = xday.getTime() - now.getTime();
	var days = dif;
	var d = Math.floor(dif / (24*60*60*1000));
	dif = dif % (24*60*60*1000);
	var h = Math.floor(dif / (60*60*1000)); if(h < 10) h = "0" + h;
	dif = dif % (60*60*1000);
	var n = Math.floor(dif / (60*1000)); if(n < 10) n = "0" + n;
	dif = dif % (60*1000);
	var s = Math.floor(dif / 1000); if(s < 10) s = "0" + s;
	dif = dif % (60*1000);
	var msg;
	if(days > 0) msg = "開幕戦キックオフまで…<br><br><b class='times'>" + d + "<\/b> 日 <b class='times'>" + h + "<\/b> 時間 <b class='times'>" + n + "<\/b> 分 <b class='times'>" + s + "<\/b> 秒";

	else if(days <= 0 && days >= -8400000) msg = "<b class='times'>サッカー・ワールドカップ開幕！！！<\/b>";
	else if(d == -30) msg = "<b class='times'>FINAL 開催！<\/b>";
	else if(days < -8400000 && days >= -2592000000) msg = "<b class='times'>" + (-d) + " 日目、開催！<\/b>";
	else msg = "<b class='times'>ＧＯ！ 2010！！！<\/b>";
	obj.innerHTML = msg;
	setTimeout("WorldCup();",1000);
	}
