verified=false;$(function(){var a=false;$(window).bind("beforeunload",function(c){if(!a){return"入力は完了していません。";}});$("#inquiry-form").append($("",{type:"hidden",name:"page-key",value:"BYGmiKi6m3cVCZbtDWkFLEDM9igN6U"}));$.fn.autoKana("#name","#kana",{katakana:true});String.prototype.toSingleByte=function(){return this.replace(" "," ").replace(/[A-Za-z0-9-!”#$%&’()=<>,.?_[]{}@^~¥]/g,function(c){return String.fromCharCode(c.charCodeAt(0)-65248);});};String.prototype.toDigits=function(){return this.toSingleByte().replace(/\D+/g,"");};String.prototype.toPhone=function(){return this.toSingleByte().replace(/^\D+|\D+$/g,"").replace(/\D+/g,"-");};String.prototype.isPhone=function(){return/^(?:0[1-9]0\d{8}|0[1-9]{2}\d{7})$/.test(this.toDigits());};String.prototype.isEmail=function(){return/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/.test(this.toSingleByte());};if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};}String.prototype.isEmpty=function(){return this=="";};String.prototype.isPost=function(){return/^\d{3}-?\d{4}$/.test(this);};String.prototype.isKatakana=function(){return/^[ァ-ロワヲンー  ]+$/.test(this);};verifyCaptcha=function(c){if(c!=""){verified=true;b();}};var b=function(){var c=$(".disabled").length+$(".required").length;if(verified==false){c++;}if(c==0){$("#if_ng").hide();$("#if_ok").show();}else{$("#if_ng").show();$("#if_ok").hide();}};$("#name").on("change blur keyup",function(){if(!$(this).val().isEmpty()){$(this).removeClass("required disabled");$("#_name").text($(this).val());$("#form_error_01").hide();}else{$(this).addClass("disabled");$("#form_error_01").show();}$("#kana").trigger("change");b();});$("#kana").on("change blur keyup",function(){if(!$(this).val().isEmpty()){$(this).removeClass("required disabled");$("#_kana").text($(this).val());$("#form_error_01").hide();}else{$(this).addClass("disabled");$("#form_error_01").show();}b();});$("#email").on("change blur keyup",function(){if(!$(this).val().isEmpty()&&$(this).val().isEmail()){$(this).removeClass("required disabled");$("#_email").text($(this).val());$("#form_error_02").hide();}else{$(this).addClass("disabled");$("#form_error_02").show();}b();});$("#message").on("change blur keyup",function(){if(!$(this).val().isEmpty()){$(this).removeClass("required disabled");$("#_message").text($(this).val());$("#form_error_03").hide();}else{$(this).addClass("disabled");$("#form_error_03").show();}b();});$("#if_ok > a").on("click",function(){$("#conf_win").css("display","block");});$("#send").on("click",function(){a=true;$.post("/inquiry/sendmail.php",$("#inquiry-form").serialize(),function(c){if(c.status=="ok"){location.href="/inquiry/thanks.html";}else{alert(c.message);}});});});