
//-----------------------------------------------------------------------------------
//********************** Open JS Material Version Layer *************************************************
//-----------------------------------------------------------------------------------
	function OpenJSStoreLayer(frmObj,objField,prodID) {
		var tcode = 'popTechnology.php?tcode=' + objField + '';
		//OpenEditLayer(frmObj,'JS_Calendar2.htm?DateField='+DateField+'&DateIn='+DateIn+'',255,225);
		OpenEditLayer(frmObj,tcode,400,150);
		var el = frmObj;
		var coords = {x: 0, y: 0}; 
		while (el) { 
			coords.x += el.offsetLeft; coords.y += el.offsetTop+3; 
			el = el.offsetParent; 
		} 
		SubMenuLeft = coords.x;
		SubMenuTop = coords.y;

		if (SubMenuLeft + 280 > document.body.offsetWidth) {
			SubMenuLeft = document.body.offsetWidth - 285;
		}

		if (SubMenuTop + 200 > document.body.scrollTop + document.body.offsetHeight) {
			//SubMenuTop = document.body.scrollTop + document.body.offsetHeight - 350;
		}
		SubMenuTop = SubMenuTop - 20
		document.getElementById("PopLayer").style.top = SubMenuTop+"px";
		document.getElementById("PopLayer").style.left = SubMenuLeft+"px";
	}
//-----------------------------------------------------------------------------------
//********************** Layer Popup Function *********************************************************
//-----------------------------------------------------------------------------------
	function OpenEditLayer(frmObj,Page,WWidth,WHeight,Hide) {
		var SubMenuLeft, SubMenuTop;
		//var el = frmObj;
		//var coords = {x: 0, y: 0}; 
		//while (el) { 
		//	coords.x += el.offsetLeft; coords.y += el.offsetTop; 
		//	el = el.offsetParent; 
		//} 
		//SubMenuLeft = coords.x;
		//SubMenuTop = coords.y;
		SubMenuLeft = 80;
		SubMenuTop = 150;

		var HideText = "";
		if (Hide == "Hide"){
			WWidth = 0;
			WHeight = 0;
		}
		if (document.getElementById('PopLayer')) {
			//------ If Layer Exist -----------
			document.getElementById("PopLayer").style.top = SubMenuTop+"px";
			document.getElementById("PopLayer").style.left = SubMenuLeft+"px";
			document.getElementById("LayerSubFrame").src = Page;
			document.getElementById("LayerSubFrame").width = WWidth;
			document.getElementById("LayerSubFrame").height = WHeight;
			document.getElementById("PopLayer").style.display = "";
		} else {
			//------ Create Layer with script -------------
			var SubLayerText;
			SubLayerText = '<div id="PopLayer" style="position:absolute;z-index:500; top:'+SubMenuTop+'px; left:'+SubMenuLeft+'px;">';
			SubLayerText += '<iframe name="LayerSubFrame" id="LayerSubFrame" frameborder="0" width="'+WWidth+'" height="'+WHeight+'" scrolling="no" style="border: 0px solid #555555;">';
			SubLayerText += '</iframe>';
			SubLayerText += '</div>';
			if (document.all) {
				//----- Code For IE 
				document.body.insertAdjacentHTML("afterBegin",SubLayerText);
			} else {
				//----- Code For N6 or FireFox
				var range = document.createRange();
   				range.setStartBefore(document.body.lastChild);
   				var docFrag = range.createContextualFragment(SubLayerText);
   				document.body.appendChild(docFrag);
			}
			document.getElementById("LayerSubFrame").src = Page;
		}
	}
	
function EmptyFieldContent(frmObj) {
	document.getElementById(frmObj).value = '';
}

