// ログインチェックの結果
var retVal = false;

/**
 * Gポータルで共通で使用するJavaScript
 * @author Gportal
 * @version 1.0
 *
 */

function isValidDate( year, month, day ) {
	if ( year < 1900 || year > 2006 || month < 1 || day < 1 ) {
		return false;
	}
	var vYear = year;
	var vMonth = month - 1;
	var vDay = day;
	var date = new Date( vYear, vMonth, vDay );
	if ( isNaN(date) ) {
		return false;
	} else if ( date.getFullYear() != vYear || date.getMonth() != vMonth || date.getDate() != vDay ) {
		return false;
	}

	return true;
}

/**
 * 引数で与えられたURLと、ウィンドウサイズ(Xサイズ,Yサイズ)
 * オプション設定を渡すことで次画面を別ウィンドウにて表示させる
 * @author J.nishimoto
 * @param addr URL
 * @param name ウィンドウ名
 * @param x ウィンドウxサイズ
 * @param y ウィンドウyサイズ
 * @param optionflg オプション
 * @return 新規ウィンドウ
 */
function newWindow(addr, name, x, y, optionflg) {
  // option設定
  optionvalue = ''+ optionflg + ',width=' + x + ',height=' + y;
  // 新規ウィンドウオープン
  window.open(addr ,name ,optionvalue);
}

/**
 * 引数で与えられたdoと、ウィンドウサイズ(Xサイズ,Yサイズ)
 * オプション設定を渡すことで次画面を別ウィンドウにて表示させる
 * @author M.shimoda
 * @param addr URL(拡張子抜き)
 * @param name ウィンドウ名
 * @param x ウィンドウxサイズ
 * @param y ウィンドウyサイズ
 * @param optionflg オプション
 * @return 新規ウィンドウ
 */
function newWindow2(addr, name, x, y, optionflg) {
  // option設定
  optionvalue = ''+ optionflg + ',width=' + x + ',height=' + y;
  // 新規ウィンドウオープン
  window.open(addr ,name ,optionvalue);
}

/**
 * 引数で与えられたURLと、ウィンドウサイズ(Xサイズ,Yサイズ)
 * オプション設定を渡すことで次画面を別ウィンドウにて表示させる(IE4以上限定)
 * また、開いたウィンドウを閉じた際にreturnValueに値が設定されていると
 * 戻り値として受け取ることが可能
 * @author J.nishimoto
 * @param addr URL
 * @param name ウィンドウ名
 * @param x ウィンドウxサイズ
 * @param y ウィンドウyサイズ
 * @param optionflg オプション
 * @return returnValue値
 */
function newWindowModal(addr, name, x, y, optionflg) {
  // option設定
  optionvalue = ''+ optionflg + ';dialogWidth:' + x + 'px;dialogHeight:' + y + 'px';
  // 新規ウィンドウオープン
  value = window.showModalDialog(addr ,name ,optionvalue);
  return value;
}

/**
 * 引数で与えられた文字がnullまたは空文字でないかどうかをチェックする
 * @author nanasihma
 * @param aString 文字列
 * @return true:null、または空文字 false:nullまたは空文字以外
 */
function chkempty(aString) {
    if (aString == null || aString == '') {
        return false;
    } else {
        return true;
    }
}

/**
 * 引数で与えられた文字列が数値(0-9)以外かどうかをチェックする
 * @author J.nishimoto
 * @param aString 文字列
 * @return true: 数値 false:数値以外
 */

function chknum(aString) {
    if(aString.match(/[0-9]/) == false){
        return false;
    }
    return true;
}


/**
 * 引数で与えられた文字列が指定された文字数の範囲内かどうかを判定する
 * @author J.nishimoto
 * @param aIntString 文字列
 * @param minInt     最小値 -1を指定すると最大値チェックのみ
 * @param maxInt     最大値
 * @return -1: 最小値より短い -2: 最大値より長い
 *          0: 正常
 */

