// JavaScript Document
var leftValue = 0;
var flg = +1;
var sWidth = GetWindowWidthHeight().width;
var value1 = -4063+sWidth;

function imageScroll(){
	if(leftValue < value1){
		flg = -1;
	}else if(leftValue > 0){
		flg = +1;
	}
	leftValue = leftValue-0.2*flg;
	document.getElementById('index_images').style.marginLeft = leftValue+'px';
}

function setImageScroll(){
	moveId = setInterval(imageScroll,1);
}

function deleteImageScroll(){
	clearInterval(moveId);
}

window.onload = function(){
	setImageScroll();
}

contentsArray = new Array("profile","works","compe","blog","links");

function GetWindowWidthHeight(){
	var myWidth = 0, myHeight = 0;
	if(typeof(window.innerWidth) == 'number'){
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return {'width' : myWidth, 'height' : myHeight};
}

function openClose(id){
	if(document.getElementById(id).style.display == false || document.getElementById(id).style.display == 'none'){
		var sHeight = GetWindowWidthHeight().height;
		var subject = id+'_subject';
		document.getElementById(subject).style.backgroundImage = 'url(http://takanoriohira.com/image/arrowunder.gif)';
		document.getElementById(id).style.display = 'block';
		for(i=0;i<4;i++){
			if(contentsArray[i] != id){
				if(document.getElementById(contentsArray[i]).style.display == 'block' || document.getElementById(id).style.display == false){
					subject = contentsArray[i]+'_subject';
					document.getElementById(subject).style.backgroundImage = 'url(http://takanoriohira.com/image/arrowright.gif)';
					document.getElementById(contentsArray[i]).style.display = 'none';
				}
			}
		}
	}else{
		var subject = id+'_subject';
		document.getElementById(subject).style.backgroundImage = 'url(http://takanoriohira.com/image/arrowright.gif)';
		document.getElementById(id).style.display = 'none';
	}
}

function textareafoucus(){
	if(document.getElementById('body').value == '内容をご記入の上送信してください。'){
		document.getElementById('body').value = '';
	}
}

function textareablur(){
	if(document.getElementById('body').value == ''){
		document.getElementById('body').value = '内容をご記入の上送信してください。';
	}
}

function textnamefoucus(){
	if(document.getElementById('name').value == 'Name/お名前'){
		document.getElementById('name').value = '';
	}
}

function textnameblur(){
	if(document.getElementById('name').value == ''){
		document.getElementById('name').value = 'Name/お名前';
	}
}

function textmailfoucus(){
	if(document.getElementById('mail').value == 'E-mail/メール'){
		document.getElementById('mail').value = '';
	}
}

function textmailblur(){
	if(document.getElementById('mail').value == ''){
		document.getElementById('mail').value = 'E-mail/メール';
	}
}

function textsubjectfoucus(){
	if(document.getElementById('subject').value == 'Subject/表題'){
		document.getElementById('subject').value = '';
	}
}

function textsubjectblur(){
	if(document.getElementById('subject').value == ''){
		document.getElementById('subject').value = 'Subject/表題';
	}
}







