

/** ********************************************************************
 ** Glue_Dialog
 ** 
 ** <div id="overlay" />
 ** <div id="preview">
 ** 	<div id="preview_inner">
 ** 		<img id="preview_image" />
 ** 	</div>
 ** </div>
 ** *******************************************************************/

function Glue_Dialog( debug )
{
	if(debug) this._debug = debug;
}

Glue_Dialog.prototype =
{
	_debug: false,
	_pagesize: null,
	_scrollsize: null,

	init: function()
	{
		this._pagesize = glue.getPageSize();

		var body = glue.getByTag('body');
		var container = document.createElement('div');
		container.setAttribute( 'id', 'dialog' );
		container.style.zIndex = 100;
		container.style.display = 'none';
		body.appendChild(container);

		var inner = document.createElement('div');
		inner.setAttribute( 'id', 'dialog_inner' );
		container.appendChild(inner);
	},
	show: function( url )
	{
		this._pagesize = glue.getPageSize();
		this._scrollsize = glue.getPageScroll();

		overlay.show( this._pagesize[0], this._pagesize[1] );

		var container = glue.getByID('dialog');
		container.style.display = 'block';
		container.style.top = this._scrollsize[1] + ( this._pagesize[3] / 10 ) + 'px';

		var inner = glue.getByID('dialog_inner');
		var iframe = document.createElement('iframe');
		iframe.setAttribute( 'id', 'dialog_content' );
		iframe.setAttribute( 'src', url );
		iframe.setAttribute( 'frameBorder', 0 );
		inner.appendChild(iframe);
	},
	showgym: function( url )
	{
		this._pagesize = glue.getPageSize();
		this._scrollsize = glue.getPageScroll();

		overlay.show( this._pagesize[0], this._pagesize[1] );

		var container = glue.getByID('dialog');
		container.style.display = 'block';
		container.style.top = this._scrollsize[1] + ( this._pagesize[3] / 10 ) + 'px';

		var inner = glue.getByID('dialog_inner');
		inner.style.height = '600px';
		var iframe = document.createElement('iframe');
		iframe.setAttribute( 'id', 'dialog_content' );
		iframe.setAttribute( 'src', url );
		iframe.setAttribute( 'height', '100%' );
		iframe.setAttribute( 'frameBorder', 0 );
		inner.appendChild(iframe);
		//IE6表示対策
		if(document.all){
			iframe.src = url;
		}
	},
	showschool: function( url )
	{
		this._pagesize = glue.getPageSize();
		this._scrollsize = glue.getPageScroll();

		overlay.show( this._pagesize[0], this._pagesize[1] );

		var container = glue.getByID('dialog');
		container.style.display = 'block';
		container.style.top = this._scrollsize[1] + ( this._pagesize[3] / 10 ) + 'px';

		var inner = glue.getByID('dialog_inner');
		inner.style.height = '640px';
		var iframe = document.createElement('iframe');
		iframe.setAttribute( 'id', 'dialog_content' );
		iframe.setAttribute( 'src', url );
		iframe.setAttribute( 'height', '100%' );
		iframe.setAttribute( 'frameBorder', 0 );
		inner.appendChild(iframe);
		//IE6表示対策
		if(document.all){
			iframe.src = url;
		}
	},
	showreissue: function( url )
	{
		this._pagesize = glue.getPageSize();
		this._scrollsize = glue.getPageScroll();

		overlay.show( this._pagesize[0], this._pagesize[1] );

		var container = glue.getByID('dialog');
		container.style.display = 'block';
		container.style.top = this._scrollsize[1] + (( this._pagesize[3] - 300 )/2) + 'px';

		var inner = glue.getByID('dialog_inner');
		inner.style.height = '300px';
		var iframe = document.createElement('iframe');
		iframe.setAttribute( 'id', 'dialog_content' );
		iframe.setAttribute( 'name', 'dialog_content_iframe' );
		iframe.setAttribute( 'height', '100%' );
		iframe.setAttribute( 'frameBorder', 0 );
		iframe.setAttribute( 'src', url );
		inner.appendChild(iframe);
		//IE6表示対策
		if(document.all){
			iframe.src = url;
		}
	},
	hide: function()
	{
		overlay.hide();

		glue.getByID('dialog').style.display = 'none';
		var inner = glue.getByID('dialog_inner');
		var iframe = glue.getByID('dialog_content');
		inner.removeChild(iframe);
	}
}

function initDialog()
{
	initOverlay();
	dialog = new Glue_Dialog();
	dialog.init();
}

Event.observe( window, 'load', initDialog, false );