
// ================================================================================
// 配列にプロトタイプを追加
// ================================================================================
// --------------------------------------------------------
// 配列を指定値で埋める
// --------------------------------------------------------
Array.prototype.fill = function( initValue )
{
	for ( var i = 0; i < this.length; i++ ) this[ i ] = initValue;
}

// --------------------------------------------------------
// 配列をクリア
// --------------------------------------------------------
Array.prototype.clear = function()
{
	this.fill( 0 );
}

// ================================================================================
// 配列にプロトタイプを追加
// ================================================================================
// --------------------------------------------------------
// 指定名のオブジェクトを返す
// --------------------------------------------------------
function getNameObj( name )
{
	var target = null;
	
	if ( document.all )
	{
		target = document.all( name );
	}
	else if ( document.getElementById )
	{
		target = document.getElementById( name );
	}
	return target;
}

// --------------------------------------------------------
// 表示・非表示の切り替え
// --------------------------------------------------------
function changeVisible( name, bVisible )
{
	var target = getNameObj( name );
	if ( target )
	{
		target.style.display = ( bVisible ) ? "block": "none";
	}
}

// --------------------------------------------------------
// 指定オブジェクトのクラスを変更
// --------------------------------------------------------
function changeClass( name, className )
{
	var target = getNameObj( name );
	if ( target )
	{
		target.className = className;
	}
}

// --------------------------------------------------------
// 指定オブジェクトの画像を変更
// --------------------------------------------------------
function changeImage( name, imageFile )
{
	var target = getNameObj( name );
	if ( target )
	{
		target.src = imageFile;
	}
}

// ================================================================================
// XML
// ================================================================================
// ========================================================
// XML要素の取り出し
// ========================================================
function elv( xml, name )
{
	var node = xml.getElementsByTagName( name );
	if ( node )
	{
		if ( 0 < node.length )
		{
			if ( node[ 0 ].firstChild )
			{
				if ( node[ 0 ].firstChild.nodeValue )
				{
					return node[ 0 ].firstChild.nodeValue;
				}
			}
		}
	}
	return "";
}

// ================================================================================
// Window版IE用にエスケープ
// ================================================================================
function toXmlEscape( str )
{
	return ( document.all ) ? escape( str ): str;
}

// ================================================================================
// 現在のウインドウサイズを返す
// ================================================================================
function getWindowInnerSize()
{
	if ( document.all )
	{
		return {
			width:document.documentElement.clientWidth,
			height:document.documentElement.clientHeight
		};
	}
	else if ( document.getElementById )
	{
		return {
			width:window.innerWidth,
			height:window.innerHeight
		};
	}
}

