﻿var move = 0;
var tmpCount = 1;
var divCount = 10;
var edging = 100;
var contentsCounts = 0;
var windowHeight;
var browserCheck = /Internet Explorer/;
var httpsUrl = "https://www.studioespace.jp/";
var noCache;

function init(){
	var today = new Date();
	noCache = today.getMonth() + 1 +"";
	noCache += today.getDate();
	noCache += today.getHours();
	noCache += today.getMinutes();
	noCache += today.getSeconds();
	
	var aDiv = document.getElementsByTagName('h3');
	for( a = 0; a < aDiv.length; a++){
		contentsCounts += 1; 
	}
	for (var i = 0; i < contentsCounts - 1; i++){
		if($("contents"+ i)){
			$("contents"+ i).style.height = 28 + "px";
			$("whiteBg"+ i).style.height = 0 + "px";
		}
		if($("products"+ i)){
			var outlineHeight = $("productsMain"+ i).offsetHeight;
			$("products2").style.height = outlineHeight +"px";
			$("mainWhiteBg"+ i).style.height = outlineHeight+ 90 +"px";
		}
	}
	
	var ligthBoxLink = document.getElementsByTagName('a');
	for(var n = 0; n < ligthBoxLink.length; n++){
		if(ligthBoxLink[n].className == "lbOn"){
			var ligthBoxLinkHref = ligthBoxLink[n].href;
			ligthBoxLink[n].href = ligthBoxLinkHref +"?"+ noCache;
		}
	}
	
	windowHeight();
	initRollovers();
	googleMap();
	addLightboxMarkup();
	initialize();
}

function windowHeight(){
	getBrowserInfo();
	if (browserCheck.test(browser)){
		windowHeight = document.documentElement.clientHeight;
	} else {
		windowHeight = window.innerHeight;
	}
}

function windowResize() {
	getBrowserInfo();
	if (browserCheck.test(browser)){
		windowHeight = document.documentElement.clientHeight;
	} else {
		windowHeight = window.innerHeight;
	}
}


//test
function test(){	
	new Effect.ScrollTo("contentsKankyo");
									initialize();
		clearInterval(effectTimer);
		check = "";
		$("overlay").style.opacity = 0;
		$("overlay").style.display = "none";
		$("overlay").style.filter = "alpha(opacity=0)";
		getBrowserInfo();
		if (browser == "Internet Explorer 6"){
			this.prepareIE('0%', 'yes');
			this.hideSelects("none");
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}else{
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}
									}

//test2
var contentsFlag = 0;
function test2(){	
new Ajax.Request( "contents"+ 8 +".html?"+ noCache, {
		method: "get",
		requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
		onComplete: function(Obj){
		contentsFlag = 1;
		$("main"+ 8).innerHTML = Obj.responseText;
		$("whiteBg"+ 8).style.visibility = "visible";
		initialize();
		addEffectTimer = setInterval("addContentsEgeng("+ 8 +")", 10	);	
		
	new Effect.ScrollTo("resultsTitle");
		initialize();
		check = document.documentElement.scrollTop;
		effectTimer = setInterval("moveScroll()", 10);
		clearInterval(effectTimer);
		check = "";
		$("overlay").style.opacity = 0;
		$("overlay").style.display = "none";
		$("overlay").style.filter = "alpha(opacity=0)";
		getBrowserInfo();
		if (browser == "Internet Explorer 6"){
			this.prepareIE('0%', 'yes');
			this.hideSelects("none");
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}else{
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}
		}
							 })
									}


//コンテンツ部分のMore
var contentsFlag = 0;
function contentsMore(contentsNo){	
	if(contentsFlag == 0){
			new Ajax.Request( "contents"+ contentsNo +".html?"+ noCache, {
							 	method: "get",
								requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
								onComplete: function(Obj){
									contentsFlag = 1;
									$("main"+ contentsNo).innerHTML = Obj.responseText;
									$("whiteBg"+ contentsNo).style.visibility = "visible";
									initialize();
									var contentsHeight = $("BgHeight"+ contentsNo).offsetHeight;
									if(contentsHeight > windowHeight){
										$("bottomBtn"+ contentsNo).style.visibility = "visible";
									}else{
										Element.remove("bottomBtn"+ contentsNo);
									}
									addEffectTimer = setInterval("addContentsEgeng("+ contentsNo +")", 10	);	
																
									if(contentsNo == 0){
										var Height = $("BgHeight"+ contentsNo +"_1").offsetHeight;
										$("whiteBg"+ contentsNo +"_1").style.height = Height + 10 + "px";
										$("whiteBg"+ contentsNo +"_1").style.visibility = "visible";
									}else if((contentsNo == 9)||(contentsNo == 10)){
										var Height = $("BgHeight"+ contentsNo +"_1").offsetHeight;
										$("whiteBg"+ contentsNo +"_1").style.height = Height + 40 + "px";
										$("whiteBg"+ contentsNo +"_1").style.visibility = "visible";
									}else if((contentsNo == 8)){
		check = document.documentElement.scrollTop;
		effectTimer = setInterval("moveScroll()", 10);
		clearInterval(effectTimer);
		check = "";
		$("overlay").style.opacity = 0;
		$("overlay").style.display = "none";
		$("overlay").style.filter = "alpha(opacity=0)";
		getBrowserInfo();
		if (browser == "Internet Explorer 6"){
			this.prepareIE('0%', 'yes');
			this.hideSelects("none");
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}else{
			flag = 0;
			Element.remove($('lbContent'));
			this.displayLightbox("none");
		}
									}
									
								}
							 })
	}
}


