//###공용모듈###
//----------------------------------------------------------------------------------
function ViewCss2(css) {
document.write("\");
}
//공백체크
function CheckSpaces(str,m) {
var flag=true;
var strValue = str.value;
if (strValue!=" ") {
for (var i=0; i < strValue.length; i++) {
if (strValue.charAt(i) != " ") {
flag=false;
break;
}
}
}
if(flag == true) {
alert( m + "을(를) 입력하십시요.");
str.focus();
}
return flag;
}
function CheckRadio(obj, objName){ //체크박스, 라디오버튼 체크
var trueCnt = 0;
for(i=0;i < obj.length;i++){
if(obj[i].checked == true){
trueCnt = trueCnt + 1;
}
}
if(trueCnt == 0){
alert(objName+"을(를) 체크하세요");
obj[0].focus();
return true;
}else{
trueCnt = 0;
return false;
}
}
function CheckRadio2(objId, cnt, objName){ //체크박스, 라디오버튼 체크, 사용필드전용
var trueCnt = 0;
cnt = eval(cnt);
for(i=1;i <= cnt;i++){
obj = document.getElementById(objId+"_"+i);
if(obj.checked == true){
trueCnt = trueCnt + 1;
}
}
if(trueCnt == 0){
obj = document.getElementById(objId+"_1");
alert(objName+"을(를) 체크하세요");
obj.focus();
return true;
}else{
trueCnt = 0;
return false;
}
}
function Digit(str) {
var flag = false;
if (str.value == "" ) {
alert("금액을 입력하여주세요");
str.focus();
flag = true;
}else {
for(i=0; i < str.value.length; i++){
var tmp_chr = str.value.charAt(i);
if(/^[0-9]/.test(tmp_chr) == false) {
alert("금액에는 숫자만 입력이 가능합니다");
str.value="";
str.focus();
flag = true;
break;
}
}
}
return flag;
}
//숫자 체크
function Number( str, m ) {
var flag = false;
var Digit= "1234567890";
if ( CheckSpaces(str,m) == false) {
for(i=0; i 12){
alert("잘못된 주민등록번호입니다.");
return true;
}
tmp = jstr.charAt(4);
tmp = tmp + jstr.charAt(5);
if(tmp > 31){
alert("잘못된 주민등록번호입니다.");
return true;
}
tmp = jstr.charAt(6);
if(tmp > 4){
alert("잘못된 주민등록번호입니다.");
return true;
}
if(jstr.length != 13){
alert("주민등록번호 자릿수가 맞지 않습니다.");
jumin1.focus();
return true;
}
tot = 0;
tmp = 0;
chksum = 0;
for(var i=0; i<12; i++){
tot = tot + (jstr.charAt(i) * dummy[i]);
}
tmp = tot%11;
chksum = 11 - tmp;
tmp = chksum%10;
if( jstr.charAt(12) != tmp ){
alert("잘못된 주민등록번호입니다.");
return true;
}
return false;
}
function CheckEqual( str1, str2, m ) {
var flag = false;
if ( str1.value != str2.value ) {
alert(m + "가 같지 않습니다");
str2.value="";
str2.focus();
flag = true;
}
return flag;
}
//----------------------------------------------------------------------------------
function number_chk1(){
var sMoney = event.srcElement.value.replace(/,/g,"");
if(isNaN(sMoney)){
alert("숫자로 입력하세요");
event.srcElement.value = "";
event.srcElement.focus();
return;
}
}
function imgResize(img, width, height){//이미지객체, 가로, 세로
var obj = new Image();
obj.src = img.src;
//인자로 받는 이미지객체의 가로세로값을 구하면 가끔씩 0을 반환하는 버그가 난다.
//그래서 경로를 받아서 함수내에서 별개의 이미지 객체를 생성해서 가로세로값을 구한다.
var w = obj.width;
var h = obj.height;
if(width == ''){width = w;}
if(height == ''){height = h;}
var maxWidth = width;
var maxHeight = height;
if(w > maxWidth || h > maxHeight){
if(w > maxWidth){
nw = maxWidth;
if(Math.round((h*nw)/w) > maxHeight){
nh = maxHeight;
nw = Math.round((w*nh)/h);
}else{
nh = Math.round((h*nw)/w);
}
}else if(h > maxHeight){
nh = maxHeight;
if(Math.round((w*nh)/h) > maxWidth){
nw = maxWidth;
nh = Math.round((h*nw)/w);
}else{
nw = Math.round((w*nh)/h);
}
}
}else{
nw = w;
nh = h;
}
img.width = nw;
img.height = nh;
}
function zipcode(){
window.open("/nninc/content/01info/zipcode_search.php?","zipcode","scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=468,height=300'");
}
function page_go1(url){
location.href = url;
}
function page_go2(url){
window.open(url);
}
//자주쓰는 메뉴에 추가
function mf_chk(mf_ct_idx){
var url = "/nninc/content/01favorites/write_ok2.php?mm_ct_idx=";
if (confirm('현재 메뉴를 자주쓰는 메뉴에 추가 하시겠습니까?')) {
page_go1(url+mf_ct_idx);
}else{
return ;
}
}
function loading_st(val){
if(val==1){
//document.getElementById('loading_layer').style.display='block';
}else{
//document.getElementById('loading_layer').style.display='none';
}
}
//E-mail 체크
function isCorrectEmail(obj) {
var i;
var check=0;
var dot=0;
var before = "";
var after = "";
if(obj.value.length == 0){
alert("이메일을 입력하세요");
obj.focus();
return(false);
}
for(i=0; i= 2 || check == 0 ) {
alert("잘못된 전자우편 주소입니다.");
obj.focus();
obj.select()
return(false);
}
for(i=0; i= 'A' && before.charAt(i) <= 'z') ||
(before.charAt(i) >= '0' && before.charAt(i) <= '9') ||
(before.charAt(i) == '_') || (before.charAt(i) == '-'))) {
alert("잘못된 전자우편 주소입니다.");
obj.focus();
obj.select()
return(false);
}
}
for(i=0; i= 'A' && after.charAt(i) <= 'z') ||
(after.charAt(i) >= '0' && after.charAt(i) <= '9') ||
(after.charAt(i) == '_') || (after.charAt(i) == '.') ||
(after.charAt(i) == '-'))) {
alert("잘못된 전자우편 주소입니다.");
obj.focus();
obj.select()
return(false);
}
}
for(i=0; i");
/*
$.ajax({
url: action,
cashe: false,
type: "POST",
data: formdata,
success:function(html){
setTimeout(function(){ $("#dialogContent").html(html); }, 500);
}
});
$('#dialog').dialog('open');
*/
$.ajax({
type: "POST",
url: action,
//data: ({ b_l_num:num }),
data: formdata,
dataType:"html",
async:false,
beforeSend:function(){//통신시작할때 처리
$('#dialog').dialog('open');
},
complete:function(){//통신완료후 처리
},
error:function(request, status, error){
alert("code:"+status+"\nmessage:"+request.responseText);
},
success: function(html){
setTimeout(function(){ $("#dialogContent").html(html); }, 500);
}
});
}
function dialogFrame_open(subject, action, formdata){
var url = "";
$("#dialog").dialog({
autoOpen: false,
width: 850,
height: 700,
modal: true,
title: subject
});
url = action;
if(formdata != ""){
url = url+"?"+formdata;
}
$("#dialogContent").html("");
$('#dialog').dialog('open');
}
//모달창 닫기
function dialog_close()
{
$("#dialogContent").html("");
$("#dialog").dialog('close');
}
function facebook(msg,url) {
var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(url) + "&t=" + encodeURIComponent(msg);
window.open(href, 'facebook', '');
}
function twitter(msg,url) {
var href = "http://twitter.com/home?status=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
window.open(href, 'twitter', '');
}
function me2day(msg,url,tag) {
var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg) + " " + encodeURIComponent(url) + "&new_post[tags]=" + encodeURIComponent(tag);
window.open(href, 'me2day', '');
}
function yozm(msg,url) {
var href = "http://yozm.daum.net/api/popup/prePost?prefix=" + encodeURIComponent(msg) + "&link=" + encodeURIComponent(url);
window.open(href, 'yozm', '');
}