﻿$(document).ready(function()
{
	//ページロード
	$.ajax({
		type: 'POST',
		async: false,
		url: 'info/index.html',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});

	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
	
	//close
	$(".trigger").hide();
	//target -class
	$(".accordion2").each(function()
	{
		//target html tags
		$("li > a", this).each(function(index)
		{
			var $this = $(this);
			if(index > 0)
			{
				$this.next().hide();
			}
			
			$this.click(function()
			{
				var params = 
				{
					height:"toggle",
					opacity:"toggle"
				};
				var _params = 
				{
					height:""
				};
				if($(this).next().parent().find("dt").html() != null)
				{
					$(this).next().animate(_params).parent().siblings().children("ul:visible").animate(params);
				}else{
					$(this).next().animate(params).parent().siblings().children("ul:visible").animate(params);
				}
				return false;
			});
		});
	});

	$('#works').click(function()
	{
		work();
	});

	$('#index').click(function()
	{
		index();
	});

	$('#contact').click(function()
	{
		getContact();
	});

	$('#recruit').click(function()
	{
		recruit();
	});

	$('#n_r').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'recruit/index.html',
			timeout : 2000,
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='n_r']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#t_r').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		var targetOffset = $("a[name='t_r']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);
		
		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	

		$('#h_11').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_11']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});	
	
		$('#h_10').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_10']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});	
		
	
		$('#h_9').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_9']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});	
	
	$('#h_8').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_8']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});	
	
	$('#h_7').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_7']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
	$('#h_6').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_6']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});		

	$('#h_5').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_5']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#h_4').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		var targetOffset = $("a[name='h_4']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);
		
		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#h_3').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_3']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#h_2').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		var targetOffset = $("a[name='h_2']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#h_1').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'recruit/index.html',
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='h_1']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	

	$('#about').click(function()
	{
		about();
	});

	$('#company').click(function()
	{
		about();
	});
	
		$('#company_history').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'about/index.html',
			timeout : 2000,
			success: function(response)
			{
				$('#container').css({
					"width": "886px",
					"padding": "40px 17px 0 0"
				});
				$('#text').html(response);
			}
		});

		var targetOffset = $("a[name='company_history']").offset().top;
		$('html,body').animate({
			scrollTop: targetOffset
		}, 1000);

		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	

	$('#a_m').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'about/aisatsu_m.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});

	$('#a_y').click(function()
	{
		$.ajax({
			type: 'POST',
			async: false,
			url: 'about/aisatsu_y.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'POST',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
	$('#studio').click(function()
	{
		studio();
	});
	
	$('#akebono').click(function()
	{
		studio();
	});
	
	$('#daiba').click(function()
	{
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'studio/s_daiba.html',
			success: function(response)
			{
				
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
	$('#media').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'studio/s_medhia.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
	$('#shiodome').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'studio/s_shiodome.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
	$('#shibuya').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'studio/s_shibuya.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
		$('#shibuya_02').click(function()
	{
		$.ajax({
			type: 'GET',
			async: false,
			url: 'studio/s_shibuya_02.html',
			success: function(response)
			{
				$('#container').css({
					"width": "870px",
					"padding": "40px 30px 0 0"
				});
				$('#text').html(response);
			}
		});
		
		$.ajax({
			type: 'GET',
			async: false,
			url: 'footer/index.html',
			success: function(response)
			{
				$('#foot').html(response);
			}
		});
	});
	
});

getToggle = function(index)
{
	var params = 
	{
		height:"toggle",
		opacity:"toggle"
	};
	$(".title").eq(index).find(".trigger").animate(params).parent().siblings().children("ul:visible").animate(params);
}

/*
 *	javaScript & actionScript
 *	Common function
 *	@use JQuery 1.3~
 */
function index()
{
	$.ajax({
		type: 'GET',
		async: false,
		url: 'info/index.html',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

function about()
{
	$.ajax({
		type: 'GET',
		async: false,
		url: 'about/index.html',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

function work()
{
	$.ajax({
		type: 'GET',
		async: false,
		url: 'works/index.html',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

function studio()
{
	$.ajax({
		type: 'GET',
		async: false,
		url: 'studio/s_akebono.html',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

function recruit()
{
	$.ajax({
		type: 'GET',
		async: false,
		url: 'recruit/index.html',
		success: function(response)
		{
			$('#container').css({
				"width": "886px",
				"padding": "40px 17px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

getContact = function()
{
	
	$.ajax({
		type: 'GET',
		async: false,
		url: 'contact/index.php',
		success: function(response)
		{
			
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

getContactToggle = function()
{
	getToggle(4);
	$.ajax({
		type: 'GET',
		async: false,
		url: 'contact/index.php',
		success: function(response)
		{
			$('#container').css({
				"width": "870px",
				"padding": "40px 30px 0 0"
			});
			$('#text').html(response);
		}
	});
	
/*
	var targetOffset = $("a[name='c_1']").offset().top;
	$('html,body').animate({
		scrollTop: targetOffset
	}, 1000);	
*/	
	
	$.ajax({
		type: 'POST',
		async: false,
		url: 'footer/index.html',
		success: function(response)
		{
			$('#foot').html(response);
		}
	});
}

//move 2 pageTop
moveTop = function()
{
	var targetOffset = $("a[name='pageTop']").offset().top;
	$('html,body').animate({
		scrollTop: targetOffset
	}, 1000);
}

