///////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
//
//
//
///////////////////////////////////////////////////////////////////////////////


//=======================================================================
//DIV領域の大きさの初期化
//
//
//
//
//
//
//
//=======================================================================
function div_init(div)
{
	if(document.layers) return;
	
	if(typeof div.style.width!="undefined"&& typeof div.style.width=="string")
	{
		div.style.width =div.offsetWidth +'px';
		div.style.height=div.offsetHeight+'px';
	}
	else if(typeof div.style.pixelWidth!="undefined")
	{ 
		div.style.pixelWidth =div.offsetWidth;
		div.style.pixelHeight=div.offsetHeight;
	}
}

//=======================================================================
//DIVの高さの取得
//
//
//
//
//
//
//
//=======================================================================
function div_get_height(div)
{
	return document.layers?div.clip.height:(div.offsetHeight||div.style.pixelHeight||0);
}
//=======================================================================
//DIVの幅の取得
//
//
//
//
//
//
//
//=======================================================================
function div_get_width(div)
{
	return document.layers?div.clip.width:(div.offsetWidth || div.style.pixelWidth || 0);
}
//=======================================================================
//DIVのTOP位置の取得
//
//
//
//
//
//
//
//=======================================================================
function div_get_top(div)
{
	if(typeof window.crypto!="undefined" && typeof window.getComputedStyle!="undefined")
	{ 
		return parseInt(div.style.top);
	}
	else 
	{
		return document.layers?div.top:(div.offsetTop || div.style.top || div.style.pixelTop || 0);
	}

}
//=======================================================================
//DIVのLEFT位置の取得
//
//
//
//
//
//
//
//=======================================================================
function div_get_left(div)
{
	return document.layers?div.clip.left:(div.offsetLeft || div.style.pixelLeft || 0);
}


//=======================================================================
//DIVの取得
//
//
//
//
//
//
//
//=======================================================================
function div_get_object(div_name)
{
 
	if(document.getElementById) return document.getElementById(div_name); 
	if(document.all) return document.all(div_name); 
	
	if(document.layers)
	{ 
		var s='';
		for(var i=1; i<arguments.length; i++)
			s+='document.layers.'+arguments[i]+'.';
		
		return eval(s+'document.layers.'+div_name);
	}
	
	return null;
}

//=======================================================================
//DIVのレイヤー内での移動
//
//
//
//
//
//
//
//=======================================================================
function div_move_layer(div,left,top)
{
	if(document.layers)
	{ 
		div.moveBy(left,top); 
		return; 
	} 
	
	if(typeof window.crypto!="undefined" && typeof window.getComputedStyle!="undefined")
	{ 
		div.style.left=(parseInt(div.style.left)+Math.round(left))+'px';
		div.style.top =(parseInt(div.style.top) +Math.round(top) )+'px';
		return;
	}
	 
	if(typeof div.style.left!="undefined"&& typeof div.style.left=="string")
	{
		div.style.left=(div.offsetLeft+Math.round(left))+'px';
		div.style.top =(div.offsetTop +Math.round(top) )+'px';
		return; 
	}
	
	if(typeof div.style.pixelLeft!="undefined")
	{
		div.style.pixelLeft+=Math.round(left);
		div.style.pixelTop +=Math.round(top);
		return;
	}
}

//=======================================================================
//DIVの画面上での移動
//
//
//
//
//
//
//
//=======================================================================
function div_move_window(div,left,top)
{
	if(document.layers)
	{ 
		div.moveTo(left,top);
		return; 
	} 
	
	if(typeof div.style.left!="undefined"&& typeof div.style.left=="string")
	{ 
		div.style.left=left+'px';
		div.style.top =top +'px';
	}
	else if(typeof div.style.pixelLeft!="undefined")
	{ 
		div.style.pixelLeft=left;
		div.style.pixelTop =top;
	}

}

//=======================================================================
//DIV領域の表示、非表示
//
//
//
//
//
//
//
//=======================================================================
function div_visible(div,visible)
{
	(div.style || div).visibility = (visible)?((window.opera && !document.documentElement)?
									'visible':'inherit'):'hidden';
}

