var thisHTML = location.href;		//URL(http://～)
urlNum = thisHTML.length;	//URLの文字数

//現在のページ（ファイル名）を取得
if ( urlNum == thisHTML.lastIndexOf("/")+1 ) {	//スラッシュが末尾＝TOPページ
	thisPage = "index";
}
else {
	switch( thisHTML.substring(thisHTML.lastIndexOf("/")+1 , urlNum) ) {
		case "index.html" : thisPage = "index";
			break;
		case "link.html" : thisPage = "link";
			break;
		case "web.html" : thisPage = "web";
		case "productFlow.html" : thisPage = "web";
		case "think.html" : thisPage = "web";
		case "system.htmlRenewal" : thisPage = "web";
		case "renewal.html" : thisPage = "web";
			break;
		case "form.html" : thisPage = "form";
			break;
		default : break;
	}
}

/********************
	全ページ共通
	LOGO
********************/
$( function() {
	$("#logo").fadeIn( 3000 );
	
	$("#logo").mousedown( function() {
		$( this )
			.animate( {height : "50px" , width : "150px"} )
			.css( {"margin-top" : "50px"} );
	})
	.click( function() {
		$( this )
			.animate( {height : "100px" , width : "300px"} )
			.css( {"margin-top" : "0px"} );
	})
});

/*****	index	*****/
if( thisPage == "index" ) {
	$( function() {
		//Modalウィンドウ
		$("#modalOpen").simpleDialog();		
	});
}

/*****	link	*****/
if( thisPage == "link" ) {
	//タブ指定
	$( function() {
		$("div.linkPanel div:not("+$("ul.linkTab li a.selected").attr("href")+")").hide()
		$("ul.linkTab li a").click( function() {
			$("ul.linkTab li a").removeClass("selected")
			$( this ).addClass("selected")
			$("div.linkPanel div").hide()
			$($( this ).attr("href")).show()
			return false
		})
	});
}

/*****	from	*****/
if ( thisPage == "form" ) {

}


/*****	web	*****/
if( thisPage == "web" ) {
	$().ready( function() {
		$(".kwicks").kwicks({
			max : 200,
			duration: 800,  
			easing: 'easeOutQuint'
		});
		
		$("#webAmountTable01")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
		$("#webAmountTable02")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
		$("#webAmountTable03")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
		$("#webAmountTable04")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
		$("#webAmountTable05")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
		$("#webAmountTable06")
			.hover(function(){
				$(this).animate({backgroundPosition:"0px -50px"});		
			},
			function(){
				$(this).animate({backgroundPosition:"0px 0px"});
			}
		);
	});
}

function linkFormCheck(num) {
	//num=1(問い合わせ)　num=2(WEB)
	var errorText = "";
	switch (num) {
		case 1 :		
			if ( document.send.userName.value == "" ) {
				errorText += "お名前が入力されていません\n";
			}
			if ( document.send.userMail.value == "" ) {
				errorText += "メールアドレスが入力されていません\n";
			}
			if ( document.send.comment.value == "" ) {
				errorText += "お問い合わせ内容が入力されていません\n";
			}
			break;
		case 2 :
			if ( document.send.userName.value == "" ) {
				errorText += "お名前が入力されていません\n";
			}
			if ( document.send.userTel.value == "" ) {
				errorText += "電話番号が入力されていません\n";
			}
			if ( document.send.userMail.value == "" ) {
				errorText += "メールアドレスが入力されていません\n";
			}
			if ( document.send.userSiteName.value == "" ) {
				errorText += "サイト名が入力されていません\n";
			}
			if ( document.send.userSiteUrl.value == "" ) {
				errorText += "サイトURLが入力されていません\n";
			}
			break;
		default : break;
	}
	if( errorText != "" ) {
		alert(errorText);
		return false;
	}
	else {
		return true;
	}
}

function changeBgColor(inputName , color) {
	document.getElementById(inputName).style.backgroundColor=color;
	//$("#" + inputName).style.backgroundColor=color;
}