function betweenchk(aString, minInt, maxInt) {
    var minchkflg = 0;
    var count = 0;
    if(minInt == -1){
        minchkflg = 1;
    }

    count = aString.byteLength();

    if(minchkflg == 0 && count < minInt){
        return -1;
    }
    if(count > maxInt){
        return -2;
    }

    return 0;
}

/**
 * 自分のG-Coins数、Chibi Coin数、未読ミニメール件数を動的に変更する
 * @author M.shimoda
 */
function changeMyData()
{
	DWREngine.setTimeout(1000);		// DWRタイムアウト時間設定
	DWREngine.setAsync(true);		// 非同期的に実行(trueで非同期)
	ChangeAvatarInfo.getAvatarInfo(CallbackAvatarInfo);
}

/**
 * G-Coins、Chibi Coin、本日取得Chibi Coin、新着ミニメール件数取得
 * @author M.shimoda
 * @param value AvatarInfoForm
 */
function CallbackAvatarInfo(value)
{
	var strgcoin      = document.createTextNode(value.gcoin);
	var strtodaypcoin = document.createTextNode(value.todayPcoin);
	var strpcoin      = document.createTextNode(value.pcoin);

    var gCoin = document.getElementById('nowGCoin');
    if(gCoin != null) {
        gCoin.removeChild(gCoin.lastChild);
        gCoin.appendChild(strgcoin);
    }

    var pCoin = document.getElementById('nowPCoin');
    if(pCoin != null) {
        pCoin.removeChild(pCoin.lastChild);
        pCoin.appendChild(strpcoin);
    }

    var todayPCoin = document.getElementById('todayPCoin');
    if(todayPCoin != null) {
        todayPCoin.removeChild(todayPCoin.lastChild);
        todayPCoin.appendChild(strtodaypcoin);
    }
//	var miniMail = document.getElementById('nowMiniMail');
//	miniMail.removeChild(miniMail.lastChild);
//	var strminimail = document.createTextNode('('+value.miniMail+')');
//	if(value == 0){	// 0件の場合表示しない
//		miniMail.style.visibility = "hidden";
//	}else{
//		miniMail.style.visibility = "visible";
//	}
//	miniMail.appendChild(strminimail);
}


/**
 * マイアバタ部分を一緒に変更する
 * @author M.shimoda
 * @param name ユーザーのアカウントID、自分の場合には''を指定する
 * @param subaddr 変更するアドレス：subフレーム,nullで変更しない
 * @param mainaddr 変更するアドレス：mainフレーム,nullで変更しない
 */
var subUrlTime = new Date();	// 最終更新時間
var subUrl  = null;				// サブメニュー部分URL

function ChangeWithMyAvatar(name,subaddr,mainaddr)
{
	location.href = mainaddr;
/*
	var str = '/tinierme/profileChange.do'
	var user = '?accountID='+name;

	top.profile.location.href = str+user;

	if(subaddr != null){
		var now = new Date();
		// 異なるURLまたは5分以上経過している場合に実行
		if ( ( subUrl != subaddr ) || ( now.getTime() > subUrlTime.getTime() + 1000*60*5 ) ) {
			top.submenu.location.href = subaddr;
		}
	}
	if(mainaddr != null){
		top.main.location.href = mainaddr;
	}
*/
}


/**
 * マイアバタ部分以外を変更
 * @author M.shimoda
 * @param subaddr 変更するアドレス：subフレーム
 * @param mainaddr 変更するアドレス：mainフレーム
 */
function ChangeWithoutMyAvatar(subaddr,mainaddr)
{
location.href = mainaddr;
/*
	if(subaddr != null){
		var now = new Date();
		// 異なるURLまたは5分以上経過している場合に実行
		if ( ( subUrl != subaddr ) || ( now.getTime() > subUrlTime.getTime() + 1000*60*5 ) ) {
			top.submenu.location.href = subaddr;
		}
	}
	if(mainaddr != null){
		top.main.location.href = mainaddr;
	}
*/
}

/**
 * サブメニュー部分の表示時間とURLを保存
**/
function setSubmenuUrl(subaddr) {
	subUrl = subaddr;
	subUrlTime = new Date();
}

