

function init()
{
	//document.getElementById("aiu_index").style.visibility = "visible";
	ScrollBg();
}

function term()
{
	Normal_TdBorder();
}


function Draw_rdmTitle()
{
	var flg_rdm = Math.floor( Math.random() * 10 );
	var tmpTitle = new Array(10);
	
	tmpTitle[0] = "リンク集";
	tmpTitle[1] = "ザ・リンク集";
	tmpTitle[2] = "ターロック・オキャロランのリンク集";
	tmpTitle[3] = "ていうかリンク集";
	tmpTitle[4] = "なんとなくリンク集";
	tmpTitle[5] = "今日も今日とてリンク集";
	tmpTitle[6] = "こんにちわ、リンク集です";
	tmpTitle[7] = "リンク☆集";
	tmpTitle[8] = "脳髄が剥がれる！";
	tmpTitle[9] = "うけけけけけけ！";
	
	return( tmpTitle[flg_rdm] );
}


/* グローバル変数 */
FlashObject = null;
hTime = null;

function Flash_TdBorder( obj )
{
	if( !FlashObject )
	{
		FlashObject = obj;
		hTime = setTimeout( "Draw_TdBorder()", 16 );
	}
}

function Normal_TdBorder()
{
	clearTimeout( hTime );
	if( FlashObject )
	{
//		FlashObject.style.borderColor = "#DDFFDD";//"transparent";
		FlashObject.style.backgroundColor = "transparent";
		FlashObject = null;
	}
}

function Draw_TdBorder()
{
	var dt = new Date();
	var ms = dt.getMilliseconds();
	
	/* 色作成 */
	var strred = 125 - Math.floor( ms / 8 );
	var strgrn = 255 - Math.floor( ms / 4 );
	strred = "000" + strred.toString( 16 );
	strgrn = "000" + strgrn.toString( 16 );
	strred = strred.substr( strred.length-2, 2 );
	strgrn = strgrn.substr( strgrn.length-2, 2 );
	myMsg  = "#" + strred + strgrn + "FF";
	
	if( FlashObject )
	{
//		FlashObject.style.borderColor = myMsg;
		FlashObject.style.backgroundColor = myMsg;
		setTimeout( "Draw_TdBorder()", 16 );
	}
}

/* ---------------------------------- */

function Flash_TdBackground( obj )
{
	obj.style.backgroundColor = "#DDFFDD";

}

function Normal_TdBackground( obj )
{
	obj.style.backgroundColor = "#77EE77";
}

/* --------------------------------- */
/* スクロール                        */
/* --------------------------------- */
x = null;
y = null;
scrTimer = null;

function MoveTitleBg(ix,iy)
{
	var t_Elem = document.getElementById("rdmTitle");
	
	if( "Firefox" == checkBrowser() )
	{
		t_Elem.style.backgroundPosition = x + "px " + y + "px";
	}
	else
	{
		t_Elem.style.backgroundPositionX = x;
		t_Elem.style.backgroundPositionY = y;
	}
	x += ix;
	y += iy;
	if( ( 160 < x ) || (-160 > x ) )
	{
		x = 0;
	}
	if( ( 154 < y ) || (-154 > y ) )
	{
		y = 0;
	}
}

function ScrollBg(x,y)
{
	clearInterval(scrTimer);
	x = 0;
	y = 1;
	scrTimer = setInterval('MoveTitleBg(0,-1);',16);
}





function checkBrowser()
{
	var strUA = "";
	var strUA = navigator.userAgent.toLowerCase();
	var retval = null;
	
	if( strUA.indexOf("safari") != -1 )
	{
		retval = "Safari";
	}
	else if( strUA.indexOf("firefox") != -1 )
	{
		retval = "Firefox";
	}
	else if( strUA.indexOf("opera") != -1 )
	{
		retval = "Opera";
	}
	else if( strUA.indexOf("netscape") != -1 )
	{
		retval = "Netscape";
	}
	else if( strUA.indexOf("msie") != -1 )
	{
		retval = "Internet Explorer";
	}
	else if( strUA.indexOf("mozilla/4") != -1 )
	{
		retval = "Netscape.4";
	}
	return( retval );
}
