/* country selection javascript Automatically selects the Regulation text according to the selected country and language preference of the browser. */ var selectFlag = false; // セレクトボックス選択フラグ var countryLanguage = "en"; var selectCountry; function changeCountrySelect(countrycode){ // debug // str = new String("countrycode = \"" + countrycode + "\"\n"); // for (i = 0; i < document.MptMemberRegistrationForm.country.length; i++){ // str = str + "document.MptMemberRegistrationForm.country[" + i + "].value = \"" + document.MptMemberRegistrationForm.country[i].value + "\"\n"; // } // alert(str); // debug end for (i = 0; i < document.MptMemberRegistrationForm.country.length; i++){ if (countrycode == document.MptMemberRegistrationForm.country[i].value){ document.MptMemberRegistrationForm.country.options[i].selected = "true"; } } } function changeCountrySelectExt(countrycode){ // debug // str = new String("countrycode = \"" + countrycode + "\"\n"); // for (i = 0; i < document.MptMemberRegistrationForm.country.length; i++){ // str = str + "document.MptMemberRegistrationForm.country[" + i + "].value = \"" + document.MptMemberRegistrationForm.country[i].value + "\"\n"; // } // alert(str); // debug end for (i = 0; i < document.getElementById("RegistForm").country.length; i++){ if (countrycode == document.getElementById("RegistForm").country[i].value){ document.getElementById("RegistForm").country.options[i].selected = "true"; } } } /* * 利用規約取得処琅 * * @return true: 選択済/ false:未選謚魘€ * @author Seishiro Abe */ function changeCountry(country,texttype,target){ //初期匕 var rc = ''; var lang = ''; var textname = ''; fnlen = document.forms.length; if (target == null || target == '') { target='ruleBox'; } selectCountry = country; if (fnlen > 1) { // alert(document.forms[0].name); if (document.forms[0].elements[document.forms[0].elements.length - 1].name == "agreeFlg") { document.MptMemberRegistrationForm.agreeFlg.checked = false; } } //莢・ぞ荐㊤・€・€ inc = new Array('US'); inc2_en = new Array('CA'); inc_es = new Array('MX'); bv = new Array('AT','BE','CH','DE','DK','FI','FR','IE','LU','MC','NL','NO','SE','GB','IT','ES','PT','PL','CZ','HU','IS'); bv2_en = new Array('RU'); nhk_en = new Array('AU','IN','MY','TH','ID','AE'); nhk = new Array('HK','SG'); nhan = new Array('JP'); nikc = new Array('KR'); other = new Array('CN'); //言語対応設宙 globalLang = new Array('de','en','fr','ko','ja','zh'); incLang = new Array('en','fr'); bvLang = new Array('de','en','fr','es','it'); nhkLang = new Array('zh','en'); nhanLang = new Array('ja'); nikcLang = new Array('ko'); otherLang = new Array('en'); //言語ロケール取蠕髦€ if (window.navigator.language){ lang = window.navigator.language.toLowerCase(); } else if (window.navigator.userLanguage){ lang = window.navigator.userLanguage.toLowerCase(); } if (texttype == "reg"){ textname = "regulation"; } else if (texttype == "pri"){ textname = "privacypolicy"; } else if (texttype == "au_reg"){ textname = "au_regulation"; } else if (texttype == "dpf"){ textname = "dpf_regulation"; } else if ("campaign") { var tmpTextName = target.toLowerCase().split("rulebox"); textname = tmpTextName[0] + "_regulation"; } else { return; } if (country != ''){ //ボタンをEnable setSelectFlag("true"); //国が選択されているとき([textname]_[販社コード].txtを表示( for (var i = 0; i < inc.length && rc == ''; i++){ if (country == inc[i]) { rc = 'inc'; countryLanguage = 'en'; } } for (var i = 0; i < inc2_en.length && rc == ''; i++){ if (country == inc2_en[i]) { rc = 'inc2_en'; countryLanguage = 'en'; for (var j = 0; j < incLang.length; j++){ if (lang == incLang[j]) { rc = 'inc2_' + lang; countryLanguage = lang; } } } } for (var i = 0; i < inc_es.length && rc == ''; i++){ if (country == inc_es[i]) { rc = 'inc_es'; countryLanguage = 'es'; } } for (var i = 0; i < bv.length && rc == ''; i++){ if (country == bv[i]) rc = 'bv'; for (var j = 0; j < bvLang.length && rc == 'bv'; j++){ //bvの多言語利用規邏闌€ if (lang == bvLang[j]) { rc = rc + '_' + lang; countryLanguage = lang; } } if (rc == 'bv') { rc = rc + '_en'; countryLanguage = 'en'; } } for (var i = 0; i < bv2_en.length && rc == ''; i++){ if (country == bv2_en[i]) { rc = 'bv2_en'; countryLanguage = 'en'; } } for (var i = 0; i < nhk_en.length && rc == ''; i++){ if (country == nhk_en[i]) { rc = 'nhk'; countryLanguage = 'en'; } } for (var i = 0; i < nhk.length && rc == ''; i++){ if (country == nhk[i]) rc = 'nhk'; for (var j = 0; j < nhkLang.length && rc == 'nhk'; j++){ //nhkの多言語利用規邏闌€ if (lang == nhkLang[j]) { rc = rc + '_' + lang; countryLanguage = lang; } } if (rc == 'nhk') { rc = rc + '_en'; countryLanguage = 'en'; } } for (var i = 0; i < nhan.length && rc == ''; i++){ if (country == nhan[i]) { rc = 'nhan'; countryLanguage = 'ja'; } } for (var i = 0; i < nikc.length && rc == ''; i++){ if (country == nikc[i]) { rc = 'nikc'; countryLanguage = 'ko'; } } for (var i = 0; i < other.length && rc == ''; i++){ if (country == other[i]) { rc = 'other_zh'; countryLanguage = 'en'; } } if (rc == '') { rc = 'other'; countryLanguage = 'en'; } setRegLang(countryLanguage); getRuleBoxText('/pictureBank/common/' + textname + '_' + rc +'.txt', target); } else { //ボタンをDisable setSelectFlag("false"); //国が選択されていないとが if (lang == 'de' || lang == 'en' || lang == 'fr' || lang == 'ko' || lang == 'ja' || lang == 'zh'){ //言語ロケールが独英仏韓日中([textname]_defalt_[言語コード].txtを表示( getRuleBoxText('/pictureBank/common/' + textname + '_defalt_' + lang +'.txt', target); } else { //言語ロケールが独英仏韓日中([textname]_defalt_ko.txtを表示( getRuleBoxText('/pictureBank/common/' + textname + '_defalt_ko.txt', target); } } } function formSubmitSelected(form, url, target) { if ( getSelectFlag() =="false" ) { return; } form.action = url; if (target != null) { form.target = target; } else { form.target = "_top"; } form.submit(); } /* * 居住国選択フラグ取蠕髦€ * * @return true: 選択済/ false:未選謚魘€ * @author Seishiro Abe */ function getSelectFlag() { return window.self != window.top ? window.top.selectFlag : selectFlag; } /* * 居住国選択フラグ設宙 * */ function setSelectFlag( flag ) { if ( window.self != window.top ) { window.top.selectFlag = flag; } else { selectFlag = flag; } } /* ---------------------------------------------------------------------------- * AJAX * ---------------------------------------------------------------------------- */ /** * 利用規約検索 * */ function getRuleBoxText(url,target){ //var myAjax = new Ajax.Updater(target, url, {method: 'get'}); $.ajax({ url: url, type: "get", dataType: "html", success: function(returnData){ $("#"+target).html(returnData); }, error: function(e){ } }); } // old キャッシュからgetHTMLを参照する可能性があるためgetRuleBoxTextと並行して記述 function getHTML(url,target){ getRuleBoxText(url,target); } /** * オプトイン情報取蠕髦€ * * @param {String} lang 言隱魘€ */ function findOptinDataReg(lang) { setRegLang(lang); if (document.getElementById('optin_area') != null) { findOptinData('', '', lang); } } /** * オプトイン情報取蠕髦€ * * @param {String} country 居住国 * @param {String} flowFlg フローフラグ(使用しない) function findOptinData(country, flowFlg) { findOptinData(country, '', ''); } */ /** * オプトイン情報取蠕髦€ * * @param {String} country 居住国 * @param {String} flowFlg フローフラグ(使用しない) * @param {String} lang 言隱魘€ */ function findOptinData(inCountry, flowFlg, inLang) { var country; var language; if (inLang == null || inLang == '') { language = countryLanguage; } else { language = inLang; } if (inCountry == null || inCountry == '') { country = selectCountry; } else { country = inCountry.toUpperCase(); } setRegLang(language); optinService.selectOptinMaster(country, language, { callback:function(enity) { if (DWRUtil._isArray(enity)) { isVisibility(enity.length, 'optin_area'); var innerHtmlText = ''; if (enity.length > 0) { innerHtmlText = '
'; for (i = 0; i < enity.length; i++) { var obj = enity[i]; innerHtmlText = innerHtmlText + '
'; innerHtmlText = innerHtmlText + ' '; } else { innerHtmlText = innerHtmlText + '"> '; } innerHtmlText = innerHtmlText + obj.name.escapeHTML(); if (obj.text != null && obj.text != '') { innerHtmlText = innerHtmlText + '