/**
 * 元の衣装に戻す（マイアバタ）
 * @author M.shimoda
 * @param accountId アカウントID
 */
function ChangeDefaultMyAvatar(accountId)
{
	var addr = "image2.tinierme.com/type2.php?account_id="+accountId;
	document.avatar_cb.avatar_main.src = addr;
}

/**
 * 初期状態に戻す（マイアバタ）
 * @author M.shimoda
 */
function ChangeSimpleMyAvatar()
{
	var addr = "image2.tinierme.com/type1.php";
	document.avatar_cb.avatar_main.src = addr;
}

/**
 * mainフレームの高さを動的に変更
 * @author M.shimoda
 * @param _y 高さ：'1500pix' のように表記
 */
/*function ChangeMainFrameHeight(_y)
{
	var ht=top.document.getElementById('main');
	ht.height=_y;
	// AjaX読み込みで表示しているタグを隠す
	top.document.getElementById('ajaxMain').style.visibility = "hidden";
	top.document.getElementById('ajaxMain').innerHTML = '';
}*/
/**
 * mainフレームの高さを動的に変更
 * @author M.shimoda
 * @param _y 高さ：'1500pix' のように表記
 */
function ChangeMainFrameHeight2(_y){
var ht= top.document.getElementsByName('main')[0];
if(top.document.getElementsByName('main')[0]){
			var ht=top.document.getElementsByName('main')[0];
			ht.height=_y;
			// AjaX読み込みで表示しているタグを隠す
			if(top.document.getElementById('ajaxMain')){
				top.document.getElementById('ajaxMain').style.visibility = "hidden";
				top.document.getElementById('ajaxMain').innerHTML = '';
			}
}
	else if( !(ht!= '' || ht != 'undefined' || ht != null) ){
		ht.height=_y;
	}
}
/**
 * mainフレームの高さを自動で変更
 * @author K.futa
 * @param _y 高さ：500以下だったら有効、以上だと無視
 */
