(function(){

var win = this;
var doc = win.document;
var $ = win.$;
var fileExtension = /^https?/.test(location.protocol) ? ".php" : ".html";
win.fukushimaKensakeoroshi = {
	
	getNews : function(){
		$.ajax({
			url : "./news/index" + fileExtension,
			success : function(data){
				var loader = doc.createElement("div");
				loader.innerHTML = data.
					replace(/<script[^>]*><\/script>/g, "").//not found errorを避ける
					replace(/<img[^>]*>/g, "");//not found errorを避ける
				var arr = [];
				$(".sectionNews", loader).each(function(){
					arr.push({
						date  : $("p.time", this).html(),
						title : $("h2"    , this).html(),
						url   : "./news/index" + fileExtension + "#" + this.id
					});
				});
				$("#flash").get(0).showNews(arr);
				try{
					delete win.fukushimaKensakeoroshi.getNews;
					delete win.fukushimaKensakeoroshi;
				}catch(err){}
			}
		});
	}

};

$(function(){
	swfobject.embedSWF("./flash/loading.swf", "flash", "100%", "660", "9.0.0", "#ffffff", "", {
		allowScriptAccess : ((location.protocol == "http") ? "sameDomain" : "always"),
		menu : false,
		bgcolor : "#ffffff"
	});
	if(doc.all && !win.opera && typeof XMLHttpRequest === "undefined"){
		var header = $("#header");
		var footer = $("#footer");
		$(window).resize(function(){
			if(header.width() >= 1320){
				header.get(0).style.width = "1320px";
			}else{
				header.get(0).style.removeAttribute("width", "1320px");
			}
			if(footer.width() >= 1320){
				footer.get(0).style.width = "1320px";
			}else{
				footer.get(0).style.removeAttribute("width", "1320px");
			}
			return arguments.callee;
		}());
	}
});

})();