//コンテンツ部分のClose
function contentsClose(contentsNo){
	if(contentsFlag == 0){
		contentsFlag = 1;
		clearTimeout(timer);
		clearInterval(addEffectTimer);
		tmpCount = 1;
		move = 0;
		
		subEffectTimer = setInterval("subContentsEgeng("+ contentsNo +")", 10);
		
		if((contentsNo == 0)||(contentsNo == 9)){
			$("whiteBg"+ contentsNo +"_1").style.height = 0 + "px";
			$("whiteBg"+ contentsNo +"_1").style.visibility = "hidden";
		}
	}
}

//コンテンツ部分のMore後のエフェクト
var addEffectTimer;
function addContentsEgeng(No) {
	if($("contents"+ No).offsetHeight + 28 <= $("BgHeight"+ No).offsetHeight){
		var c = tmpCount/divCount;
		var move = ($("BgHeight"+ No).offsetHeight - ($("contents"+ No).offsetHeight + 28))*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents"+ No).offsetHeight + 28);
		if($("btnMore"+ No).onclick){
			$("btnMore"+ No).onclick = function (){	
											;
										}
		}
		$("contents"+ No).style.height = move +"px";
		$("whiteBg"+ No).style.height = move +"px";
		tmpCount++;
	}else{
		clearInterval(addEffectTimer);
		tmpCount = 1;
		move = 0;
		$("contents"+ No).style.height = $("BgHeight"+ No).offsetHeight + 28 +"px";
		$("whiteBg"+ No).style.height = $("BgHeight"+ No).offsetHeight +"px";
		$("btnMore"+ No).innerHTML = '<img src="common/images/r_close.gif" width="68" height="19" alt="close" class="imgover" />';
		$("btnMore"+ 8).innerHTML = '<img src="common/images/g_close.gif" width="68" height="19" alt="more" class="imgover" />';
		$("btnMore"+ No).onclick = function (){	
												contentsClose(No);
											}
		initRollovers();
		contentsFlag = 0;
		return;
	}
}


//コンテンツ部分のClose後のエフェクト
var subEffectTimer;
function subContentsEgeng(No) {
	if($("contents"+ No).offsetHeight > 28){
		var c = tmpCount/divCount;
		var move = (28 - ($("contents"+ No).offsetHeight + 28))*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents"+ No).offsetHeight + 28);
		if($("btnMore"+ No).onclick){
			$("btnMore"+ No).onclick = function (){	
											;
										}
		}		
		$("contents"+ No).style.height = move +"px";
		$("whiteBg"+ No).style.height = move +"px";
		tmpCount++;
	}else{
		clearInterval(subEffectTimer);
		tmpCount = 1;
		move = 0;
		$("contents"+ No).style.height = 28 +"px";
		$("whiteBg"+ No).style.height = 0 +"px";
		if(No != 1){
			$("main"+ No).innerHTML = "";
		}
		$("whiteBg"+ No).style.visibility = "hidden";
		$("btnMore"+ No).innerHTML = '<img src="common/images/r_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("btnMore"+ 8).innerHTML = '<img src="common/images/g_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("btnMore"+ No).onclick = function (){	
												contentsMore(No);
											}
		initRollovers();
		contentsFlag = 0;
		return;
	}
}

function bottomClose(No) {
	var realOffset = Position.cumulativeOffset($("contents"+ No));
	var startOffset = Position.cumulativeOffset($("bottomBtn"+ No));
	realOffset[1] -= 50;
	subEffectTimer = setInterval("subContentsEgeng("+ No +")", 10);
	subbottomEffectTimer = setInterval("subbottomEgeng("+ No +","+ startOffset[1] +","+ realOffset[1] +")", 10);
	
	if((No == 0)||(No == 9)){
		$("whiteBg"+ No +"_1").style.height = 0 + "px";
		$("whiteBg"+ No +"_1").style.visibility = "hidden";
	}
}

var subbottomEffectTimer;
function subbottomEgeng(No, startOffset, realOffset) {
	if($("contents"+ No).offsetHeight > 28){
		var c = tmpCount/divCount;
		var moveOffset = (realOffset - startOffset)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + startOffset;
		if(moveOffset > realOffset){
			window.scroll(0,Math.floor(moveOffset));
		}
		if($("btnMore"+ No).onclick){
			$("btnMore"+ No).onclick = function (){	
											;
										}
		}
		tmpCount++;
	}else{
		clearInterval(subbottomEffectTimer);
		tmpCount = 1;
		move = 0;
		$("contents"+ No).style.height = 28 +"px";
		$("whiteBg"+ No).style.height = 0 +"px";
		if(No != 1){
			$("main"+ No).innerHTML = "";
		}
		$("btnMore"+ No).innerHTML = '<img src="common/images/r_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("btnMore"+ No).onclick = function (){	
											contentsMore(No);
										}
	initRollovers();
		$("whiteBg"+ No).style.visibility = "hidden";
		return;
	}
}


