/* atweb フォーム入力用JSファイル */ if( typeof MakeForm == "undefined" ){ MakeForm = function(){ }; } MakeFormObj = function(){}; MakeFormObj.setUnip = function(){ }; MakeFormObj.cookieId = 'atmailform'; MakeFormObj.Running = 0; MakeFormObj.form = []; MakeFormObj.Errors = []; MakeFormObj.PUSH = []; MakeObj = function(){}; MakeFormObj.ErrorMesDef = "(未入力)"; MakeFormObj.ErrorMesEmail_1 = "(形式不備)"; MakeFormObj.ErrorMesEmail_2 = "(不一致)"; MakeFormObj.ErrorMesDate = "(存在しない日付)"; MakeFormObj.EnqueteCookie = ""; MakeFormObj.EnqueteCookieData = {}; MakeFormObj.chekced = new Array(); MakeFormObj.check = function(f, obj){ // 初期化 MakeFormObj.Errors = []; MakeFormObj.PUSH = []; MakeFormObj.WITHIN = []; var results = new Array; var element = new Array; for(i=0;i 0 )? elems[2]: 0; if( Nec > 0 && !MakeFormObj.chekced[obj.p[i]] ){ var message = obj.data[obj.p[i]][0] + ' ' + MakeFormObj.ErrorMesDef; if( !MakeFormObj.Errors[obj.data[obj.p[i]][1]] ){ MakeFormObj.PUSH.push(obj.data[obj.p[i]][1]); } MakeFormObj.Errors[obj.data[obj.p[i]][1]] = message; } } var total_message = ''; for(var i=0;i 0 && _linkages_error !== null ){ _linkages = _linkages_error; } if( _linkages === null ){ var f = document.getElementById( 'form_'+ pid ); if( f ){ var linkage_param = MakeFormObj._linkage_param(f); storage.setItem( _key, linkage_param ); _linkages = linkage_param; } } if( _linkages !== null ){ var _arr = _linkages.split(","); var _hash = new Array(); for(i=0;i<_arr.length;i++){ _hash[_arr[i]] = 1; } var selector = 'tr[id^='+pid+'],div[id^='+pid+']'; $(selector).each(function(){ var pattern = new RegExp("^" + pid + "_([^_]+)(_[0-9]*)"); if( $(this).attr("id").match(pattern) ){ var u = RegExp.$1; if( RegExp.$2 ) u += RegExp.$2; if( _hash[u] ){ this.style.display = "none"; }else{ this.style.display = ""; } } }); if( typeof _atwebmf_linkage_category != "undefined" ){ _atwebmf_linkage_category(pid); } if( typeof sizeIframe != "undefined" ){ sizeIframe(); } } var _key_data = "atwebmf_linkage_data" + pid; var _key_data_error = "atwebmf_linkage_data_error" + pid; var _linkages_data = storage.getItem( _key_data ); var _linkages_data_error = storage.getItem( _key_data_error ); if( _error > 0 && _linkages_data_error !== null ){ _linkages_data = _linkages_data_error; } if( _linkages_data === null ){ var f = document.getElementById( 'form_'+ pid ); if( f ){ var linkage_data = MakeFormObj._linkage_data(f); storage.setItem( _key_data, linkage_data ); _linkages_data = linkage_data; } } if( _linkages_data !== null ){ var f = document.getElementById( 'form_'+ pid ); var _arr = _linkages_data.split(","); var _hash = new Array(); var _def_select = new Array(); for(i=0;i<_arr.length;i++){ if( _arr[i].match( /^select_(.+)_(\d)$/ ) ){ var _p = RegExp.$1; var _i = RegExp.$2; _def_select[_p] = _i; } _hash[_arr[i]] = 1; } if( f ){ jQuery.each(f,function(){ if( typeof this.type !== "undefined" ){ if( typeof this.name !== "undefined" && this.name.match(/^free/g) ){ if( this.type == "select-one" ){ if( typeof _def_select[this.name] !== "undefined" ){ this.selectedIndex = _def_select[this.name]; if( typeof flag_nec_reload !== "undefined" ){ flag_nec_reload(this); } } }else if( this.type != "text" && this.type != "textarea" ) { var _uncheck = "box_" + this.name + "_" + this.value + "_" + 0; var _check = "box_" + this.name + "_" + this.value + "_" + 1; if( typeof _hash[_check] !== "undefined" ){ this.checked = true; } if( typeof _hash[_uncheck] !== "undefined" ){ this.checked = false; } } } } }); } } } if( typeof _ready_linkage_price !== "undefined" ){ _ready_linkage_price(); } return 1; } return 0; } MakeFormObj.setlinkageReload = function(f,linkages,linkage_data){ if ( MakeFormObj.isSessionStorage() ) { if( $("#linkage_reload")[0] ){ $("#linkages").attr( {"value":1} ); }else{ var input = document.createElement( 'input' ); input.name = 'linkage_reload'; input.value = 1; input.type = "hidden"; input.id = "linkage_reload"; f.appendChild( input ); } var _error = 0; $('input').each(function(){ if( this.name == 'display' && this.value == 'error' ){ _error = 1; } }); var storage = sessionStorage; var _pid = f.id.value; var _key = 'atwebmf_linkage_'+ _pid; var _key_error = 'atwebmf_linkage_error_'+_pid; var _key_data = 'atwebmf_linkage_data' + _pid; var _key_data_error = 'atwebmf_linkage_data_error' + _pid; if( _error > 0 ){ storage.setItem( _key_error, linkages ); storage.setItem( _key_data_error, linkage_data ); }else{ storage.setItem( _key, linkages ); storage.setItem( _key_data, linkage_data ); storage.removeItem( _key_error ); storage.removeItem( _key_data_error ); } return 1; } } MakeFormObj.resetlinkage = function(){ if (MakeFormObj.isSessionStorage() ) { var _pid = new Array(); var _error = 0; $('input').each(function(){ if( this.name == 'display' && this.value == 'error' ){ _error = 1; } if( this.name == 'id' ){ _pid.push(this.value); } }); var storage = sessionStorage; for(i=0;i<_pid.length;i++){ var pid = _pid[i]; var _key = 'atwebmf_linkage_'+pid; var _key_error = 'atwebmf_linkage_error_'+pid; var _linkages = storage.getItem( _key ); storage.removeItem( _key ); var _key_data = "atwebmf_linkage_data" + pid; storage.removeItem( _key_data ); } } } MakeFormObj.sendConfirm = function(msg){ var what=confirm(msg); return what; }; MakeFormObj.winLoad = function (func){ if (window.addEventListener) { //for W3C DOM window.addEventListener("load", func, false); }else if (window.attachEvent) { //for IE window.attachEvent("onload", func); }else { window.onload = func; } } MakeFormObj.thanks = function(){ var myUniq; //ユニークID var Anchor = 0; var myhref = location.href; var p_url = ""; var r_url = document.referrer; var m_url = location.href; try{ p_url = parent.location.href; }catch(e){ p_url = ""; } // フレームの場合 if( p_url != m_url ){ myhref = ( r_url != "" )? 'referrer' + r_url : 'no_referrer'; } var uniq = MakeFormObj.getCookie(MakeFormObj.cookieId); if( uniq != "" ){ myUniq = uniq; }else{ Anchor = 1; var parts = location.href.split("#"); var params = {}; if (parts.length == 2) { var uniq = parts[1]; if (uniq.search(/^atmailform/i) != -1) { myUniq = uniq; myhref = parts[0]; }else{ Anchor = 0; } } } //コールバック MakeFormObjCallBack = function( flag, mes ){ if( flag ){ alert(mes); MakeFormObj.resetlinkage(); } MakeFormObj.linkageReload(); } MakeFormObj.myConn(myUniq); if( Anchor ){ MakeFormObj.setUnip = function(obj){ if( obj.href.value != "" ) return; obj.href.value = myhref; }; }else{ MakeFormObj.setUnip = function(obj){ if( obj.href.value != "" ) return; obj.href.value = myhref; }; } MakeFormObj.connRange(); } MakeFormObj.setCookie = function(cookieId,myValue,t){ myItem = cookieId + "=" + escape(myValue) + ";"; if( t && t > 0){ exp=new Date(); exp.setTime(exp.getTime()+t); myItem += "expires=" + exp.toGMTString() + ";"; } document.cookie = myItem; } MakeFormObj.getCookie = function(cookieId){ var cookie_name = cookieId + "="; myValue = null; myStr = document.cookie + ";" ; myOfst = myStr.indexOf(cookie_name); if (myOfst != -1){ myStart = myOfst + cookie_name.length; myEnd = myStr.indexOf(";" , myStart); myValue = unescape(myStr.substring(myStart,myEnd)); return myValue; } return myValue; } MakeFormObj.chkCookie = function(){ var cookieId = 'myCookieText'; var str = 1; MakeFormObj.setCookie(cookieId,str); var myCookie = MakeFormObj.getCookie(cookieId); if( str == myCookie ){ MakeFormObj.setCookie(cookieId,''); return 1; } return 0; } MakeFormObj.myConn = function(uniq){ var url = 'https://tjokayama.jp/form/acc.cgi?mode=jsonp&call=MakeFormCallBack&p='; var rnd = Math.random(); url += uniq + '&f=1' + '&rnd='+ rnd; /* 連動復元パラメータ */ if( typeof jQuery != "undefined" && ! MakeFormObj.isSessionStorage() ){ url += '&linkage_reload=1'; $('input').each(function(){ if( this.name == 'display' && this.value == 'error' ){ url += '&linkage_error=1'; } }); } var script = document.createElement("script"); script.charset = "utf-8"; script.src = url; script.type= "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); } MakeFormObj.myConn2 = function(f){ MakeFormObjRun = function( run ){ if( run ){ alert(run); }else{ MakeFormObj.submit(); } MakeFormObj.Running = 0; } MakeFormObj.Running = 1; var url = 'https://tjokayama.jp/form/acc.cgi?mode=jsonp&call=MakeFormCallBack&p='; var rnd = Math.random(); var fu = ''; if( f.fu ){ fu = f.fu.value } var script = document.createElement("script"); script.charset = "utf-8"; script.src = url + f.id.value + '&r=1' + '&fu=' + fu + '&' + rnd; script.type= "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); }; MakeFormObj.connRange = function(uniq){ var url = 'https://tjokayama.jp/form/acc.cgi?mode=jsonp&call=MakeFormCallBack&p='; url = url.split('#')[0].split('?')[0]; url += '?mode=atv_con&rnd='+ Math.random(); var script = document.createElement("script"); script.charset = "utf-8"; script.src = url; script.type= "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); } MakeFormObj.isDate = function(month, day){ if( month != '' ){ if( month < 1 || month > 12 ){ return 1; } if( day < 1 || day > 31 ){ return 1; } var m = new Array(31,29,31,30,31,30,31,31,30,31,30,31); month -= 1; var d = m[month]; if( d < day ){ return 1; } }else{ if( day != '' ) return 1; } return 0; } // トリガー MakeFormObj.myIFM = function (){ var url = 'acc.cgi'; var ifm = document.createElement("iframe"); ifm.src = url + '?mode=mailchecker&action=iframe&f=1&'+ Math.random(); ifm.style.display = "none"; ifm.style.width = 0+'px'; ifm.style.height = 0+'px'; ifm.style.border = 0+'px'; ifm.style.position = "absolute"; ifm.style.top = -100+'px'; ifm.style.left = -100+'px'; document.body.appendChild(ifm); } MakeFormObj.winLoad(MakeFormObj.thanks); MakeFormObj.send = function(f,opt, href){ var id = f.id.value; var mailObj = MakeFormObj.getSendEmail(f); var mail = ""; if( mailObj ) mail = mailObj.value; if( MakeFormObj.Running == 1 ){ return false; } MakeFormObj.Running = 1; MakeFormObjLoadIn = function(obj){ MakeFormObj.Running = 0; var pid = obj["id"]; MakeFormObj.getResearchCookie(); // 多重投稿 if( obj['RepConfig'] > 0 && MakeFormObj.EnqueteCookieData[pid] ){ if( obj['RepConfig'] == 1 ){ alert(obj['RepError1']); return; } var toDay = MakeFormObj.getToday(); var myday = MakeFormObj.EnqueteCookieData[pid]; if( toDay == myday ){ alert(obj['RepError2']); return; } } if( obj["fu"]["flag"] > 0 ){ alert(obj["fu"]["message"]); return false; } if( obj["mail"] && obj["mail"]["flag"] > 0 ){ alert(obj["mail"]["message"]); return false; } atmf = function(){ }; atmf.data = obj["form"]; atmf.p = obj["prop"]; atmf.ErrorConfig = obj["ErrorConfig"]; atmf.ConfirmConfig = obj["ConfirmConfig"]; atmf.ErrorMessage = obj["ErrorMessage"]; atmf.ConfirmMessage = obj["ConfirmMessage"]; atmf.ThanksConfig = obj["ThanksConfig"]; atmf.thanksMessage = obj["thanksMessage"]; atmf.RepConfig = obj["RepConfig"]; atmf.pid = pid; MakeFormObj.ErrorMesDef = obj["ErrorMesDef"]; MakeFormObj.ErrorMesEmail_1 = obj["ErrorMesEmail_1"]; MakeFormObj.ErrorMesEmail_2 = obj["ErrorMesEmail_2"]; MakeFormObj.ErrorMesDate = obj["ErrorMesDate"]; MakeFormObj.ErrorWithin = obj["ErrorWithin"]; MakeFormObj.ErrorSpam = obj["ErrorSpam"]; MakeFormObj.ErrorFile = obj["ErrorFile"]; MakeFormObj.sender(f,atmf, opt); } var myhref = encodeURIComponent(location.href); var p_url = ""; var r_url = encodeURIComponent(document.referrer); var m_url = location.href; try{ p_url = parent.location.href; }catch(e){ p_url = ""; } // フレームの場合 if( p_url != m_url ){ myhref = ( r_url != "" )? 'referrer' + r_url : 'no_referrer'; } if( f.display && f.display.value == 'error' ) myhref = ""; var url = href + '?mode=jsonp'; var rnd = Math.random(); var script = document.createElement("script"); script.charset = "utf-8"; script.src = url + '&prop=1&i=' + id + '&fu='+ f.fu.value + '&m=' + mail + '&myhref='+ myhref +'&rnd=' + rnd; script.type= "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); return false; } MakeForm.send = MakeFormObj.send; MakeForm.sendSample = function(f,msg){ var id = f.id.value; if( MakeFormObj.Running == 1 ){ return false; } MakeFormObj.Running = 1; MakeFormObjLoadIn = function(obj){ MakeFormObj.Running = 0; var pid = obj["id"]; MakeFormObj.getResearchCookie(); atmf = function(){ }; atmf.data = obj["form"]; atmf.p = obj["prop"]; atmf.ErrorConfig = 0; atmf.ConfirmConfig = obj["ConfirmConfig"]; atmf.ErrorMessage = msg; atmf.ConfirmMessage = obj["ConfirmMessage"]; atmf.thanksMessage = obj["thanksMessage"]; atmf.RepConfig = obj["RepConfig"]; atmf.pid = pid; //MakeFormObj.sender(f,atmf); var error_message = MakeFormObj.check(f, atmf); alert( msg + "\n" + error_message ); } var url = 'https://tjokayama.jp/form/acc.cgi?mode=jsonp&call=MakeFormCallBack&p='; var rnd = Math.random(); var script = document.createElement("script"); script.charset = "utf-8"; script.src = url + '&prop=1&i=' + id + '&rnd=' + rnd; script.type= "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); return false; } MakeFormObj.withIn = function (obj,n,spam){ var func = new Array(); func[0] = function(){ return; }; func[1] = MakeFormObj.isHan; func[2] = MakeFormObj.isNumber; func[3] = MakeFormObj.isZen; func[4] = MakeFormObj.isSuji; func[5] = MakeFormObj.isHiragana; func[6] = MakeFormObj.isKatakana; var mes = new Array(); mes[0] = ''; if( typeof( MakeFormObj.ErrorWithin ) != "undefined" ){ mes[1] = MakeFormObj.ErrorWithin['1']; mes[2] = MakeFormObj.ErrorWithin['2']; mes[3] = MakeFormObj.ErrorWithin['3']; mes[4] = MakeFormObj.ErrorWithin['4']; mes[5] = MakeFormObj.ErrorWithin['5']; mes[6] = MakeFormObj.ErrorWithin['6']; }else{ mes[1] = '(半角のみ)'; mes[2] = '(半角数字のみ)'; mes[3] = '(全角のみ)'; mes[4] = '(全角数字のみ)'; mes[5] = '(全角かなのみ)'; mes[6] = '(全角カナのみ)'; } var spam_mes = new Array(); if( typeof( MakeFormObj.ErrorSpam ) != "undefined" ){ spam_mes[1] = MakeFormObj.ErrorSpam['1']; spam_mes[2] = MakeFormObj.ErrorSpam['2']; }else{ spam_mes[1] = '(半角のみ禁止)'; spam_mes[2] = '(禁止ワード)'; } var myfunc = func[n]; var f = myfunc(obj); if( f ){ return mes[n]; } // スパム対策 var val = obj.value; if( obj.type && (obj.type == 'checkbox' || obj.type == 'radio') ){ if( ! obj.checked ) val = ""; } if( val && val != "" ){ if( spam && spam['check'] && spam['check'] > 0 ){ var f = true; if( obj.type == 'text' || obj.type == 'textarea' ){ f = MakeFormObj.isHan( obj ); }else{ if( ! MakeFormObj.isNumber( obj ) ){ f = true; }else{ f = MakeFormObj.isHan( obj ); } } if( f == false ) return spam_mes[1]; } if( spam && spam['check_word'] && spam['check_word'] > 0 && spam['word'] ){ for( var i=0; i= 0 ){ return spam_mes[2]; } } } } return ''; } /* 半角のみ */ MakeFormObj.isHan = function (obj){ var str=obj.value; for(var i=0; i=4){ return true; } } return false; } /* 半角数字のみ */ MakeFormObj.isNumber = function (obj) { var str=obj.value.replace(/[\n\r]*/g, ""); if( str.match( /[^0-9]+/ ) ) { return true; } return false; } /* 全角のみ */ MakeFormObj.isZen = function (obj){ var str=obj.value.replace(/[\n\r]*/g, ""); if( str.match( /[ァ-ン]+/ ) ) { return true; } for(var i=0; i obj[5] ){ error = 1; } var message1 = ""; var message2 = ""; var message3 = ""; var error_message = ""; if( error ){ if( obj[4] ) message1 = obj[4] + ''; if( obj[5] ) message2 = obj[5] + ''; if( message1 && message2 ) message3 = '~'; error_message = obj[0] +' '+ message1 + message3 + message2 + ''; } return error_message; } // ファイル送信チェック MakeFormObj.fileUpload = function(nec,obj,e){ var error_size = '(サイズ制限)'; var error_ext = '(拡張子制限)'; if( typeof( MakeFormObj.ErrorFile ) != "undefined" ){ error_size = MakeFormObj.ErrorFile['size']; error_ext = MakeFormObj.ErrorFile['ext']; } var val = ""; var val_error = 0; try{ val = e.value; }catch(e){ val_error = 1; } if( val == '' ){ if( nec && val_error != 1 ){ return MakeFormObj.ErrorMesDef; } return ''; } if( obj.ext_config > 0 ){ var fileTypes = val.split("."); var len = fileTypes.length; var ext = fileTypes[len -1]; var exts = obj.ext; var flag = obj.ext_config == 1 ? 0: 1; for(var i=0; i 0 ){ if ( window.File ){ var fileData = e.files[0]; if( fileData.size > obj.size ){ return error_size; } } } return ""; } MakeFormObj.getToday = function(){ var myD = new Date(); myYear = myD.getYear(); myYear4 = (myYear < 2000) ? myYear+1900 : myYear; myMonth = myD.getMonth() + 1; myDate = myD.getDate(); myDay = myD.getDay(); myToday = myYear4 + "-" + myMonth + "-" + myDate; return myToday; } MakeFormObj.setRep = function(pid){ var myday = MakeFormObj.getToday(); MakeFormObj.EnqueteCookieData[pid] = myday; var myValues = new Array; for( var index in MakeFormObj.EnqueteCookieData ){ myValues.push( index +':' + MakeFormObj.EnqueteCookieData[index] ); } var myValue = myValues.join('&'); MakeFormObj.setCookie(MakeFormObj.EnqueteCookie,myValue,1*60*60*24*365); } MakeFormObj.getResearchCookie = function(){ MakeFormObj.EnqueteCookieData = {}; //初期化 var enqueteCookie = MakeFormObj.getCookie(MakeFormObj.EnqueteCookie); if( ! enqueteCookie ) return; var myCookies = enqueteCookie.split("&"); for( var i=0; i if( typeof jQuery != "undefined" ){ $(document).ready( function() { $('#form_153474704114337 input.flag_nec, #form_153474704114337 textarea.flag_nec, #form_153474704114337 select.flag_nec, #form_153474704114337 option.flag_nec').each(function(){ if(this.value == ""){ $(this).addClass("color_nec"); } else { $(this).removeClass("color_nec"); } }); $('#form_153474704114337 input.flag_nec, #form_153474704114337 textarea.flag_nec, #form_153474704114337 select.flag_nec, #form_153474704114337 option.flag_nec').blur(function(){ if(this.value == ""){ $(this).addClass("color_nec"); } else { $(this).removeClass("color_nec"); } }); }); } function flag_nec_reload(e){ if( e.value != "" ){ $(e).removeClass("color_nec"); }else{ if( typeof $(e).attr( "class" ) !== "undefined" && $(e).attr( "class" ).match(/flag_nec/) ){ $(e).addClass("color_nec"); } } } if( typeof jQuery != "undefined" ){ $(document).ready( function() { _atweb_linkage_date(); }); function _atwebmf_linkage_iframeResize(pid){ /* sessionStrage */ /*if (typeof sessionStorage !== 'undefined') { if( typeof MakeFormMag.linkage !== "undefined" ){ var form = document.getElementById( "form_" + pid ); //if( typeof form !== "undefined" ) // MakeFormMag.linkage(form); } }*/ _atwebmf_linkage_category(pid); if( typeof sizeIframe != "undefined" ){ sizeIframe(); } } function _atwebmf_linkage_category(pid){ if( typeof atwebMFLinkageProperty[pid] === "undefined" ){ return; } jQuery.each(atwebMFLinkageProperty[pid],function(i,arr){ var _id = pid + '_' + i; var _hidden = 1; jQuery.each(arr,function(i,v){ var _child = pid + '_' + v; if( $('#'+_child).css( "display" ) != "none" ) _hidden = 0; }); if( _hidden > 0 ){ $("#"+_id).css( {"display": "none"} ); }else{ $("#"+_id).css( {"display": ""} ); } }); } function _atweb_linkage_date(){ $("select[name^=mon]").each(function(){ $(this).change(function(){ var f = this.form.elements; if( f['id'].value == '153474704114337' ){ var py = this.name.replace("mon", "year"); var month = new Array( 0,31,28,31,30,31,30,31,31,30,31,30,31 ); if( typeof f[py] !== "undefined" && typeof f[py].options !== "undefined" ){ var y = f[py].options[f[py].selectedIndex].value; if( y % 4 == 0 && y % 100 != 0 || y % 400 == 0){ month[2] = 29; } } var m = this.options[this.selectedIndex].value; if( m > 0 && m <= 12 ){ var eom = month[m]; var pd = this.name.replace("mon", "day"); if( typeof f[pd] !== "undefined" && typeof f[pd].options !== "undefined" ){ var d = f[pd]; var _index = d.options[d.selectedIndex].value; for( i=d.options.length-1; i>0; i-- ){ if( i > eom ){ d.options[i] = null; } } if( d.options.length <= eom ){ for( i=d.options.length; i<=eom; i++ ){ d.options[i] = new Option(i,i); } } } } } }).change(); }); $("select[name^=year]").each(function(){ $(this).change(function(){ var f = this.form.elements; if( f['id'].value == '153474704114337' ){ var pm = this.name.replace("year", "mon"); if( typeof f[pm] !== "undefined" && typeof f[pm].options !== "undefined" ){ $(f[pm]).change(); } } }); }) } } // form property if( typeof atwebMFLinkageProperty == "undefined" ){ atwebMFLinkageProperty = function(){ }; } atwebMFLinkageProperty['153474704114337'] = {}; atwebMFLinkageProperty['153474704114337']['table_1'] = ["free_1n","free_2n"]; atwebMFLinkageProperty['153474704114337']['table_2'] = ["name_1n","mail_1n","tel_1n"];