﻿var SMDialog = {
	Initialize: function()
	{
		SMDialog.FillView();
	},
	FillView: function()
	{
		var ___smStr = "\n<div id='SMDialogBg' style='width: 100%; height: 100%; left: 0px; top: 0px; z-index: 800; background-color: #C0C0C0; position: fixed!important; filter: alpha(opacity=60); opacity: 0.6; display: none;'></div>";
		___smStr += "<div id='SMDialogFrame' style='left: 50%; top: 40%; z-index: 801; position: fixed!important; display: none;'><iframe id='SMFrame' scrolling='no' frameborder='0'></iframe></div>\n";
		var FramLayer = document.createElement("div");
		FramLayer.innerHTML = ___smStr;
		document.body.appendChild(FramLayer);
	},
	Show: function(width, height, url)
	{
		document.getElementById("SMDialogBg").style.display = "block";
		
		var SMDialogFrame = document.getElementById("SMDialogFrame");
		SMDialogFrame.style.display = "block";
		SMDialogFrame.style.width = width + "px";
		SMDialogFrame.style.height = height + "px";
		SMDialogFrame.style.marginLeft = ("-" + parseInt(width / 2) + "px");
		SMDialogFrame.style.marginTop = ("-" + parseInt(height / 2) + "px");

		var smFrame = document.getElementById("SMFrame");
		smFrame.width = width + "px";
		smFrame.height = height + "px";
		smFrame.src = url;
	},
	Close: function()
	{
		document.getElementById("SMFrame").src = "";
		document.getElementById("SMDialogFrame").style.display = "none";
		document.getElementById("SMDialogBg").style.display = "none";
	}
}
if(document.all) {
	window.attachEvent("onload", SMDialog.Initialize);
} else {
	window.addEventListener("load", SMDialog.Initialize, false);
}