function getOffset(){
	return document.all ? document.body.scrollTop:document.getElementById?window.pageYOffset:false;
}

var timer;
var offsetY;
var scrollY;
var speed;
var angle;
function toTop() {
	speed = 10;
	offsetY = getOffset();
	if ( offsetY < 300 ) speed *= 2;
	if ( offsetY > 0 ) {
		offsetY /= 2;
		angle = 0;
		timer = setInterval('scrollToTop()',50);
	}
}
function scrollToTop() {
	scrollY  = Math.round( ( Math.cos(angle * 3.14/180) + 1 ) * offsetY );
	window.scrollTo(0, scrollY);
	angle += speed;
	if ( angle > 180 ) clearInterval(timer);
}

function GakurekiLength( str ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("gakurekilength").innerHTML = Math.ceil(total) + "文字";
}

function LangLength( str ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("langlength").innerHTML = Math.ceil(total) + "文字";
}

function ShikakuLength( str ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("shikakulength").innerHTML = Math.ceil(total) + "文字";
}

function PrLength( str ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("prlength").innerHTML = Math.ceil(total) + "文字";
}

function NoteLength( str,num ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("notelength" + num).innerHTML = Math.ceil(total) + "文字";
}

function WithdrawLength( str,num ) {
len = 0;
for(i=0;i<str.length;i++) {
var c = str.charCodeAt(i);
if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)){
len += 1;
}
else { len += 2; }
}

total = len / 2;
document.getElementById("withdrawlength" + num).innerHTML = Math.ceil(total) + "文字";
}
