/*@cc_on _d=document;eval('var document=_d')@*/
/*
BRAVE nu Designz Inc.
Author: Akira Narita
Version: 1.0.0
*/

/*
ステータス
*/

var Status = 
{
		IE:!!(window.attachEvent && !window.opera),
		Opera:!!window.opera,
		WebKit:navigator.userAgent.indexOf('AppleWebKit/') > -1,
		Gecko:navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
		MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),
		UserOS:navigator.platform,
		XPath:!!document.evaluate,
		SelectorsAPI:!!document.querySelector,
		ElementExtensions:!!window.HTMLElement,
		SpecificElementExtensions:
		document.createElement('div')['__proto__'] &&
		document.createElement('div')['__proto__'] !==
		document.createElement('form')['__proto__'],
		ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',
		JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/
}

/*
タイマー
*/
var timer = 
{
	tid:null,
	mid:null,
	interval:1,

	start:function(_interval, _func)
	{
		timer.interval = Number(_interval);
		timer.onCompleteCallBackFunction=_func;
		if( timer.tid != null ) return false;
		timer.tid = setTimeout("timer.onComplete()", timer.interval);
	},
	onComplete:function()
	{
		clearTimeout(timer.tid);
		timer.tid = null;
		if(timer.onCompleteCallBackFunction!=null)
		{
			timer.onCompleteCallBackFunction();
			timer.onCompleteCallBackFunction=null;
		}
	},
	onCompleteCallBackFunction:null
};

/*
指定時間の処理を遅らせる
※負荷に注意
*/
function sleep(_time) {
	var d1 = new Date().getTime();
	var d2 = new Date().getTime();
	while (d2 < d1 + _time)
	{
		d2 = new Date().getTime();
	}
}


/*
対応スマートフォンのデバイスを取得
*/
function getDeviceType()
{
	if(navigator.userAgent.indexOf('iPad') > -1)
	{
		return "iPad";
	}
	else if(navigator.userAgent.indexOf('iPhone') > -1)
	{
		return "iPhone";
	}
	else if(navigator.userAgent.indexOf('Android') > -1)
	{
		return "Android";
	}
	else
	{
		return false; 
	}
}

/*
 ブラウザの向きが変った際に実行
 */
/*
function onOrientationChanged()
{
    if(getDeviceType()!=false)
    {
        window.scrollTo(0,0);
        var orient = ( Math.abs(window.orientation) === 90 ) ? 'landscape' : 'portrait';
        isLandscape = (orient == 'landscape')?true:false;
        orient+=getDeviceType();
        document.body.className = orient;
    }
}
*/

/*
タッチディスプレイ・スクロールの制御
*/
function onTouchMove()
{
    if(isLandscape==true)
    {
		// ランドスケープモード時にはiPadはスクロールを禁止する。
		if(getDeviceType()=="iPad")
		{
			event.preventDefault();
		}
    }
}

/*
3桁区切りでカンマを入れる
*/
function setNumberFormat(_num)
{
	var m = String(_num);
	var r = "";
	if(3<m.length)
	{
		for(var i = m.length, l = 1; i > 0; i--, l++)
		{
			r = (l%3 == 0 && l != m.length) ? ","+(m.substring((i-1),i)+r):(m.substring((i-1),i)+r);
		}
	}
	else
	{
		r = m;
	}
	return r;
}

/*
クエリの文字列を取得
*/
var queryObj = function()
{
	var obj={};
	if (location.search.length > 1)
	{
		var m = location.search.substr(1).split("&"); 
		var d;
		for (var i in m)
		{
			d = m[i].split("=");
			obj[d[0]] = d[1];
		}
	}
	else
	{
		obj.groupid = '';
	}

	return obj;
}();