/*function ChangeMainFrameHeight(_y){
var targetFrame = top.document.getElementById('mainarea_upper');
	if(top.document.getElementById('mainarea_upper'))
	{
	var true_height;
	var app = navigator.appName.charAt(0);
	if(navigator.userAgent.indexOf('Safari') != -1)
	{
	true_height = document.body.scrollHeight + 'px';
	//alert('safari');
	}
	else if (app == "N")
	{
	true_height = document.height + 'px';
	//alert('fx');
	}
	else
	{
	true_height = document.body.scrollHeight + 40 + 'px';
	//alert('ie');
	}
		//変数設定が500以上だったら自動設定し、500以下なら変数設定の高さ
		if ( 500 > true_height ){
			if( _y != undefined ){
				targetFrame.style.height=_y;
			}
			else targetFrame.style.height= 500;
		}
		else targetFrame.style.height = parseInt(true_height) + 'px';
		// AjaX読み込みで表示しているタグを隠す
		if(top.document.getElementById('ajaxMain')){
			top.document.getElementById('ajaxMain').style.visibility = "hidden";
			top.document.getElementById('ajaxMain').innerHTML = '';
		}
	}
	else if( !(_y!= '' || _y != 'undefined' || _y != null) ){
	targetFrame.style.height = parseInt(true_height);
	}
//	alert(true_height);

}*/
function ChangeMainFrameHeight(_y){
//Ajax読み込み部分隠蔽
	if(top.document.getElementById('ajaxMain')){
		top.document.getElementById('ajaxMain').style.visibility = "hidden";
		top.document.getElementById('ajaxMain').innerHTML = '';
	}
/*
<div id="mainAreaDivision" class="afterLoginMain">
<iframe src="/tinierme/main2.html" name="main" scrolling="No" width="786" height="670" frameborder="0" id="mainarea_upper" allowtransparency="true"></iframe>
<div id="ajaxMain" style="visibility:hidden;overflow:hidden;"></div>
afterLoginSubExtention
*/
	if(top.document.getElementById('mainAreaDivision')){
		top.document.getElementById('mainAreaDivision').style.width = 626 + 'px';
	}
	if(top.document.getElementById('mainarea_upper')){
		top.document.getElementById('mainarea_upper').style.width = 626 + 'px';
	}
	if(top.document.getElementById('afterLoginSubExtention')){
		top.document.getElementById('afterLoginSubExtention').style.display = 'block';
	}








	function mainarea_upperFrameStabilizer()
	{
		//Nowのドキュメントの高さを取得
		var trueHeight;
		if( !top.document.getElementById('mainarea_upper') ) return false;//オブジェクト検知
		var targetFrame = top.document.getElementById('mainarea_upper');
		if(top.document.getElementById('mainarea_upper'))
		{
			var app = navigator.appName.charAt(0);
				if(navigator.userAgent.indexOf('Safari') != -1)
				{
				trueHeight = document.body.clientHeight;
				}
				else if (app == "N")
				{
				trueHeight = document.height;
				}
				else if (window.opera)
				{
				trueHeight = document.body.scrollHeight;
				}
				else
				{
				trueHeight = document.body.scrollHeight;
				}
		}
		//alert(trueHeight);
		//引数「_y」が500以下だった処理
		if ( 500 > trueHeight )
		{
			targetFrame.style.height=_y + 'px';
		}
		else
		{
			targetFrame.style.height=trueHeight + 'px';
		}
	}
setTimeout(mainarea_upperFrameStabilizer,0);
}
/*
function ChangeMainFrameHeight(_y){
var ht= top.document.getElementsByName('main')[0];
	if(top.document.getElementsByName('main')[0]){
		var ht=top.document.getElementsByName('main')[0];
		var true_height = document.body.scrollHeight;
		//変数設定が500以上だったら自動設定し、500以下なら変数設定の高さ
		if ( 500 > true_height ){
			if( _y != undefined ){
				ht.height=_y;
			}
			else ht.height= 500;
		}
		else ht.height = parseInt(document.body.scrollHeight+20);
		// AjaX読み込みで表示しているタグを隠す
		if(top.document.getElementById('ajaxMain')){
			top.document.getElementById('ajaxMain').style.visibility = "hidden";
			top.document.getElementById('ajaxMain').innerHTML = '';
		}
	}
	else if( !(ht!= '' || ht != 'undefined' || ht != null) ){
	ht.height = parseInt(document.body.scrollHeight+20);
	}
}
*/
/*
function frameHeightStabilizer()
{
if( !parent.document.getElementById('mainarea_upper') ) return false;//ログイン後iframeがなければ終了
	if(parent.document.getElementById('mainarea_upper'))
	{
		var targetFrame = parent.document.getElementById('mainarea_upper');
		var app = navigator.appName.charAt(0);
		if(navigator.userAgent.indexOf('Safari') != -1)
		{
		targetFrame.style.height = document.body.scrollHeight + 'px';
		}
		else if (app == "N")
		{
		targetFrame.style.height = document.height + 'px';
		}
		else
		{
		targetFrame.style.height = document.body.scrollHeight  + 'px';
		}
	}
}
*/


function votePetitCoin( id ) {
	PetitCoinVote.votePetitCoin(id, voteCallback);
}

function voteCallback(retval) {
	if ( retval == true ) {
		//alert('Chibi CoinをGiftしました');
		alert('You have sent this user one Chibi Coin');
	} else {
		//alert('Chibi CoinをGiftできませんでした');
		alert('You could not give this user a Chibi Coins');
	}
}

function sendFriendMail(url){
	//window.open(url, 'friendRegist','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=800,height=500');
	location.href = url;
}

// Stringメソッドの追加定義
String.prototype.startsWith = function( match ) {
	if ( match.length > this.length ) {
		return false;
	}
	return match == this.substring( 0, match.length );
}

String.prototype.endsWith = function( match ) {
	if ( match.length > this.length ) {
		return false;
	}
	return match == this.slice( ~match.length + 1 );
}

String.prototype.trim = function() {
	return this.replace( /^\s+|\s+$/g, "" );
}

String.prototype.rtrim = function() {
	return this.replace( /^\s+/g, "" );
}

String.prototype.ltrim = function() {
	return this.replace( /\s+$/g, "" );
}

