﻿//Check your browser version
var ns4 = document.layers
var ie4 = document.all
var ns6 = document.getElementById && !document.all

function drag_popup(strDivID) {
	$(function() {
		$("#" + strDivID).draggable();
	});
}

function LightBoxModalDialog(strDivID, sWidth, sHeight) {
	objDivID = ns6 ? document.getElementById(strDivID) : document.all[strDivID];

	//drag_popup Load
	drag_popup(strDivID);
	
	var msgw, msgh;
	msgw = sWidth; //Width
	msgh = sHeight; //Height

	var sBgWidth, sBgHeight;
	sBgWidth = document.body.offsetWidth;
	sBgHeight = document.body.offsetHeight;

	if (screen.height > sBgHeight) {
		sBgHeight = screen.height;
	}

	//Background
	var bgObj = document.createElement("div");
	bgObj.setAttribute('id', 'bgDiv');
	bgObj.style.position = "absolute";
	bgObj.style.top = "0";
	bgObj.style.background = "#777";
	bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	bgObj.style.opacity = "0.6";
	bgObj.style.left = "0";
	bgObj.style.width = sBgWidth + "px";
	bgObj.style.height = sBgHeight + "px";
	bgObj.style.zIndex = "10000";
	document.body.appendChild(bgObj);

	//Content
	objDivID.style.position = "absolute";
	objDivID.style.width = msgw + "px";
	objDivID.style.height = msgh + "px";
	objDivID.style.left = (screen.width) ? (screen.width - msgw) / 2 : 0;
	objDivID.style.top = (screen.height) ? (screen.height - msgh) / 2 - 100 : 0;
	objDivID.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	//objDivID.style.marginLeft = "-225px";
	//objDivID.style.marginTop = document.documentElement.scrollTop + "px";
	objDivID.style.zIndex = "10001";
	objDivID.style.display = "block";
}

function popupClose(strDivID) {
	popupClose2(strDivID, 'bgDiv');
}

function popupClose2(strDivID, strBgDivID) {
	crossobj1 = ns6 ? document.getElementById(strDivID) : document.all[strDivID];
	crossobj2 = ns6 ? document.getElementById(strBgDivID) : document.all[strBgDivID];
	document.body.removeChild(crossobj2);
	crossobj1.style.display = 'none';
}