console.log("InquiryForProdJS");
$.urlParam = function(name) {
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null) {
return null;
} else {
return results[1] || 0;
}
}
function callWingInquiryProdApi(this_form) {
if (comFormmailFormCheckFlag == true) {
return false;
}
Ajax.init("/cjs/ajax/ajax.formmail.php?com_formmail_id=1&template=base", null, 'GET', null, null, false, false);
var rsXml = Ajax.rltXml();
if (this_form) {
var fform = this_form;
} else {
var fform = "com_formmail";
}
//rsXml = Ajax.rltXml();
var xmlData = Ajax.rltXmlLoop(rsXml, "formmail_title");
var tempArr = new Array();
//##### °³ÀÎÁ¤º¸ Ȱ¿ë üũ È®ÀÎ
if(jQuery("#agree").is(':checked')){
// console.log("üũ");
}else{
// console.log("üũ ¾ÈÇÔ");
alert("¾à°ü¿¡ µ¿ÀÇÇØ Áֽñ⠹ٶø´Ï´Ù.");
return false;
}
//##### °³ÀÎÁ¤º¸ Ȱ¿ë üũ È®ÀÎ
for (var i = 0; i < xmlData.length; i++) {
tempArr[i] = new Array();
tempArr[i]["code"] = Ajax.rltXmlOnce(xmlData[i], "code");
tempArr[i]["name"] = Ajax.rltXmlOnce(xmlData[i], "name");
tempArr[i]["attribute"] = Ajax.rltXmlOnce(xmlData[i], "attribute");
tempArr[i]["necessary"] = Ajax.rltXmlOnce(xmlData[i], "necessary");
tempArr[i]["attribute_value"] = Ajax.rltXmlOnce(xmlData[i], "attribute_value");
if (Common.int(tempArr[i]["necessary"]) == 1) {
//console.log("======" + tempArr[i]["name"] + "========");
switch (Common.int(tempArr[i]["attribute"])) {
case 1: //ÀϹÝÅØ½ºÆ®
FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], '', '1-' + tempArr[i]["attribute_value"]);
break;
case 3: //À̸ÞÀÏ
FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], 'email');
break;
case 2: //testarea
case 4: //URL
case 9: //select
jQuery("select[name='" + tempArr[i].code + "'] option:eq(0)").val(""); // 0¹øÂ° ºñ¿ì±â
FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], '');
break;
case 5: //ÀüȹøÈ£
if (Common.int(tempArr[i]["attribute_value"]) == 2) {
FormCheck.setCheck(fform, tempArr[i]["code"] + '0', 'y', tempArr[i]["name"], 'num', '1-4');
}
FormCheck.setCheck(fform, tempArr[i]["code"] + '1', 'y', tempArr[i]["name"], 'num', '1-4');
FormCheck.setCheck(fform, tempArr[i]["code"] + '2', 'y', tempArr[i]["name"], 'num', '1-4');
FormCheck.setCheck(fform, tempArr[i]["code"] + '3', 'y', tempArr[i]["name"], 'num', '1-4');
break;
case 6: //³¯Â¥
FormCheck.setCheck(fform, tempArr[i]["code"] + 'Y', 'y', tempArr[i]["name"], '');
FormCheck.setCheck(fform, tempArr[i]["code"] + 'M', 'y', tempArr[i]["name"], '');
FormCheck.setCheck(fform, tempArr[i]["code"] + 'D', 'y', tempArr[i]["name"], '');
break;
case 7: //ÁÖ¼Ò
if (Common.int(tempArr[i]["attribute_value"]) == 1) {
FormCheck.setCheck(fform, tempArr[i]["code"] + '_post1', 'y', tempArr[i]["name"], 'num', '5-5');
//FormCheck.setCheck(fform, tempArr[i]["code"]+'_post2', 'y', tempArr[i]["name"], 'num', '3-3');
}
FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], '');
break;
case 8: //file
FormCheck.setCheck(fform, tempArr[i]["code"] + '[]', 'y', tempArr[i]["name"], 'file', '', '', '');
break;
case 10: //üũ¹Ú½º
FormCheck.setCheck(fform, tempArr[i]["code"] + '[]', 'y', tempArr[i]["name"], 'checkbox', '', '', '1');
break;
case 11: //¶óµð¿À¹öư
FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], 'checkbox', '', '', '');
break;
case 13: //ÈÞ´ëÀüÈ
if (Common.int(tempArr[i]["attribute_value"]) == 1) {
FormCheck.setCheck(fform, tempArr[i]["code"] + '0', 'y', tempArr[i]["name"], '');
}
FormCheck.setCheck(fform, tempArr[i]["code"] + '1', 'y', tempArr[i]["name"], 'num', '1-4');
FormCheck.setCheck(fform, tempArr[i]["code"] + '2', 'y', tempArr[i]["name"], 'num', '1-4');
FormCheck.setCheck(fform, tempArr[i]["code"] + '3', 'y', tempArr[i]["name"], 'num', '1-4');
break;
}
}
}
// °³ÀÎÁ¤º¸ÀÇ ¼öÁý ¹× ÀÌ¿ë¸ñÀû üũ
if (eval(document.com_formmail.com_formmail_check_safe) != undefined) {
FormCheck.setCheck(fform, 'com_formmail_check_safe', 'y', '°³ÀÎÁ¤º¸ÀÇ ¼öÁý ¹× ÀÌ¿ë¸ñÀû', 'checkbox', '', '', '');
}
//°³ÀÎÁ¤º¸ ¼öÁý µ¿ÀÇ »ç¿ëÀÚ ÀÓÀÇ·Î »ðÀÔÇÏ´Â °æ¿ì Ãß°¡.2011.05.11
if (eval(document.com_formmail.com_formmail_check_safe_user_add) != undefined) {
FormCheck.setCheck(fform, 'com_formmail_check_safe_user_add', 'y', '°³ÀÎÁ¤º¸ÀÇ ¼öÁý ¹× ÀÌ¿ë¸ñÀû', 'checkbox', '', '', '');
}
if (FormCheck.init(fform) == true) {
var f = document.forms['com_formmail'];
f.target = '';
if (typeof(gRelay) != "undefined") {
//gRelay.relayForm('com_formmail');
gRelay.relayForm(f);
}
// ½ºÆÔÄÚµåüũ
try {
if (!document.getElementsByName('captcha_code')[0].value) {
alert('½ºÆÔ¹æÁö¹®ÀÚ¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
document.getElementsByName('captcha_code')[0].focus();
return false;
}
} catch (e) {}
//### À®Áî api È£Ãâ..
comFormmailFormCheckFlag = true;
// var apiUrl = "http://wings.weandsoft.com/board/exclude/content_action_api.jsp"; //¼öÁ¤
var apiUrl = "https://demo.weandsoft.com/api/content_action_api.jsp"; //¼öÁ¤(HTTPS À̽´·Î DEMO ÅëÇØ¼ À®Áî·Î ¿äû)
try {
var boardId = "291"; //Á¦Ç°¹®ÀÇ : 291, ±â¼ú¹®ÀÇ : 310
var title = encodeURIComponent(jQuery("select[name=add2] option:selected").text()); //¹®ÀǺзù
var cname = encodeURIComponent(jQuery("input[name=add1]").val()); //ȸ»ç¸í
var name = encodeURIComponent(jQuery("input[name=name]").val()); //´ã´çÀÚ¸í
var tel = encodeURIComponent(jQuery("input[name=phone_no1]").val()) + "-" + encodeURIComponent(jQuery("input[name=phone_no2]").val()) + "-" + encodeURIComponent(jQuery("input[name=phone_no3]").val()); //¿¬¶ôó
var email = encodeURIComponent(jQuery("input[name=receiver_email]").val()); //À̸ÞÀÏ
var inquiry = encodeURIComponent(jQuery("textarea[name=description1]").val()); //¹®Àdz»¿ë
var visitRoute = encodeURIComponent(jQuery("select[name=add3] option:selected").text()); //¹æ¹®°æ·Î
var title_org = jQuery("select[name=add2] option:selected").text();
if (title_org == "Á¦Ç°¹®ÀÇ" || title_org == "»ç¾÷Çù·Â" || title_org == "±âŸ") {
boardId = "291";
} else if (title_org == "±â¼úÁö¿ø") {
boardId = "310";
}
http = jQuery.ajax({
url: apiUrl,
type: "POST",
dataType: 'xml',
data: {
"boardId": boardId,
"title": title,
"cname": cname,
"tel": tel,
"name": name,
"email": email,
"inquiry": inquiry,
"visitRoute": visitRoute
},
async: false,
timeout: 5000,
error: function(xml) {
console.log("À®Áî µî·Ï API ¿äû¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
},
success: function(xml) {
if (jQuery(xml).find("result > code").text() == "success") {
console.log("À®Áî µî·Ï API ¿äûÀÌ ¿Ï·á µÇ¾ú½À´Ï´Ù.");
// ³×À̹ö ±¤°í ·Î±× ºÐ¼®
if (typeof(wcs) != "undefined") {
if (!wcs_add) var wcs_add={};
wcs_add["wa"] = "s_16e3e8cb3c81";
var _nasa={};
_nasa["cnv"] = wcs.cnv("4","1");
wcs_do(_nasa);
}
// ³×À̹ö ±¤°í ·Î±× ºÐ¼®
} else {
console.log("À®Áî µî·Ï API ¿äû¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù. [code:" + jQuery(xml).find('result > code').text() + " / data:" + jQuery(xml).find('result > data').text() + "]");
}
}
});
} catch (e) {
console.log("============================ Call Wings Api Error !!! ============================");
}
comFormmailFormCheckFlag = false;
//### À®Áî api È£Ãâ..
//### Ä«Æä24 Æû¸ÞÀÏ ½ÇÇà..
com_formmail_formCheck();
//console.log("============================ Ä«Æä24 Æû¸ÞÀÏ Àü¼Û ============================");
//### Ä«Æä24 Æû¸ÞÀÏ ½ÇÇà..
}
return false;
}
var tempSize = 0;
var isFirst = true;
jQuery(window).resize(function(event) {
var temp = Math.abs(tempSize-window.outerWidth);
console.log("temp = " + temp);
if (isFirst == false && temp > 0){
updateInquiryForm();
tempSize = window.outerWidth;
}else{
tempSize = window.outerWidth;
isFirst = false;
}
});
//######### Å×ÀÌºí ºÐÇÒ
//¸ð¹ÙÀÏ»çÀÌÁî 1024 ±âÁØ µÎÁ٠ǥ½Ã, ±×º¸´Ù ÀÛÀ¸¸é ÇÑÁ٠ǥ½Ã
var bOrgFlag = true; //true º¯°æÇÏÁö ¾ÊÀº UI, false º¯°æµÈ UI
var prevSkipIdx = 0;
var nextSkipIdx = 5;
var mobileLimitSize = 1024;
function updateInquiryForm() {
var idx = 0;
var prevTr;
jQuery(".formmail_textarea_style").css("width", "100%");
jQuery(".form_style input[type=text]").css("width", "100%");
if (jQuery("body").width() >= mobileLimitSize && bOrgFlag == true) {
jQuery("form[name=com_formmail]").parents("table").find("table").find("tr").each(function(index, item) {
if (prevSkipIdx <= idx && idx <= nextSkipIdx) {
jQuery(this).find("td").each(function(index, item) {
console.log(">>>" + jQuery(this).attr("width"));
if (jQuery(this).attr("width") == "20%") jQuery(this).attr("width", "15%");
if (jQuery(this).attr("width") == "80%") jQuery(this).attr("width", "35%");
});
if (idx % 2 == 1) {
console.log(jQuery(this).html());
jQuery(this).find("td").each(function(index, item) {
jQuery(this).addClass("InquiryMoveObj")
});
jQuery(prevTr).append(jQuery(this).children());
} else {
prevTr = this;
}
} else {
jQuery(this).find("td").each(function(index, item) {
if (jQuery(this).attr("width") == "20%") jQuery(this).attr("width", "15%");
if (jQuery(this).attr("width") == "80%") {
jQuery(this).attr("width", "85%");
jQuery(this).attr("colspan", "3");
}
if (jQuery(this).attr("colspan") == "2") jQuery(this).attr("colspan", "4"); // °¡Àå ¹Ø¿¡ ¼±
});
}
idx++;
});
bOrgFlag = false;
} else if (jQuery("body").width() < mobileLimitSize && bOrgFlag == false) {
jQuery("form[name=com_formmail]").parents("table").find("table").find("tr").each(function(index, item) {
jQuery(this).find(".InquiryMoveObj").each(function(index, item) {
jQuery(this).parent().next().append(jQuery(this));
jQuery(this).removeClass("InquiryMoveObj")
});
jQuery(this).find("td").each(function(index, item) {
if (jQuery(this).attr("width") == "15%") jQuery(this).attr("width", "20%");
if (jQuery(this).attr("width") == "35%") {
jQuery(this).attr("width", "80%");
jQuery(this).attr("colspan", "1");
}
if (jQuery(this).attr("colspan") == "4") jQuery(this).attr("colspan", "2"); // °¡Àå ¹Ø¿¡ ¼±
});
idx++;
bOrgFlag = true;
});
} else {
//óÀ½ºÎÅÍ ¸ð¹ÙÀÏ ¾ç½ÄÀÏ °æ¿ì
}
}
jQuery(document).ready(function() {
//######### Çʼö Àû»ö Ç¥±â
jQuery(".formmail_title_bgcolor").each(function(index, item) {
// console.log(jQuery(this).children('font').text());
if (jQuery(this).children('font').text() == "¹®ÀǺзù") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
if (jQuery(this).children('font').text() == "À̸§") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
if (jQuery(this).children('font').text() == "À̸ÞÀÏ") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
if (jQuery(this).children('font').text() == "ȸ»ç¸í") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
if (jQuery(this).children('font').text() == "ÀüȹøÈ£") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
if (jQuery(this).children('font').text() == "¹æ¹®°æ·Î") jQuery(this).children('font').html(jQuery(this).children('font').text() + " *");
});
//######### Çʼö Àû»ö Ç¥±â
updateInquiryForm();
//######### Å×ÀÌºí ºÐÇÒ
//jQuery("form[name=com_formmail]").parents("table").find("table").find("tr").each(function(index, item) {
//jQuery(this).find("td").each(function(index, item) {
//jQuery(this).html(jQuery(this).html().replaceAll(" ", ""));
//});
//});
//###### ¹®ÀǺзù ¼±ÅÃ
if($.urlParam('left') == "1"){
$("select[name='add2']").val("1").prop("selected", true);
}else if($.urlParam('left') == "2"){
$("select[name='add2']").val("2").prop("selected", true);
}
});
//######### Å×ÀÌºí ºÐÇÒ