// ======================================================
//
// baseArea areacount
//
// ======================================================
function POPMAP()
{
	this.bool_put 	= false;
	this.layer_put	= document.body;

	this.bool_startScroll	= false;

	this.div_base = xCreateDiv();
	this.div_base.style.position			= "absolute";
	this.div_base.style.zIndex				=  20000;
	this.div_base.style.border				= "0";
	this.div_base.style.overflow			= "hidden";
	this.div_base.style.visibility			= "hidden";
	this.div_base.style.backgroundColor		= "white";

	this.div_base.style.borderStyle			= 'solid';
	this.div_base.style.borderWidth			= '2px';
	this.div_base.style.borderColor			= '#663333';

xInnerHtml( this.div_base, "<html><head><!-- σώ(MOJIBAKE TAISAKU) --><META content='text/html; charset=euc-jp' http-equiv=Content-Type></head><body><table width=100% cellpadding=0 cellspacing=0 bgcolor=#cc0000><tr><td class=big1 align=center><a href='javascript:void();' onClick='obj_popmap.close();return false;'><font color=white><b>X CLOSE X</b></font></a></b></td></tr></table><div id='inner_popmap' class='inner_popmap'></div></body></html>");

	var innerIFrameDivList = getElementsByClassName('inner_popmap', 'div', this.div_base );
	if( innerIFrameDivList.length > 0 ){
		this.div_innerIFrame = innerIFrameDivList[0];
	}

	this.div_iframe		 			 = document.createElement('IFRAME');
	this.div_iframe.id				 = 'popmap'
	this.div_iframe.name			 = 'popmap'
	this.div_iframe.style.position	 = 'relative';
	this.div_iframe.style.zIndex	 = 10;
	this.div_iframe.style.visibility = 'visible';
	this.div_iframe.style.scrolling	 = 'auto';

	this.scrollHandler = JMap2EventHandler( this, 'onScroll' );

}

// rePos
POPMAP.prototype.rePos = function()
{
	if( this.bool_put == false ){ return; }

	setDivPosXY(  this.div_base, 20, xScrollTop() );
	setDivSizeWH( this.div_base, xClientWidth() - 60, xClientHeight() - 20 );
}

// scroll 
POPMAP.prototype.onScroll = function()
{
	if( this.bool_put == false ){ return; }

	this.rePos();
}

POPMAP.prototype.startScroll = function()
{
	if( this.bool_put == false ){ return; }

	if( this.bool_startScroll == false ){
		JMap2AttachEvent(window, 'scroll', this.scrollHandler );
		this.bool_startScroll = true;
	}
}

POPMAP.prototype.stopScroll = function()
{
	if( this.bool_put == false ){ return; }

	if( this.bool_startScroll == true ){
		JMap2DetachEvent(window, 'scroll', this.scrollHandler );
		this.bool_startScroll = false;
	}
}

// show
POPMAP.prototype.show = function( src )
{
	setDivPosXY(  this.div_base, 20, xScrollTop() );
	setDivSizeWH( this.div_base, xClientWidth() - 60, xClientHeight() - 20 );

	setDivSizeWH( this.div_iframe, xClientWidth() - 65, xClientHeight() - 40 );

	if( this.bool_put == true ){
		this.div_iframe.src = '/ssincl/null.htm';
		this.close();
	}

	if( this.bool_put == false ){
		this.div_iframe.src = src;

		this.layer_put.appendChild( this.div_base );
		this.div_innerIFrame.appendChild( this.div_iframe );
		this.bool_put = true;
	}

	this.startScroll();
	showDiv( this.div_base );
}

// close
POPMAP.prototype.close = function()
{
	hideDiv( this.div_base );
	this.stopScroll();

	if( this.bool_put == true ){
		this.div_innerIFrame.removeChild( this.div_iframe );
		this.layer_put.removeChild( this.div_base );
		this.bool_put = false;
	}
}

var obj_popmap = new POPMAP();

