function llx3_dhtmlWindow(wFrame,folder,modal) {
	var This = this;
	var ModalBg = null;
	var ppW = null;
	var MouseDown = false;
	var mX = 0;
	var my = 0;
	this.effectSpeed = 300;


	function CreateModalBG() {
		ModalBg = document.createElement("DIV");
		ModalBg.style.backgroundColor = '#000000';
		ModalBg.style.position = GetFixedPos();
		ModalBg.style.left = '0px';
		ModalBg.style.top = '0px';
		ModalBg.style.width = '100%';
		ModalBg.style.height = '100%';
		ModalBg.style.opacity = '.5';
		ModalBg.style.filter = 'alpha(opacity=50)';
		ModalBg.style.zIndex = '10000';
		document.body.appendChild(ModalBg);
		ModalBg.onmousedown = function() { This.hideWindow(); }
		//ModalBg.onmousemove = onMouseMove;
	}
	function setPPW() {
		$(wFrame).each(function() { ppW = this });
		document.body.appendChild(ppW); ppW.style.position = 'absolute'; ppW.style.display = 'none';
		ppW.onmousedown = function(e) { SetCapture(); if (e == undefined) { mX = event.clientX - ppW.offsetLeft; mY = event.clientY - ppW.offsetTop; } else { mX = e.pageX - ppW.offsetLeft; mY = e.pageY - ppW.offsetTop; } MouseDown = true; return false; }
		ppW.onmouseup = function() { MouseDown = false; RelCapture(); }
		ppW.onselectstart = function() { return false; }
		ppW.ondragstart = function() { return false; }
		AddEvent(ppW, "mousemove", onMouseMove);
		AddEvent(document.body,"mousemove",onMouseMove);
		ppW.style.zIndex = 10000;
	}

	function onMouseMove(e) {
		//return true!
		if (MouseDown == false) return true;
		if (e == undefined) return true;
		//return false!
		if (document.all) { ppW.style.left = (event.clientX - mX) + 'px'; ppW.style.top = (event.clientY - mY) + 'px'; } else { ppW.style.left = (e.pageX - mX) + 'px'; ppW.style.top = (e.pageY - mY) + 'px' }; return false; 
	}

	this.showLoader = function() {
		var imgsrc=folder+'img/loader.gif'
		if (imgsrc == undefined) return false;
		if (imgsrc == "") return false;
		ModalBg.style.backgroundImage = "url('" + imgsrc + "')";
		ModalBg.style.backgroundPosition = "center";
		ModalBg.style.backgroundRepeat = "no-repeat";
	}
	this.showWindow = function(x, y) {
		if (modal == true) {
			if (ModalBg == null) { CreateModalBG(); }
			ModalBg.style.display = 'block';
			This.showLoader();
			if ((GetIeVersion() < 7) && (GetIeVersion() > 0)) { $('SELECT').each(function() { this.style.visibility = 'hidden' }) }
			ModalBg.style.backgroundImage = "";
		}
		setPPW();
		ppW.style.display = 'block';
		ppW.style.visibility = 'hidden';
		if (x == null) x = ((GetWindowWidth() / 2) - (ppW.offsetWidth / 2)) + document.documentElement.scrollLeft;
		ppW.style.left = x + 'px';
		if (y == null) y = ((GetWindowHeight() / 2) - (ppW.offsetHeight / 2)) + document.documentElement.scrollTop;
		ppW.style.top = y + 'px';
		ppW.style.display = 'none';
		ppW.style.visibility = 'visible';
		$(wFrame).each(function() { });
		$(wFrame).fadeIn(This.effectSpeed);
	}


	this.hideWindow = function() {
	$(wFrame).fadeOut(This.effectSpeed, function() { if (modal == true) ModalBg.style.display = 'none'; }); 
		if ((GetIeVersion() < 7) && (GetIeVersion() > 0)) { $('SELECT').each(function() { this.style.visibility = 'visible' }) }
	}

	function GetFixedPos() {
		if ((GetIeVersion() < 7)&&(GetIeVersion()>0)) return 'absolute';
		return 'fixed';
	}

	function GetIeVersion() {
		var i0 = window.navigator.appVersion.indexOf('MSIE');
		if (i0 < 0) return 0;
		var i1 = window.navigator.appVersion.indexOf(';',i0);
		return window.navigator.appVersion.substring(i0+4, i1)*1;
	}

	function SetCapture() {if (ppW.setCapture) ppW.setCapture(); }
	function RelCapture() { if (ppW.releaseCapture) ppW.releaseCapture(); }

	function AddEvent(obj,name,handler) {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			obj.attachEvent('on' + name, handler);
		} else {
			obj.addEventListener(name, handler, true);
		}	
	}

	function GetWindowHeight() {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return document.documentElement.offsetHeight;
		} else {
			return window.innerHeight;
		}
	 }
	 function GetWindowWidth() {
	 	if (navigator.appName.indexOf("Microsoft") != -1) {
	 		return document.documentElement.offsetWidth;
	 	} else {
	 		return window.innerWidth;
	 	}
	 }
	
}