'; innerHtmlText = innerHtmlText + ' ' + nullToBlank(obj.text).escapeHTML(); innerHtmlText = innerHtmlText + '

'; } innerHtmlText = innerHtmlText + '
'; } innerHtmlText = innerHtmlText + '
'; } document.getElementById('optin_check').innerHTML = innerHtmlText; } }, errorHandler:function(errorString, exception) { location.href = "../error/BusinessErrorServerError.do"; //alert('エラー:' + errorString); } }); } /** * オプトイン情報取蠕髦€ * * @param {String} country 居住国 * @param {String} flowFlg フローフラグ(使用しない) * @param {String} lang 言隱魘€ */ function setRegLang(lang) { if (document.getElementById('regLang') != null) { document.getElementById('regLang').value = lang; } } /** * デフォルトタイムゾーン取蠕髦€ * * @param {Object} form formオブジェクデ */ function findTimezone(timezone) { timezoneService.findTimezoneSet(zip1, zip2, { callback:function(address) { if (address == null) { alertZipBlock(); return; } for (var i = 0; i < state.length; i++) { if (state.options[i].text == address.state) { state.options[i].selected = true; break; } } address1.value = address.address1; address2.value = address.address2; alertZipNone(); }, errorHandler:function(errorString, exception) { //alert('エラー:' + errorString); } }); } /** * Null変換 * * 入力値がNullの場合は空白、Null出ない場合は入力値を返却 * * @param str 入力値 */ function nullToBlank(str) { if (str == null) { return ''; } else { return str; } } function isVisibility(listSize, id) { if (listSize > 0 && listSize != '') { setVisibility(id, true); } else { setVisibility(id, false); } } function setVisibility(id, visible) { document.getElementById(id).style.display = visible ? "block" : "none"; } /** * 郵便番号検索、 * * @param {Object} form formオブジェクデ function findAddressByZip(form) { var zip1 = form.zipCode1.value; var zip2 = form.zipCode2.value; var state = form.address1; var address1 = form.address2; var address2 = form.address3; if (zip1 == null || zip1.length != 3 || !isInteger(zip1)) { alertZipBlock(); return; } if (zip2 == null || zip2.length != 4 || !isInteger(zip2)) { alertZipBlock(); return; } if (state == null || address1 == null || address2 == null) { alertZipBlock(); return; } // if (form.button_43.disabled) { //alertZipBlock(); // return; //} //form.button_43.disabled =true; zipService.findAddressInfo(zip1, zip2, { callback:function(address) { if (address == null) { // form.button_43.disabled =false; alertZipBlock(); return; } for (var i = 0; i < state.length; i++) { if (state.options[i].text == address.state) { state.options[i].selected = true; break; } } address1.value = address.address1; address2.value = address.address2; alertZipNone(); // form.button_43.disabled =false; }, errorHandler:function(errorString, exception) { // form.button_43.disabled =false; alertZipBlock(); //alert('エラー:' + errorString); } }); } */