String.prototype.isContainTwoByteChar = function() {
	for ( var i = 0; i < this.length; i++ ) {
		var code = this.charCodeAt( i );
		var c = escape( this.charAt( i ) );

		if( code >= 0xff61 && code <= 0xff9f ) {
			continue;
		} else if( c.length > 2 && c.charAt( 1 )  == 'u' ) {
            return true;
		}
	}

	return false;
}

String.prototype.byteLength = function() {
	var count = 0;

	for ( var i = 0; i < this.length; i++ ) {
		count += ( this.charAt( i ).isContainTwoByteChar() ) ? 2 : 1;
	}

	return count;
}

String.prototype.isEmpty = function() {
	return ( this.trim() == "" );
}

String.prototype.isNotEmpty = function() {
	return !this.isEmpty();
}


function FortuneDiary(accountId,title,body)
{

	top.profile.location.href='/tinierme/profileChange.do?accountID='+accountId;

	var form = document.createElement('form');
	form.method = "POST";
	form.action = "newdiary.do";
	form.target = "main";

	var input;
	input = document.createElement('input');
	input.name = 'diaryTitle';
	input.type = 'hidden';
	input.value = title;
	form.appendChild(input);

	input = document.createElement('input');
	input.name = 'diaryText';
	input.type = 'hidden';
	input.value = body;
	form.appendChild(input);

	input = document.createElement('input');
	input.name = 'diaryType';
	input.type = 'hidden';
	input.value = '1';
	form.appendChild(input);

	document.getElementsByTagName('body')[0].appendChild(form);
	form.submit();
//	top.main.location.href='/tinierme/newdiary.do?diaryTitle='+title+'&diaryText='+body;
}

function FortuneTicket(accountId)
{
	/*
	top.profile.location.href='/tinierme/profileChange.do?accountID='+accountId;
	top.submenu.location.href='/tinierme/html/shop/abatar.html';
	top.main.location.href='/tinierme/itemshop.do?corner=3001&shelf=0&page=1&sortType=0';
	*/
	location.href='/tinierme/itemshop.do?corner=3001&shelf=0&page=1&sortType=0';
}

function FortuneMiniPage(accountId)
{
	var addr = '/tinierme/minipage.do?accountId='+accountId;
	window.open(addr,'MiniPage','resizable=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=680,height=480');
}

function FortuneTalismanPage()
{
	top.main.location.href="http://www.tinierme.com/tinierme/html/game/uranai/profit.html";
}

function GoToNoLoginTop()
{
	top.location.href="/tinierme/top.html";
}

function LeaveFortuneHouse()
{
	top.main_avatar.location.href="/tinierme/room.do?account_id=600000009";
}

function DemandLogin()
{
	//alert("アットゲームズにログインしてから\nゲームを開始してください");
	alert("Please start the game after logging in to TinierMe.");
	top.location.href="/tinierme/top.html";
}

function openMailRecvDetail(minimailId)
{
	newWindow2('/tinierme/miniMailReceiveDetail.do?offset=0&searchByIdFlag=1&miniMailId='+minimailId, 'minimail', 800, 520, 'resizable=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes');
}

/**
 * ログイン判定を行い、ログインしている場合は画面を開く
 */
function loginChkAndWinOpen(url){

	DWREngine.setTimeout(1000);		// DWRタイムアウト時間設定
	DWREngine.setAsync(false);		// 非同期的に実行(trueで非同期)

	// ログインされているかチェック
	isLogin.checkLogin(CallBackLoginChk);

	if(retVal == true){
		window.open(url, 'newWinPupUp');
	} else {
		//alert('ログインして下さい。');
		alert('Please log in.');
	}

	return retVal;
}

/**
 * ログイン判定結果を受け取る
 */
function CallBackLoginChk(result){
	retVal = result;
}

 /**
 * （トップページ）
 * ログイン処理時に使用する<br>
 * 入力がされていないかどうかをチェックする
 * @param data 入力されたデータ
 *
 */
function objnullchk(data){
  var result = true;
  if(data == null){
    result = false;
  }
  if(data == ""){
    result = false;
  }
  return result;
}

