//숫자 콤마 function setComma(str){ var str = String(str); var str_len = str.length; var return_str = ''; var val = ''; var j = 0; for(i=str_len;i>0;i--){ if(str.substring(i,i-1) != ',') val = str.substring(i,i-1) + val; } str_len = val.length; for(i=str_len; i>0; i--){ if(j%3 == 0 && j != 0) return_str = val.substring(i,i-1) + ',' + return_str; else return_str = val.substring(i,i-1) + return_str; j++; } return return_str; } //자동 콤마 찍기 function autoAddComma(obj) { if(event.keyCode == 37 || event.keyCode == 39 ) { return; } var strValue = obj.value.replace(/,|\s+/g,''); if(isNaN(strValue)) { alert(strValue.concat('숫자가 아닙니다.')); return false; } var commaValue = setComma(strValue); obj.value = commaValue; } //이벤트 좌표 function getEventXY(e){ var loc = new Array(); loc['x'] = 0; loc['y'] = 0; if(e==null) e=window.event; if(e.pageX || e.pageY) { loc['x'] = e.pageX; loc['y'] = e.pageY; }else if(e.clientX || e.clientY) { if(document.documentElement.scrollTop) { loc['x'] = e.clientX+document.documentElement.scrollLeft; loc['y'] = e.clientY+document.documentElement.scrollTop; } else { loc['x'] = e.clientX+document.body.scrollLeft; loc['y'] = e.clientY+document.body.scrollTop; } } return loc; } //디자인상품 리스트화면의 탭메뉴 function tabProductDisplay(id) { switch(id) { case 'newProductListBlock': document.getElementById('bestNewProductTab').className = 'tab_newdesign'; document.getElementById('newProductListBlock').style.display = 'block'; document.getElementById('bestProductListBlock').style.display = 'none'; break; case 'bestProductListBlock': default: document.getElementById('bestNewProductTab').className = 'tab_bestdesign'; document.getElementById('newProductListBlock').style.display = 'none'; document.getElementById('bestProductListBlock').style.display = 'block'; break; } } //상품상세의 탭메뉴 function tabDesignProductDetailDisplay(id) { switch(id) { case 'designProductAgreement': document.getElementById('designProductAgreementTab').src = '../img/design/tab_menu_top_4_on.gif'; document.getElementById('designProductAgreement').style.display = 'block'; document.getElementById('designProductDetailContentTab').src = '../img/design/tab_menu_top_1_off.gif'; document.getElementById('designProductDetailContent').style.display = 'none'; break; case 'designProductDetailContent': document.getElementById('designProductAgreementTab').src = '../img/design/tab_menu_top_4_off.gif'; document.getElementById('designProductAgreement').style.display = 'none'; document.getElementById('designProductDetailContentTab').src = '../img/design/tab_menu_top_1_on.gif'; document.getElementById('designProductDetailContent').style.display = 'block'; default: break; } } //디자인 카테고리별 검색 function designCategorySearch(obj) { if(!obj.cid.value) { obj.scid[0].selected = true; } obj.searchProductName.value = ''; obj.searchPriceFrom.value = ''; obj.searchPriceTo.value = ''; obj.submit(); } //디자인상품 검색 submint function designProductSearchFormSubmit(obj) { if(!obj.cid.value) { obj.cid[0].selected = true; } //가격대검색 ',' 없애기 var searchPriceFromVal = obj.searchPriceFrom.value.replace(/,|\s+/g,''); var searchPriceToVal = obj.searchPriceTo.value.replace(/,|\s+/g,''); if(searchPriceFromVal || searchPriceToVal) { if(isNaN(searchPriceFromVal) || !searchPriceFromVal) { alert('디자인 가격검색 시작값을 숫자로 입력해 주세요.'); obj.searchPriceFrom.focus(); return false; } if(isNaN(searchPriceToVal) || !searchPriceToVal) { alert('디자인 가격검색 종료값을 숫자로 입력해 주세요.'); obj.searchPriceTo.focus(); return false; } } obj.searchPriceFrom.value = searchPriceFromVal; obj.searchPriceTo.value = searchPriceToVal; return true; } function selectBoxView(obj) { if(document.getElementById(obj).style.display == 'none') { document.getElementById(obj).style.display = 'block'; } else { document.getElementById(obj).style.display = 'none'; } }