var eMandiModal={
veilstack: 0,
open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=eMandiWindow //reference dhtmlwindow object
	this.interVeil=document.getElementById("interVeil") //Reference 
	this.veilstack++ //keep track of how many modal windows are open right now
	this.loadveil()
	if (recalonload=="recal" && d.scroll_top==0)
		d.addEvent(window, function(){eMandiModal.adjustveil()}, "load")
	var t=d.open(t, contenttype, contentsource, title, attr, recalonload)
	t.controls.firstChild.style.display="none" //Disable "minimize" button
	t.controls.onclick=function(){eMandiModal.close(this._parent, true)} 
	t.show=function(){eMandiModal.show(this)} // default t.show() method with new one
	t.hide=function(){eMandiModal.close(this)} 
return t
},


loadveil:function(){
	var d=eMandiWindow
	d.getviewpoint()
	this.docheightcomplete=(d.standardbody.offsetHeight>d.standardbody.scrollHeight)? d.standardbody.offsetHeight : d.standardbody.scrollHeight
	this.interVeil.style.width=d.docwidth+"px" 
	this.interVeil.style.height=this.docheightcomplete+"px" 
	this.interVeil.style.left=0 
	this.interVeil.style.top=0 
	this.interVeil.style.visibility="visible" 
	this.interVeil.style.display="block" //
},

adjustveil:function(){ 
	if (this.interVeil && this.interVeil.style.display=="block") 
		this.loadveil() //readjust veil
},

closeveil:function(){ 
	this.veilstack--
	if (this.veilstack==0) 
		this.interVeil.style.display="none"
},


close:function(t, forceclose){ // modal close function
	t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
	if (typeof forceclose!="undefined")
		t.onclose=function(){return true}
	if (eMandiWindow.close(t)) //if close() returns true
	{
		this.closeveil()
		if(document.getElementById('contentCommodity') != null)
		refreshParentScreen();
		else if(document.getElementById('divImage') != null)
		CloseWin();
	}
},


show:function(t){
	eMandiModal.veilstack++
	eMandiModal.loadveil()
	eMandiWindow.show(t)
}
}

document.write('<div id="interVeil"></div>')
//eMandiWindow.addEvent(window, function(){if (typeof eMandiModal!="undefined") eMandiModal.adjustveil()}, "resize")
