function IframeDialog( id, _url, position, useMask, w, h ){
	this.myFrame;
	this.mask;
	this.shadow;
	this.id = id;
	this.url = (_url)?_url:"/optionlogic/blank.html";
	this.CENTER = "CENTER";
	this.position = (position)?position:"";
	this.useMask = (useMask)?true:false;
	this.width = (w)?w:300;
	this.height = (h)?h:200;

	this.closeDialog = _closeDialog;
	this.getDoc = _getDoc;
	this.showDialog = _showDialog;
	this.changeSource = _changeSource;
	
	if( document.getElementById( this.id ) == null ){
		if( document.all ){
			var ifHtml = "<iframe id='"+this.id+"' name='"+this.id+"' frameborder='no' scrolling='no' "+
				"style='position: absolute; left: -1000px; top: -1000px; z-index: 10000; width: " + this.width + "px; "+
				"height: " + this.height + "px; border: 1px solid #898989; visibility: hidden;' "+
				"src='"+this.url+"'></iframe>";
			document.body.insertAdjacentHTML( "beforeEnd", ifHtml );
			this.myFrame = document.all[this.id];
		}else{
			this.myFrame = document.createElement( 'iframe' );
	    this.myFrame.setAttribute( 'id', this.id );
			this.myFrame.setAttribute( 'name', this.id );
			this.myFrame.setAttribute( 'frameborder', 'yes' );
			this.myFrame.setAttribute( 'scrolling', 'no' );
	    this.myFrame.setAttribute( 'style', 
				'position: absolute; left: -1000px; top: -1000px; z-index: 10000; width: ' + this.width + 'px; height: ' + this.height + 'px; '+
				'border: 1px solid #898989; visibility: hidden;' );
	    this.myFrame.setAttribute( 'src', this.url );
	    document.body.appendChild( this.myFrame );
		}
	}
	
	if( this.useMask ){
		this.mask = document.createElement( 'div' );
      this.mask.setAttribute( 'id', 'pageMask' );
		document.body.appendChild( this.mask );
	}
}

function _changeSource(url){
	
	this.url = url;
	this.myFrame.setAttribute( 'src', this.url );
}

function _closeDialog(){
	this.myFrame.style.visibility = "hidden";
	this.myFrame.style.left = this.myFrame.style.top = "-1000px";
	//document.getElementById( "iframeDlgShadow" ).style.visibility = "hidden";
	if( this.useMask )
		this.mask.style.visibility = "hidden";
}

function _getDoc(){
	return window.frames[this.id].document;
}

function _showDialog(){
	
	if( this.useMask ){
		this.mask.style.width = (document.all)?document.body.scrollWidth:document.body.offsetWidth;
		this.mask.style.height = (document.all)?document.body.scrollHeight:document.body.offsetHeight;
		this.mask.style.visibility = "visible";
	}

	this.myFrame.style.visibility = "visible";
	
/*	if( this.shadow == null ){
		if( document.all ){
			var shdwHtml = "<div id='iframeDlgShadow' " +
				"style='visibility: hidden; z-index: 9999; position: absolute; left: " + (parseInt(this.myFrame.style.left)+5) +
				"; top: " + (parseInt(this.myFrame.style.top)+5)+"; " + "width: " + this.myFrame.style.width + 
				"; height: " + this.myFrame.style.height + "'></div>";
			document.body.insertAdjacentHTML( "beforeEnd", shdwHtml );
			this.shadow = document.all["iframeDlgShadow"];
		}else{
			this.shadow = document.createElement( "div" );
  	  this.shadow.setAttribute( "id", "iframeDlgShadow" );
			this.shadow.setAttribute( "style", "visibility: hidden; z-index: 9999; "+
				"position: absolute; left: " + (parseInt(this.myFrame.style.left)+5) +"; top: " + (parseInt(this.myFrame.style.top)+5)+"; "+
				"width: " + this.myFrame.style.width + "; height: " + this.myFrame.style.height +"; " );
			document.body.appendChild( this.shadow );	
		}
	}else{
		this.shadow.style.left = (parseInt(this.myFrame.style.left)+5);
		this.shadow.style.top = (parseInt(this.myFrame.style.top)+5);
		this.shadow.style.width = this.myFrame.style.width;
		this.shadow.style.height = this.myFrame.style.height;
	}
	
	this.shadow.style.visibility = "visible";	*/
}
