// BarkTunes 2002-2003
// Script Author: JusticeSide
//
// page navigator of english site
//
// File name: pagenavi_en.js

// setting section

var counter1 = 0;
var div_width = 0;
var add_width = 0;
var div_height = 0;
var add_height = 0;
var pagenavi_top_position = 0;
var pagenavi_left_position = 0;
var offset_value = 0;
var current_position = 0;
var top_locus = 0;

// 初期設定

function pagenaviInitilize()
	{
	getWindowSize();
	pagenaviLinkWrite();
	pagenaviLinkIndicate();
	pagenaviLinkReindicate();
	}

// ページメニューの表示幅取得
	
function getDivSize(div)
	{
	if((document.getElementById) && (!document.all)) // for NN6+
		{
		the_navibox_div = document.getElementById("pagenavi");
		}
	
	else if((document.all) || (window.opera))	// for IE4+
		{
		the_navibox_div = document.all("pagenavi");
		}

	div_width = the_navibox_div.offsetWidth;
	div_height = the_navibox_div.offsetHeight;
	}

// ページメニュー表示

function pagenaviIndicate()
	{
	getDivSize();
	pagenaviVanishing();
	counter1 = 0;

	if((document.getElementById) && (!document.all)) // for NN6+
		{
		the_navibox_div.style.top = window.scrollY + window.innerHeight - div_height - 20
		}
		
	else if((window.opera) && (!document.documentElement))	// for Opera6+
		{
		the_navibox_div.style.top = document.body.scrollTop + window.innerHeight - div_height - 20;
		}
		
	else if(document.all)	// for IE4+
		{
		the_navibox_div.style.top = document.body.scrollTop + document.body.clientHeight - div_height - 20;
		}

	the_navibox_div.style.left = 210;
	add_width = parseInt(div_width/5) + 1;
	add_height = parseInt(div_height/5) + 1;
	the_navibox_div.style.visibility='visible';
	
	pagenaviWipeOn();

	}

function pagenaviBoxFix()
	{
	the_navibox_div.style.visibility='visible';
	}

function pagenaviVanishing()
	{
	the_navibox_div.style.visibility='hidden';
	}

function pagenaviWipeOn()
	{
	
	if(((document.getElementById) && (!document.all)) || (window.opera)) // for NN6+
		{
		if(counter1 < div_width)
			{
			counter1 += 50;
			the_navibox_div.style.width = counter1;
			setTimeout("pagenaviWipeOn()",10);
			}
		}
		
	else if(document.all)	// for IE4+
		{
		if(counter1 < 6)
			{
			var cliper = 'rect(0,'+(add_width * counter1)+','+(add_height * counter1)+',0)';
			the_navibox_div.style.clip = cliper;
			counter1++;
			setTimeout("pagenaviWipeOn()",20);
			}
		}
	}

function getWindowSize()
	{

	if((document.getElementById) && (!document.all)) // for NN6+
		{
		pagenavi_top_position = window.innerHeight - 50;
		}
	else if((window.opera) || (document.all))	// for IE4+ , Opera
		{
		pagenavi_top_position = document.body.clientHeight - 100;
		}
	}

function pagenaviLinkWrite()
	{
	document.write ('<p id="naviup" class="naviup"><a href="javascript:void(0);" title="pegi navigator indicate" onClick="pagenaviIndicate();" onKeyPress="pagenaviIndicate();"><img class="button" width="122" height="33" src="../gif/pagenavilink.gif" alt="PageMenuLink"></a></p>');
	}

function pagenaviLinkIndicate(event)
	{
	
	if((document.getElementById) && (!document.all)) // for NN6+
		{
		the_navilink_div = document.getElementById("naviup");
		the_browser_height = window.innerHeight;
		}
		
	else if((window.opera) && (!document.documentElement))	// for Opera6+
		{
		the_navilink_div = document.all("naviup");
		the_browser_height = document.body.clientHeight;
		}

	else if(document.all)	// for IE4+
		{
		the_navilink_div = document.all("naviup");
		the_browser_height = document.body.clientHeight;
		}
		
	the_navilink_div.style.top = pagenavi_top_position;
	the_navilink_div.style.visibility='visible';
	}

function pagenaviLinkReindicate()
	{
	getWindowSize();
	
	if((document.getElementById) && (!document.all)) // for NN6+
		{
		current_position = parseInt(the_navilink_div.style.top);
		offset_value = (window.scrollY + window.innerHeight - 60) - current_position;
		}

	else if((window.opera) && (!document.documentElement))	// for Opera6+
		{
		current_position = the_navilink_div.offsetTop;
		offset_value = (document.body.scrollTop + window.innerHeight - 60) - current_position;
		}

	else if(document.all)	// for IE4+
		{
		current_position = the_navilink_div.style.pixelTop;
		offset_value = (document.body.scrollTop + document.body.clientHeight - 60) - current_position;
		}

	pagenaviLinkMove();
	}

function pagenaviLinkMove()
	{
	if (offset_value > 2 || offset_value < -2)
		{
		top_locus = offset_value / 10;
		the_navilink_div.style.top = current_position + top_locus;
		}

	setTimeout("pagenaviLinkReindicate();",20);
	}