function submitConfirm(form,action){
	if(form.SUBSW.value == '1'){
		//alert('登録中です');
		alert('Registering');
		form.SUBSW.value = '0';
		return false;
	}
	form.SUBSW.value = '1';
	form.timezoneoffset.value = new Date().getTimezoneOffset();
	form.action = action;
	form.submit();
}


/**
* cookie有効性判定処理
* cookieが生成できるかを判定する
*/
function checkCookie(){
	setCookieCommon("cookiecheck","COOKIE-OK");
	if(getCookieCommon("cookiecheck") == "COOKIE-OK"){
		clearCookieCommon("cookiecheck");
		return true;
	} else {
		//alert('cookieが無効です。ブラウザの設定でcookieを有効にしてください。');
		alert('Cookies are disabled on your browser. \nPlease enable Cookies on your browser.');
		return false;
	}
}

function getCookieCommon(key){
	var start,end;
	var cookie=document.cookie+";";
	var keypos=cookie.indexOf(key,0);
	if(keypos!=-1){
		cookie=cookie.substring(keypos,cookie.length);
		start=cookie.indexOf("=",0)+1;
		end=cookie.indexOf(";",start);
		return(decodeURIComponent(cookie.substring(start,end)));
	}
	return("");
}

function setCookieCommon(key,value){
	tmp = key + "=" + encodeURIComponent(value) + ";";
	document.cookie = tmp;
}

function clearCookieCommon(key){
	tempdate =new Date();
	tempdate.setTime(tempdate.getTime() - 1);
	value = getCookieCommon(key);
	document.cookie = key + "=" + encodeURIComponent(value) + "; expires=" + tempdate.toGMTString();
}


function makeBreadCrumb()
{
	for(i=1;i<4;i++){
		var elem = document.getElementById('breadCrumb' + i);
		var id = getCookieCommon("breadcrumb_id" + i);
		var name = getCookieCommon("breadcrumb_name" + i);
		// クッキーに情報が入っていたらリンク作成
		if(id != ""){
			elem.innerHTML = '<a href ="/tinierme/mypage.do?accountId=' + id + '">' + name + '</a>';
		}
	}
}




/**
 * ページの先頭に戻るスクリプト
 * 追加者：片岡 俊貴
 * <a href="#" onclick="BackToPageTop(); return false;">を入れる
 */
function BackToPageTop() {
var x1 = x2 = x3 = 0;
var y1 = y2 = y3 = 0;
if (document.documentElement) {
x1 = document.documentElement.scrollLeft || 0;
y1 = document.documentElement.scrollTop || 0;
}
if (document.body) {
x2 = document.body.scrollLeft || 0;
y2 = document.body.scrollTop || 0;
}
x3 = window.scrollX || 0;
y3 = window.scrollY || 0;
var x = Math.max(x1, Math.max(x2, x3));
var y = Math.max(y1, Math.max(y2, y3));
window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
if (x > 0 || y > 0) {
window.setTimeout("BackToPageTop()", 25);
}
}


/*
ページスクロール関数
htmlの入れ方
<a href="javascript:Page_Smooth_Scroll('飛び先のid');">
*/

function Page_Smooth_Scroll(Target){
  var step=10;  //初速度
  var max=30;  //最高速度
  var accel=2;  //加速度
  var interval=8;  //加速インターバル
  var current_y = document.body.scrollTop  || document.documentElement.scrollTop;
  var element=document.getElementById(Target);
  if (!element){return true;}
  var target_y = 0;
  for (i = element;i.offsetParent;i=i.offsetParent ){
    target_y += i.offsetTop;
  }
  var count=0;
  if ( current_y > target_y ){ step = -(step); accel = -(accel);}
  var timerid = setInterval( function(){
    if (step<max) step += (count*accel);
    if ( Math.abs(current_y-target_y) < Math.abs(step) ){
      window.scrollTo((document.body.scrollTop  || document.documentElement.scrollTop),target_y);
      clearInterval(timerid);
      return false;
    }else{
      window.scrollBy(0,step);
      current_y += step;
      count++;
    }
  },interval);
}