//スローガン部分のMore
var slognFlag = 0;
function slognMore() {
	if(slognFlag == 0){
		slognFlag = 1;
		addslognEffectTimer = setInterval("addslognEgeng()", 10);
	}
}

//スローガン部分のClose
function slognClose() {
	if(slognFlag == 0){
		slognFlag = 1;
		clearInterval(addslognEffectTimer);
		tmpCount = 1;
		move = 0;
		subslognEffectTimer = setInterval("subslognEgeng()", 10);
	}
}

//スローガン部分のMore後のエフェクト
var addslognEffectTimer;
function addslognEgeng() {
	if($("slognImage").offsetHeight + 40 <= $("slognHeight").offsetHeight){
		var c = tmpCount/divCount;
		var move = ($("slognHeight").offsetHeight - ($("slognImage").offsetHeight + 40))*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("slognImage").offsetHeight + 40);
		if($("btnMore").onclick){
			$("btnMore").onclick = function (){	
											;
										}
		}
		
		$("slognImage").style.height = move +"px";
		tmpCount++;
	}else{
		clearInterval(addslognEffectTimer);
		tmpCount = 1;
		move = 0;
		$("slognImage").style.height = $("slognHeight").offsetHeight + 40 +"px";
		$("btnMore").innerHTML = '<img src="common/images/r_close.gif" width="68" height="19" alt="close" class="imgover" />';
		$("btnMore").onclick = function (){	
									slognClose();
								}
		initRollovers();
		slognFlag = 0;
		return;
	}
}

//スローガン部分のClose後のエフェクト
var subslognEffectTimer;
function subslognEgeng() {
	if($("slognImage").offsetHeight > 0){
		var c = tmpCount/divCount;
		var move = (0 - ($("slognHeight").offsetHeight))*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("slognHeight").offsetHeight);
		if($("btnMore").onclick){
			$("btnMore").onclick = function (){	
											;
										}
		}
		
		$("slognImage").style.height = move +"px";
		tmpCount++;
	}else{
		clearInterval(subslognEffectTimer);
		tmpCount = 1;
		move = 0;
		$("slognImage").style.height = 0 +"px";
		$("btnMore").innerHTML = '<img src="common/images/r_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("btnMore").onclick = function (){	
									slognMore();
								}
		initRollovers();
		slognFlag = 0;
		return;
	}
}

//インフォ部分のMore
function infoMore() {
	addinfoEffectTimer = setInterval("addinfoEgeng()", 10);
	$("btn").innerHTML = '<img src="common/images/r_close.gif" width="68" height="19" alt="close" class="imgover" />';
	$("btn").onclick = function (){	
								infoClose();
							}
	initRollovers();
}

//インフォ部分のClose
function infoClose() {
	clearInterval(addinfoEffectTimer);
	tmpCount = 1;
	move = 0;
	subinfoEffectTimer = setInterval("subinfoEgeng()", 10);
	$("btn").innerHTML = '<img src="common/images/r_more.gif" width="68" height="19" alt="more" class="imgover" />';
	$("btn").onclick = function (){	
								infoMore();
							}
	initRollovers();
}

//インフォ部分のMore後のエフェクト
var addinfoEffectTimer;
function addinfoEgeng() {
	if($("infomation").offsetHeight <= $("height").offsetHeight){
		var c = tmpCount/divCount;
		var move = ($("height").offsetHeight - $("infomation").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("infomation").offsetHeight);
		
		$("infomation").style.height = move +"px";
		$("headerwhiteBg0").style.height = move + 76 +"px";
		tmpCount++;
	}else{
		clearInterval(addinfoEffectTimer);
		tmpCount = 1;
		move = 0;
		$("infomation").style.height = $("height").offsetHeight +"px";
		$("headerwhiteBg0").style.height = $("height").offsetHeight + 76 +"px";
		return;
	}
}

//インフォ部分のClose後のエフェクト
var subinfoEffectTimer;
function subinfoEgeng() {
	if($("infomation").offsetHeight > 57){
		var c = tmpCount/divCount;
		var move = (57 - ($("height").offsetHeight))*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("height").offsetHeight);
		
		$("infomation").style.height = move +"px";
		$("headerwhiteBg0").style.height = move + 76 +"px";
		tmpCount++;
	}else{
		clearInterval(subinfoEffectTimer);
		tmpCount = 1;
		move = 0;
		$("infomation").style.height = 57 +"px";
		$("headerwhiteBg0").style.height = 133 +"px";
		return;
	}
}

//実績部分のMore
var resultsFlag = 0;
function resultsMore() {
	if(resultsFlag == 0){
		new Ajax.Request( "contents.html?"+ noCache, {
							method: "get",
							requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
							onComplete: function(Obj){
								resultsFlag = 1;
								$("results").innerHTML = Obj.responseText;
								var beforeBgHeight = $("contents1").offsetHeight;
								addsresultsEffectTimer = setInterval("addresultsEgeng("+ beforeBgHeight +")", 10);
							}
						 })
	}
}

//実績部分のClose
function resultsClose(beforeBgHeight) {
	if(resultsFlag == 0){
		resultsFlag = 1;
		clearInterval(addsresultsEffectTimer);
		tmpCount = 1;
		move = 0;
		subresultsEffectTimer = setInterval("subresultsEgeng("+ beforeBgHeight +")", 10);
	}
}

