var nextpage;
var ua = navigator.userAgent;
var mouseX;
var mouseY;

function getSwf(id)
{
	if (navigator.appName.indexOf("Microsoft") != -1) return window[id];
	else return document[id];
}

function transition(page)
{
	nextpage = page;
	getSwf("bg").sendEraseInstToSwf();
}

function sendEraseFinishedEventToJs()
{
	// z-indexを処理
	document.getElementById('flasharea').style.zIndex = 3;
	
	getSwf("bg").sendOutroInstToSwf();
}

function sendOutroFinishedEventToJs()
{
	location.href = nextpage;
}

function sendWrapLayerShowToJs()
{
	document.getElementById('wrap').style.display = 'block';
	
	// z-indexを処理
	document.getElementById('flasharea').style.background = 'none';
}

var jumpTimer;

function sendWrapLayerBehindToJs()
{
	document.getElementById('flasharea').style.zIndex = 1;
	
	if (document.URL.indexOf('/information/#') > 0)
	{
		jumpTimer = setTimeout(operaaaaa, 100);
		/*****
		var token = document.URL.split('#');
		location.href = '#'+token[1];
//		location.hash = token[1];
		*****/
	}
}

function operaaaaa()
{
	var token = document.URL.split('#');
	location.href = '#'+token[1];
//	location.hash = token[1];
	clearTimeout(jumpTimer);
}

function mouse()
{
	var scrl = getScroll();
	
	var x = ua.indexOf('MSIE 7') > 0 ? mouseX : mouseX-scrl.x;
	var y = ua.indexOf('MSIE 7') > 0 ? mouseY : mouseY-scrl.y;
	return x+','+y;
}

function getMouseX(e)
{
	if(window.opera) return e.clientX;
	else if(document.all) return document.body.scrollLeft+event.clientX;
	else if(document.layers||document.getElementById) return e.pageX;
}

function getMouseY(e)
{
	if(window.opera) return e.clientY;
	else if(document.all) return document.body.scrollTop+event.clientY;
	else if(document.layers||document.getElementById) return e.pageY;
}

function getScroll()
{
	return {
		x: document.body.scrollLeft || document.documentElement.scrollLeft,
		y: document.body.scrollTop  || document.documentElement.scrollTop
	}
}

function userAgent()
{
	return ua;
}