/*
ブラウザ判別関数
それぞれのブラウザ名が返ってきます。
*/

function Browser_Check_Fun(){
if(window.opera){
return "Opera";
}else if(document.all){
return "IE";
}else if(typeof(Components)=="undefined"){
return "Safari";
}else if(typeof(Components)!="undefined"){
return "FireFox";
}else{
return "UBO";
}}


/*
ブラウザごとのお気に入り追加の関数
20080526Now 今のところsafariのみ機能がないのでボタンを表示してない
*/
function Bookmark_tuika_IE(){
//window.external.addFavorite("http://www.tinierme.com/","アットゲームズ－無料オンラインゲームやおもしろゲームでココロもつながる")
window.external.addFavorite("http://www.tinierme.com/","TinierMe - Make Friends and Play Free Online Games")
}

function Bookmark_tuika_Firefox(){
//window.sidebar.addPanel("アットゲームズ－無料オンラインゲームやおもしろゲームでココロもつながる","http://www.tinierme.com/","");
window.sidebar.addPanel("TinierMe - Make Friends and Play Free Online Games","http://www.tinierme.com/","");
}

function Bookmark_tuika_Fun(){
if(Browser_Check_Fun()=="Opera"){
//Bookmark_Html='<a href="http://www.tinierme.com/" rel="sidebar" title="アットゲームズ－無料オンラインゲームやおもしろゲームでココロもつながる">';
//Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="＠gamesをお気に入りに追加" border="0" width="155" height="21" class="rollover" /></a>';
Bookmark_Html='<a href="http://www.tinierme.com/" rel="sidebar" title="TinierMe - Make Friends and Play Free Online Games">';
Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="Add TinierMe to your Favorites" border="0" width="155" height="21" class="rollover" /></a>';
}else if(Browser_Check_Fun()=="IE"){
Bookmark_Html='<a href=\"javascript:Bookmark_tuika_IE();\">';
//Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="＠gamesをお気に入りに追加" border="0" width="155" height="21" class="rollover" /></a>';
Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="Add TinierMe to your Favorites" border="0" width="155" height="21" class="rollover" /></a>';
}else if(Browser_Check_Fun()=="Safari"){	//safariの時は表示しない
Bookmark_Html='';
}else if(Browser_Check_Fun()=="FireFox"){
Bookmark_Html='<a href=\"javascript:Bookmark_tuika_Firefox();\">';
//Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="＠gamesをお気に入りに追加" border="0" width="155" height="21" class="rollover" /></a>';
Bookmark_Html+='<img src="http://img.tinierme.com/common/img/header/bookmark_btn.gif" alt="Add TinierMe to your Favorites" border="0" width="155" height="21" class="rollover" /></a>';
}
document.getElementById("bookmark_tuika_btn").innerHTML=Bookmark_Html;
}

function voiceOffenderInfoDisp(voiceId, voiceType, offenderId)
{
	var addr = '/tinierme/voice/offenderInfoDisp.do?voiceId=' + voiceId + '&voiceType=' + voiceType + '&offenderId=' + offenderId;
	window.open(addr,'voiceOffender','resizable=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=660,height=390');
}
function voiceOffenderInfoDispForIntro(voiceId,voiceType,offenderId)
{
	var addr = '/tinierme/voice/offenderInfoDisp.do?forwardFlg=1&voiceId=' + voiceId + '&voiceType=' + voiceType + '&offenderId=' + offenderId;
	window.open(addr,'voiceOffender','resizable=yes,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=660,height=390');
}
/*
 * イベントリスナー関数
 * @param targetElement 対象のエレメント名
 * @param targetListener 対象のイベントハンドラ（「on」なしで）
 * @param yourFunction 関数名（引数なし：引数を入れる場合は、別途、別の関数定義が必要）
 * @return なし
 * @sample addEventFunc(window,"load",heightLine);
 */