//実績部分のMore後のエフェクト
var addsresultsEffectTimer;
function addresultsEgeng(beforeBgHeight) {
	if($("contents1").offsetHeight < $("resultsMain").offsetHeight + beforeBgHeight){
		var c = tmpCount/divCount;
		var move = (($("resultsMain").offsetHeight + beforeBgHeight) - $("contents1").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents1").offsetHeight);
		if($("resultsBtn").onclick){
			$("resultsBtn").onclick = function (){	
											;
										}
		}


		$("whiteBg1").style.height = move +"px";
		$("contents1").style.height = move  +"px";
		tmpCount++;
	}else{
		clearInterval(addsresultsEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg1").style.height = $("resultsMain").offsetHeight + beforeBgHeight +"px";
		$("contents1").style.height = $("resultsMain").offsetHeight + beforeBgHeight +"px";
		$("resultsBtn").innerHTML = '<img src="common/images/g_close.gif" width="68" height="19" alt="close" class="imgover" />';
		$("resultsBtn").onclick = function (){	
										resultsClose(beforeBgHeight);
									}
		initRollovers();
		resultsFlag = 0;
		return;
	}
}

//実績部分のClose後のエフェクト
var subresultsEffectTimer;
function subresultsEgeng(beforeBgHeight) {
	if($("contents1").offsetHeight > beforeBgHeight){
		var c = tmpCount/divCount;
		var move = ((beforeBgHeight) - $("contents1").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents1").offsetHeight);
		if($("resultsBtn").onclick){
			$("resultsBtn").onclick = function (){	
											;
										}
		}
		
		$("whiteBg1").style.height = move +"px";
		$("contents1").style.height = move  +"px";
		tmpCount++;
	}else{
		clearInterval(subresultsEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg1").style.height = beforeBgHeight +"px";
		$("contents1").style.height = beforeBgHeight +"px";
		$("results").innerHTML = "";
		$("resultsBtn").innerHTML = '<img src="common/images/g_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("resultsBtn").onclick = function (){	
									resultsMore();
								}
		initRollovers();
		resultsFlag = 0;
		return;
	}
}

//リクルート部分のMore
var recruitFlag = 0;
function recruitMore() {
	if(recruitFlag == 0){
		new Ajax.Request( "contents9_1.html?"+ noCache, {
							method: "get",
							requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
							onComplete: function(Obj){
								recruitFlag = 1;
								
								$("recruitPrivacyText").innerHTML = Obj.responseText;
								initialize();
								var beforeBgHeight = $("contents9").offsetHeight;
								addrecruitEffectTimer = setInterval("addrecruitEgeng("+ beforeBgHeight +")", 10);
							}
						 })
	}
}

//リクルート部分のClose
function recruitClose(beforeBgHeight) {
	if(recruitFlag == 0){
		recruitFlag = 1;
		clearInterval(addrecruitEffectTimer);
		tmpCount = 1;
		move = 0;
		subrecruitEffectTimer = setInterval("subrecruitEgeng("+ beforeBgHeight +")", 10);
	}
}

//リクルート部分のMore後のエフェクト
var addrecruitEffectTimer;
function addrecruitEgeng(beforeBgHeight) {
	if($("contents9").offsetHeight < $("contactText1").offsetHeight + beforeBgHeight){
		var c = tmpCount/divCount;
		var move = (($("contactText1").offsetHeight + beforeBgHeight) - $("contents9").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents9").offsetHeight);
		if($("recruitBtn").onclick){
			$("recruitBtn").onclick = function (){	
											;
										}
		}

		$("whiteBg9").style.height = move +"px";
		$("contents9").style.height = move +"px";
		$("whiteBg9_1").style.height = move - beforeBgHeight + 70 +"px";
		$("recruitPrivacyText").style.height = move - beforeBgHeight +"px";
		tmpCount++;
	}else{
		clearInterval(addrecruitEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg9").style.height = $("contactText1").offsetHeight + beforeBgHeight +"px";
		$("contents9").style.height = $("contactText1").offsetHeight + beforeBgHeight +"px";
		$("whiteBg9_1").style.height = $("contactText1").offsetHeight + 70 +"px";
		$("recruitPrivacyText").style.height = $("contactText1").offsetHeight +"px";
		$("recruitBtn").innerHTML = '<img src="common/images/g_close.gif" width="68" height="19" alt="close" class="imgover" />';
		$("recruitBtn").onclick = function (){	
										recruitClose(beforeBgHeight);
									}
		initRollovers();
		recruitFlag = 0;
		return;
	}
}

//リクルート部分のClose後のエフェクト
var subrecruitEffectTimer;
function subrecruitEgeng(beforeBgHeight) {
	if(($("contents9").offsetHeight) > beforeBgHeight){
		var c = tmpCount/divCount;
		var move = ((beforeBgHeight) - $("contents9").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents9").offsetHeight);
		if($("recruitBtn").onclick){
			$("recruitBtn").onclick = function (){	
											;
										}
		}
		
		
		$("whiteBg9").style.height = move +"px";
		$("contents9").style.height = move +"px";
		$("whiteBg9_1").style.height = move - beforeBgHeight + 70 +"px";
		$("recruitPrivacyText").style.height = move - beforeBgHeight +"px";
		tmpCount++;
	}else{
		clearInterval(subrecruitEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg9").style.height = beforeBgHeight +"px";
		$("contents9").style.height = beforeBgHeight +"px";
		$("contactText1").innerHTML = "";
		$("whiteBg9_1").style.height =  70 + "px";
		$("recruitPrivacyText").style.height = 0 +"px";
		$("recruitBtn").innerHTML = '<img src="common/images/g_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("recruitBtn").onclick = function (){	
									recruitMore();
								}
		initRollovers();
		recruitFlag = 0;
		return;
	}
}

//コンタクト部分のMore
var contactFlag = 0;
function contactMore() {
	if(contactFlag == 0){
		new Ajax.Request( "contents10_1_1.html?"+ noCache, {
							method: "get",
							requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
							onComplete: function(Obj){
								contactFlag = 1;
								
								$("contactPrivacyText").innerHTML = Obj.responseText;
								initialize();
								var beforeBgHeight = $("contents10").offsetHeight;
								addrecruitEffectTimer = setInterval("addcontactEgeng("+ beforeBgHeight +")", 10);
							}
						 })
	}
}

//リクルート部分のClose
function contactClose(beforeBgHeight) {
	if(contactFlag == 0){
		contactFlag = 1;
		clearInterval(addcontactEffectTimer);
		tmpCount = 1;
		move = 0;
		subcontactEffectTimer = setInterval("subcontactEgeng("+ beforeBgHeight +")", 10);
	}
}

//リクルート部分のMore後のエフェクト
var addcontactEffectTimer;
function addcontactEgeng(beforeBgHeight) {
	if($("contents10").offsetHeight < $("contactText2").offsetHeight + beforeBgHeight){
		var c = tmpCount/divCount;
		var move = (($("contactText2").offsetHeight + beforeBgHeight) - $("contents10").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents10").offsetHeight);
		if($("contactBtn").onclick){
			$("contactBtn").onclick = function (){	
											;
										}
		}

		$("whiteBg10").style.height = move +"px";
		$("contents10").style.height = move  +"px";
		
		$("whiteBg10_1").style.height = move - beforeBgHeight + 70 +"px";
		$("contactPrivacyText").style.height = move - beforeBgHeight +"px";
		tmpCount++;
	}else{
		clearInterval(addrecruitEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg10").style.height = $("contactText2").offsetHeight + beforeBgHeight +"px";
		$("contents10").style.height = $("contactText2").offsetHeight + beforeBgHeight +"px";
		$("whiteBg10_1").style.height = $("contactText2").offsetHeight + 70 +"px";
		$("contactPrivacyText").style.height = $("contactText2").offsetHeight +"px";
		$("contactBtn").innerHTML = '<img src="common/images/g_close.gif" width="68" height="19" alt="close" class="imgover" />';
		$("contactBtn").onclick = function (){	
										contactClose(beforeBgHeight);
									}
		initRollovers();
		contactFlag = 0;
		return;
	}
}

//リクルート部分のClose後のエフェクト
var subcontactEffectTimer;
function subcontactEgeng(beforeBgHeight) {
	if($("contents10").offsetHeight > beforeBgHeight){
		var c = tmpCount/divCount;
		var move = ((beforeBgHeight) - $("contents10").offsetHeight)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + ($("contents10").offsetHeight);
		if($("contactBtn").onclick){
			$("contactBtn").onclick = function (){	
											;
										}
		}
		
		$("whiteBg10").style.height = move +"px";
		$("contents10").style.height = move  +"px";
		$("whiteBg10_1").style.height = move - beforeBgHeight + 70 +"px";
		$("contactPrivacyText").style.height = move - beforeBgHeight +"px";
		tmpCount++;
	}else{
		clearInterval(subcontactEffectTimer);
		tmpCount = 1;
		move = 0;
		$("whiteBg10").style.height = beforeBgHeight +"px";
		$("contents10").style.height = beforeBgHeight +"px";
		$("contactText2").innerHTML = "";
		$("whiteBg10_1").style.height =  70 + "px";
		$("contactPrivacyText").style.height = 0 +"px";
		$("contactBtn").innerHTML = '<img src="common/images/g_more.gif" width="68" height="19" alt="more" class="imgover" />';
		$("contactBtn").onclick = function (){	
									contactMore();
								}
		initRollovers();
		contactFlag = 0;
		return;
	}
}

//グーグルMAPの読み込み
function googleMap() {
	var map0 = new GMap(document.getElementById("map0"));
	
	var gpCenter = new GLatLng(35.65532609707912, 139.73469972610474)
	var gpObj0 = new GLatLng(35.65542199, 139.73447978);
	var gpObj1 = new GLatLng(35.65551788, 139.73388969);

	var espIcon = new GIcon();
	espIcon.image = "common/images/icon_map_esp.gif";
	espIcon.iconAnchor = new GPoint(164.0, 0.0);
	espIcon.iconSize = new GSize(164, 110);

	var eyIcon = new GIcon();
	eyIcon.image = "common/images/icon_map_ey.gif";
	eyIcon.iconAnchor = new GPoint(112.0, 22.0);
	eyIcon.iconSize = new GSize(112, 67);


	var marker0 = new GMarker(gpObj0, espIcon);
	var marker1 = new GMarker(gpObj1, eyIcon);
		
	map0.addControl(new GSmallZoomControl());
	map0.centerAndZoom(gpCenter, 0);
 	map0.addOverlay(marker0);
 	map0.addOverlay(marker1);
	var zoomLevel = map0.getZoomLevel();	
		
	GEvent.addListener(map0, "zoom", function(){
		zoomLevel = map0.getZoomLevel();
		if(zoomLevel >= 4){
			map0.centerAndZoom(gpCenter, 4);
		}
	});
}

function contactScroll(){
	new Effect.ScrollTo("contents10");
	contentsMore(10);
}

function openWindow(){
	var screenHeight = screen.height;
	if(screenHeight > 820){
		subWin = window.open("printoutline.html?"+ noCache, "subWin","width=700, height = 750");
	}else{
		subWin = window.open("printoutline.html?"+ noCache, "subWin","width=700, height = 600, scrollbars=1");
	}
}

function formSend() {
	document.forms[0].submit();
}

function formReset() {
	Form.reset("contact");
}

function checkForm(){
	var flag = 0;
	var input = document.getElementById("contact").getElementsByTagName("input");
	var textarea = document.getElementById("contact").getElementsByTagName("textarea");
	var font = document.getElementById("contact").getElementsByTagName("font");

	for(var n = 0; n < font.length; n++){
		if(font[n].className == "errorMsg"){
			font[n].innerHTML = "";
		}
	}
	
	for(var i = 0; i < input.length; i++){
		if(input[i].className == "inCheck"){
			var createFont = document.createElement("font");
			createFont.className = "errorMsg";
			if(!$("inputError"+ i)){
				if(input[i].name.indexOf("birthday") >= 0){
					if(!$("birthdayError")){
						createFont.id = "birthdayError";
						new Insertion.Bottom("formTextbirthday", createFont);
					}
				}else{
					createFont.id = "inputError"+ i;
					new Insertion.Bottom("formText"+i, createFont);
				}
			}
			
			if(input[i].type == "text"){		
				var str = input[i].value;
				if(input[i].name == "email"){
					if (str.indexOf('%') != -1){
						$("inputError"+i).innerHTML = '半角英数字で入力してください。';
					}else if(str.search(/.+@.+\./) == -1){
						$("inputError"+i).innerHTML = 'メールアドレスを入力してください。';
					}else if(str.length < 6){
						$("inputError"+i).innerHTML = '入力が間違っています。';
					}
				}else if(input[i].name.indexOf("birthday") >= 0){
					if(str.match(/[^0-9]/g) != null){
						$("birthdayError").innerHTML = '半角数字で入力してください。';
					}else if(input[i].name == "birthday_y"){
						if(str.length < 4 || str.length <= 0){
							$("birthdayError").innerHTML = '入力が間違っています。';
							
						}
					}else if(input[i].name == "birthday_m" || input[i].name == "birthday_d"){
						if(str.length <= 0){
							$("birthdayError").innerHTML = '入力が間違っています。';
						}
					}
				}else{
					if(!str){
						$("inputError"+i).innerHTML = '入力してください。';
					}
				}
			}
		}else{
			var str = input[i].value;
			if(str){
				if(input[i].name == "tel" || input[i].name == "fax"){
					var createFont = document.createElement("font");
					createFont.className = "errorMsg";
					createFont.id = "inputError"+ i;
					new Insertion.Bottom("formText"+i, createFont);
					if(str.match(/[^0-9]/g) != null){
						$("inputError"+i).innerHTML = '半角数字で入力してください。';
					}else if(str.length < 10 || str.length > 11){
						$("inputError"+i).innerHTML = '入力が間違っています。';
					}
				}
			}
		}
	}
	
	for(var j = 0; j < textarea.length; j++){
		if(textarea[j].className == "inCheck"){
			var createFont = document.createElement("font");
			createFont.className = "errorMsg";
			var str = textarea[j].value;
			if(!str){
				createFont.innerHTML = '入力してください。';
				new Insertion.Bottom("textarea"+j, createFont);
			}
		}		
	}
	
	var total = 0;
	for(var n = 0; n < font.length; n++){
		if(!font[n].innerHTML){
			flag++;
		}
	}
	
	if(font.length == flag){
		confirmationForm()
	}
			
}

var inputEnd;
var textareaEnd;
function confirmationForm(){
	var input = document.getElementById("contact").getElementsByTagName("input");
	var textarea = document.getElementById("contact").getElementsByTagName("textarea");
	var font = document.getElementById("contact").getElementsByTagName("font");
	var span = document.getElementById("contact").getElementsByTagName("span");
	var selectarea = document.getElementById("contact").getElementsByTagName("select");

	$("ppCheckMsg").innerHTML = "下記の内容でよろしかったら「Submit」ボタンをクリックしてください。";
		
	inputEnd = input.length;
	for(var i = 0; i < inputEnd; i++){
		var checkText = '';
		if(input[i].type == "text"){
			input[i].style.display = "none";
			checkText = '<span id="checkText'+ i +'" class="checkText" >'+ input[i].value +'</span>';
			if(!input[i].value){
				$("displayNone"+ i).style.display ="none";
			}
			new Insertion.Before(input[i], checkText);
		}else if(input[i].type == "radio"){
			if(input[i].checked){
				$(input[i].id).style.display = "none";	
			}else{
				$("radioCheck"+ input[i].id).style.display = "none";
			}
		}
	}
	
	textareaEnd = textarea.length;
	for(var j = 0; j < textareaEnd; j++){
		var checkTextarea = '';
		checkTextarea = '<textarea id="checkTextarea'+ j +'" class="checkText noborder" cols="78" rows="3" readonly="readonly" >'+ $("area"+ j).value +'</textarea>';
		$("area"+ j).style.display = "none";
		new Insertion.Before("area"+ j, checkTextarea);
	}
	
	for(var k = 0; k < selectarea.length; k++){
		var checkSelectarea = '';
		checkSelectarea = '<span id="checkSelectarea'+ k +'" class="checkText" >'+ selectarea[k].value +'</span>';
		selectarea[k].style.display = "none";
		new Insertion.Before(selectarea[k], checkSelectarea);
	}
	
	for(var l = 0; l < span.length; l++){
		if(span[l].className == "textRed"){
			span[l].style.display = "none";
		}
	}
	
	$("formBtn").innerHTML = '<span><a href="#" onclick="returnForm()"><img src="httpscommon/images/r_back.gif" width="68" height="19" alt="reset" class="imgover" /></a></span><a href="#" onclick="formSend()"><img src="httpscommon/images/r_submit.gif" width="82" height="19" alt="submit" class="imgover" /></a>';
}

function returnForm() {
	var input = document.getElementById("contact").getElementsByTagName("input");
	var textarea = document.getElementById("contact").getElementsByTagName("textarea");
	var font = document.getElementById("contact").getElementsByTagName("font");
	var span = document.getElementById("contact").getElementsByTagName("span");
	var selectarea = document.getElementById("contact").getElementsByTagName("select");

	$("ppCheckMsg").innerHTML = "";
	
	for(var i = 0; i < inputEnd; i++){
		if($("checkText"+ i)) Element.remove("checkText"+ i);
		if(input[i].type == "text"){
			input[i].style.display = "inline";
			if(!input[i].value){
				 $("displayNone"+ i).style.display ="inline";
			}
		}else if(input[i].type == "radio"){
			if(input[i].checked){
				$(input[i].id).style.display = "inline";	
			}else{
				$("radioCheck"+ input[i].id).style.display = "inline";
			}
		}
	}
	
	for(var j = 0; j < textareaEnd; j++){
		if($("checkTextarea"+ j)) Element.remove("checkTextarea"+ j);
		$("area"+ j).style.display = "inline";
	}
	
	for(var k = 0; k < selectarea.length; k++){
		if($("checkSelectarea"+ k)) Element.remove("checkSelectarea"+ k);
		selectarea[k].style.display = "inline";
	}
	
	for(var l = 0; l < span.length; l++){
		if(span[l].className == "textRed"){
			span[l].style.display = "inline";
		}
	}

	$("formBtn").innerHTML = '<span><a href="#" onclick="formReset()"><img src="httpscommon/images/r_reset.gif" width="68" height="19" alt="send" class="imgover" /></a></span><a href="#" onclick="checkForm()"><img src="httpscommon/images/r_submit.gif" width="82" height="19" alt="reset" class="imgover" /></a>';
}

function rollover(){
	initRollovers();	
}

var timer;
function finishSend() {
		new Ajax.Request("contents10_2.html?"+ noCache, {
					 	method: "get",
						requestHeaders: ['If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT'],
						onComplete: function(Obj){
							$("main10").innerHTML = Obj.responseText;
							timer = setTimeout("contentsClose(10)", 10000);
						}
					 })
}

function normalWidth(no){
	var text = $("form" + no);
    str = escape(text.value);
    if (str.indexOf('%') != -1){
    	$("formText" + no).innerHTML = "半角英数字で入力してください。";
		return false;
	}else if(!str){
    	$("formText" + no).innerHTML = "半角英数字で入力してください。";
		return false;
	}else{
		$("formText" + no).innerHTML = "";
		return true;
	}
}

function goToTop(){
	new Effect.ScrollTo("header");
}

function recruitWindowOpen(){
	window.open( httpsUrl +"form1.html?"+ noCache, "sub", "width = 740, height = 550, location = yes, scrollbars=yes");
}

function contactWindowOpen(){
	window.open( httpsUrl +"form2.html?"+ noCache, "sub", "width = 740, height = 550, location = yes");
}

function backWindowClose(){
	this.close();
}

function ppPrintWindowOpen(){
	var subWin = window.open("policy2.php?"+ noCache, "subwindow", "width = 650, height = 590");
}

function formPrintWindowOpen(){
	var subWin = window.open("policy3.php?"+ noCache, "subwindow", "width = 680, height = 560, scrollbars = yes");
}

function recruitCheck(){
	if($("recruitCheckYes")){
		if($("recruitCheckYes").checked){
			$("recruitCheckLink").style.visibility ='visible';
			$("recruitCheckLink").innerHTML = '<a href="javascript:void(0)" onclick="recruitWindowOpen()">応募する</a>';
		}
	}
	if($("recruitCheckNo")){
		if($("recruitCheckNo").checked){
			$("recruitCheckLink").style.visibility ='hidden';
			$("recruitCheckLink").innerHTML = '';
		}
	}
}

function ppCheck(){
	if($("ppCheckYes")){
		if($("ppCheckYes").checked){
			$("ppCheckLink").style.visibility ='visible';
			$("ppCheckLink").innerHTML = '<a href="javascript:void(0)" onclick="contactWindowOpen()">お問い合わせフォーム</a>';
		}
	}
	if($("ppCheckNo")){
		if($("ppCheckNo").checked){
			$("ppCheckLink").style.visibility ='hidden';
			$("ppCheckLink").innerHTML = '';
		}
	}
}

function mobileOpenWindow(contentName){
	var subWin = window.open("show_speo"+ contentName +".html", "subwindow", "width = 650, height = 625, scrollbars = no");
}

function mobileCloseWindow(){
	this.close();
}



/*var move;
var addmoveWindowTimer;
var submoveWindowTimer;
function reversiMoveWindow(contentName){
	var position = $( contentName +"MoveWindow").style.left;
	position = position.replace(/px/, "");
	position = position.replace(/-/, "");
	position = new Number(position);
	move = position;
	addmoveWindowTimer = setInterval("addmoveWindow(0,'"+ contentName +"')", 100);
}
function reversiSubMoveWindow(contentName){
	var position = $( contentName +"MoveWindow").style.left;
	position = position.replace(/px/, "");
	position = position.replace(/-/, "");
	position = new Number(position);
	move = position;
	$( contentName +"FloatMainRight").innerHTML = "";
	submoveWindowTimer = setInterval("submoveWindow(640,'"+ contentName +"')", 100);
}

function saverMoveWindow(contentName){
	var position = $( contentName +"MoveWindow").style.left;
	position = position.replace(/px/, "");
	position = position.replace(/-/, "");
	position = new Number(position);
	move = position;
	addmoveWindowTimer = setInterval("addmoveWindow(0,'"+ contentName +"')", 100);
}
function saverSubMoveWindow(contentName){
	var position = $( contentName +"MoveWindow").style.left;
	position = position.replace(/px/, "");
	position = position.replace(/-/, "");
	position = new Number(position);
	move = position;
	$( contentName +"FloatMainRight").innerHTML = "";
	submoveWindowTimer = setInterval("submoveWindow(640,'"+ contentName +"')", 100);
}


function addmoveWindow(start, content){
	if(625 > move){
		var c = tmpCount/divCount;
		move = (625 - start)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + start;
		if($( content +"BtnAddMove").onclick){
			$( content +"BtnAddMove").onclick = function (){	
											;
										}
		}
		
		$( content +"MoveWindow").style.left = "-"+ move +"px";
		
		tmpCount++;
	}else{
		clearInterval(addmoveWindowTimer);
		tmpCount = 1;
		move = 0;
		$( content +"MoveWindow").style.left = "-"+ 625 +"px";
		var setFlash = new SWFObject("swf/"+ content +"/main.swf?"+ noCache +"", "reversi", "625", "525", "7", "#333333");
		setFlash.write(content +"FloatMainRight");
		if(content == "reversi"){
			$( content +"BtnAddMove").onclick = function (){
										reversiSubMoveWindow(content);
									}
		}else if(content == "screensaver"){
			$( content +"BtnAddMove").onclick = function (){
										saverSubMoveWindow(content);
									}
		}
		
	}
}


function submoveWindow(start, content){
	if(0 < move){
		var c = tmpCount/divCount;
		move = (0 - start)*(c + edging/(100*Math.PI)*Math.sin( Math.PI*c)) + start;
		if($( content +"BtnAddMove").onclick){
			$( content +"BtnAddMove").onclick = function (){	
											;
										}
		}
		
		$( content +"MoveWindow").style.left = "-"+ move +"px";
		tmpCount++;
	}else{
		clearInterval(submoveWindowTimer);
		tmpCount = 1;
		move = 0;
		$( content +"MoveWindow").style.left = 0 +"px";
		if(content == "reversi"){
			$( content +"BtnAddMove").onclick = function (){
										reversiMoveWindow(content);
									}
		}else if(content == "screensaver"){
			$( content +"BtnAddMove").onclick = function (){
										saverMoveWindow(content);
									}
		}
	}
}

function showMobileContent(content){
	var scry = document.documentElement.scrollTop;
	$( content +"FloatBody").style.top = scry + 15 +"px";
	new Effect.Fade(content +"FloatBody", { 
								from:0,
								to:1,
								beforeStartInternal: function() {
									$( content +"FloatBody").style.display = "block";
								},
								afterFinishInternal: function() { 
	       						} 
					});
}

function hideMobileContent(content){
	new Effect.Fade(content +"FloatBody", { 
								from:1,
								to:0,
								beforeStartInternal: function() {
									
								},
								afterFinishInternal: function() { 
									$( content +"FloatBody").style.display = "none";
									if(content == "reversi"){
										reversiSubMoveWindow(content);
									}else if(content == "screensaver"){
										saverSubMoveWindow(content);
									}
	       						} 
					});
}*/
