$(function(){
	$("#news dl dd:last-child").addClass("lastChild");
	$("#siteGlobalNavigation #navigationServiceArea .navigationServiceAreaEntry:last-child").addClass("lastChild");
	$(".customerBody .customerEntry:first-child").addClass("firstChild");
	$(".customerBody .customerEntry:last-child").addClass("lastChild");
	$("#topicPath a:last-child").addClass("lastChild");
	$("div.triviaEntry div.section:last-child").addClass("lastChild");
	$("#sitemap ul li ul li:last-child").addClass("lastChild");

	$("#formEstimate table")
		.after('<span class="formEstimateBottom"></span>');

	//お問い合わせ・フォーム表示切替
	$("#formContact input[name='formType']")
		.click(function(){
						if($(this).val()=='お見積もり'){
							$("#formEstimate input,#formEstimate textarea")
								.removeAttr("disabled");

							$("#formEstimate,#estimateMessage")
								.css('display','block')
								.css('position','relative')
								.animate({	opacity:1},
											500,
											'easeOutExpo');
						}else{
							
							//フォーム項目の有効化
							$("#formEstimate input,#formEstimate textarea")
								.attr("disabled","disabled");
							
							$("#formEstimate,#estimateMessage")
								.css('position','absolute')
								.animate({	opacity:0},
											500,
											'easeOutExpo',
											function(){
												$(this).css('display','none');
											});
						}
		});

	$("input[name='cleaningPlan[]']","#formEstimate").click(function(){
																   switch($(this).val()){
																   	case 'エアコンクリーニング': 
																		if($(this).attr("checked")){
																			$("#airconCount")
																				.css("display","block")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#airconCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				


																   	case 'カーペットクリーニング': 
																		if($(this).attr("checked")){
																			$("#carpetCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#carpetCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				

																   	case '車ルームクリーニング': 
																		if($(this).attr("checked")){
																			$("#carRemark")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#carRemark")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																

																   	case '巡回マンションクリーニング': 
																		if($(this).attr("checked")){
																			$("#mansionRemark")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#mansionRemark")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				


																   	case 'ソファー・ベッドクリーニング': 
																		if($(this).attr("checked")){
																			$("#bedCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#bedCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				


																   	case 'トイレクリーニング': 
																		if($(this).attr("checked")){
																			$("#toiretCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#toiretCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				

																   	case 'フローリングクリーニング': 
																		if($(this).attr("checked")){
																			$("#floorCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#floorCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				
																   	case '木部あく抜きクリーニング': 
																		if($(this).attr("checked")){
																			$("#woodCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#woodCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				
																   	case '浴室クリーニング': 
																		if($(this).attr("checked")){
																			$("#bathCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#bathCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				
																   	case 'レンジクリーニング': 
																		if($(this).attr("checked")){
																			$("#rangeCount")
																				.css("display","inline")
																				.animate({opacity:1},100,'easeOutExpo');
																		} else {
																			$("#rangeCount")
																				.animate({opacity:0},100,'easeOutExpo',function(){
																						 $(this).css('display','none');
																																});
																		}
																		
																		break;																
																				


}
																});



	$("input[type='submit']","form").click(function(){
														if($("input[name='_process']").val() == 'input'){
															var errorCheck = false;
															var errorString = '';

															if($("input[name='contactName']").val() == ''){
																errorCheck = true;
																if(errorString != ''){
																	errorString = "\n" + errorString;
																}
																errorString += "お名前を入力してください。";
															}

															if (errorCheck){
																alert(errorString);
																return false;
															}


														}
													});


	var $mLibConf = {
			"externalLinkClassName" : "externalLink",
			"externalLinkWindowName" : "_blank"
	};

/*
   $("form").validation({
							extention:{
								AjaxZip2 : true,
								zip:'contactZip',
								pref:'contactPref',
								addr:'contactAddress'
							}
						});  
 */
 
 

});