function addEventFunc(targetElement,targetListener,yourFunction)
{
		try{
			targetElement.addEventListener(targetListener,yourFunction,false);
		}catch(e){
			targetElement.attachEvent("on"+targetListener,yourFunction);
		}
}
/*
インデックスページ
*/
function FirstFocus()
{
//オブジェクト検知
if(!document.getElementById) return false;
if(!document.getElementById('accountID')) return false;
if(!document.getElementById("password")) return false;
if(document.getElementById('mainarea_upper')) return false;//インラインフレームがあれば、実行しない

	if(document.getElementById("idSaveCheck") == null){
		document.getElementById('accountID').focus();
	} else {
		var retValid = getCookieIdSave();
		if(retValid != null){
			document.getElementById("accountID").value = retValid;
			document.getElementById("idSaveCheck").checked = true;
			document.getElementById("password").focus();
		} else {
			document.getElementById('accountID').focus();
			document.getElementById("idSaveCheck").checked = false;
		}
	}
}
function CheckEnter()
{
	if(window.event)
	{
		if (event.keyCode == 13)
		{
		toLowerIDPass();
		}
	}
}
function toLowerIDPass()
{
if(!document.getElementById) return false;
if(!document.getElementById('accountID')) return false;
if(!document.getElementById('password')) return false;
document.getElementById('accountID').value = document.getElementById('accountID').value.toLowerCase();
document.getElementById('password').value = document.getElementById('password').value.toLowerCase();
}
function noLoginMove(profile,submenu,mainmenu)
{
if(!document.getElementById) return false;
if(!document.getElementById('noLoginForm')) return false;
var form = document.getElementById('noLoginForm');
form.profile.value= profile;
form.submenu.value= submenu;
form.mainmenu.value = mainmenu;
form.submit();
}
function urlGet(profile,submenu,mainmenu){
if(!document.getElementById) return false;
if(!document.getElementById('noLoginForm')) return false;
var form = document.getElementById('noLoginForm');
form.profile.value= "/tinierme/html/account/index3_l.html";
form.submenu.value= "/tinierme/top3_lu.html";
form.mainmenu.value = "/tinierme/main.html";
form.submit();
}
function deleteID(form){
if(form.accountID.value == "ID"){
form.accountID.value = "";
}
}
function deletePasswd(form){
if(form.password.value == "PASSWORD"){
form.password.value = "";
}
}
function mainFrameChange(url) {
top.main.document.location.href=url;
}
function renewFrame(profile,submenu,mainmenu)
{
top.profile.location.href  = profile;
top.submenu.location.href  = submenu;
top.main.location.href = mainmenu;
}
function noLoginMove(profile,submenu,mainmenu)
{
if(!document.getElementById) return false;
if(!document.getElementById('noLoginForm')) return false;
var form = document.getElementById('noLoginForm');
form.profile.value  = profile;
form.submenu.value  = submenu;
form.mainmenu.value = mainmenu;
form.submit();
}
function PlayGame(gameId,addr)
{
top.submenu.location.href = gameId;
location.href = addr;
}
function nextFocus(){
if(!document.getElementById) return false;
if(!document.getElementById('accountID')) return false;
	document.getElementById('accountID').onBlur = function()
		{
		if(!document.getElementById('password')) return false;
		document.getElementById('password').focus();
		}
}
if(window.addEventListener)//modern browser
{
	window.addEventListener('load',FirstFocus,false);
}
else if(window.attachEvent)//MS IE
{
	window.attachEvent('onload',FirstFocus);
}


//オープニングSWF表示
function OPmv_Show_swf(flag_num){

var Show_swf_Source=

'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="607" height="235" id="opmv_base" align="middle">'+
'<param name="allowScriptAccess" value="always" />'+
'<param name="allowFullScreen" value="false" />'+
'<param name="movie" value="http://img.tinierme.com/account/swf/opmv_base.swf?first_mv_flag='+ flag_num +'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://img.tinierme.com/account/swf/opmv_base.swf?first_mv_flag='+ flag_num +'" quality="high" bgcolor="#ffffff" width="607" height="235" name="opmv_base" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
'</object>';

if(document.getElementById){
	document.getElementById("swfA").innerHTML=Show_swf_Source;
}
}
