function L_windowSize(){

	var obj = new Object();

	obj.windowX = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth;
	obj.windowY = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;

	obj.maxX = document.documentElement.scrollWidth;
	obj.maxY = document.documentElement.scrollHeight;

	if( obj.maxX < document.body.scrollWidth ){
		obj.maxX = document.body.scrollWidth;
	}
	if( obj.maxY < document.body.scrollHeight ){
		obj.maxY = document.body.scrollHeight;
	}

	obj.scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
	obj.scrollY = document.documentElement.scrollTop || document.body.scrollTop;

	return obj;

}


var L_frontIframeOnFlag;

var addOnresizeEvent=function(func){
	var oldEvent = window.onresize;
	if (typeof window.onresize != 'function'){
		window.onresize = func;
	} else {
		window.onresize = function(){
			oldEvent();
			func();
		}
	}
}
addOnresizeEvent(L_frontIframeResize);

function L_frontIframeOn(n,X,Y){

	if( !L_frontIframeOnFlag ){

		var BODY = document.body;
		var wSize = L_windowSize();

		var newImage = document.createElement("div");
		newImage.id = "L_frontIframe_img";
		newImage.innerHTML = '<iframe src="'+n+'" id="L_frontIframe_src" width="'+X+'" height="'+Y+'"></iframe><div align="right" style="font-size:12px;line-height:14px;color:#000000;">枠外クリックで表示オフ</div>';
		newImage.align = "center";
		newImage.style.background = "#ffffff";
		newImage.style.padding = "10px";
		if( navigator.appVersion.indexOf("MSIE 6") == -1 ){
			newImage.style.position = "fixed";
		}else{
			newImage.style.position = "absolute";
		}
		newImage.style.zIndex = "100";
		if( navigator.appVersion.indexOf("MSIE 5.5") == -1 ){
			newImage.style.cursor = "pointer";
		}
		newImage.onclick = function(){L_frontIframeOff()};

		BODY.appendChild(newImage);

		frontIframe = document.getElementById("L_frontIframe_img");
//		frontIframe.style.left = wSize.windowX/2 - document.getElementById("L_frontIframe_src").width/2 + wSize.scrollX - 10 +"px";
//		frontIframe.style.top = wSize.windowY/2 - document.getElementById("L_frontIframe_src").height/2 + wSize.scrollY - 20 +"px";
		frontIframe.style.left = wSize.windowX/2 - document.getElementById("L_frontIframe_src").width/2 - 10 +"px";
		frontIframe.style.top = wSize.windowY/2 - document.getElementById("L_frontIframe_src").height/2 - 20 +"px";

		var newDiv = document.createElement("div");
		newDiv.id = "L_frontIframe_div";
		newDiv.style.position = "absolute";
		newDiv.style.left = "0px";
		newDiv.style.top = "0px";
		newDiv.style.background = "#000000";
		newDiv.align = "center";
		newDiv.style.width = wSize.maxX +"px";
		newDiv.style.height = wSize.maxY +"px";
		newDiv.style.zIndex = "99";
		newDiv.style.filter = "Alpha(opacity=70)";
		newDiv.style.opacity = "0.7";
		if( navigator.appVersion.indexOf("MSIE 5.5") == -1 ){
			newDiv.style.cursor = "pointer";
		}
		newDiv.onclick = function(){L_frontIframeOff()};

		BODY.appendChild(newDiv);

		L_frontIframeOnFlag = 1;
	}

}



function L_frontIframeOff(){

	if( L_frontIframeOnFlag ){

		document.body.removeChild(document.getElementById("L_frontIframe_img"));
		document.body.removeChild(document.getElementById("L_frontIframe_div"));

		L_frontIframeOnFlag = 0;
	}
}



function L_frontIframeResize(){

	if( L_frontIframeOnFlag ){

		var DIV = document.getElementById("L_frontIframe_div");
		var IMG = document.getElementById("L_frontIframe_img");
		var wSize = L_windowSize();

		DIV.style.width = wSize.maxX +"px";
		DIV.style.height = wSize.maxY +"px";

		IMG.style.left = wSize.windowX/2 - document.getElementById("L_frontIframe_src").width/2 - 10 +"px";
		IMG.style.top = wSize.windowY/2 - document.getElementById("L_frontIframe_src").height/2 - 20 +"px";

	}

}
