-=[ Mr. Bumblebee ]=-
_Indonesia_
| Path : /var/www/html/inc/js/ |
|
|
| Current File : /var/www/html/inc/js/common.function.js |
// WARNING
if (errormessage != null) window.onerror = jsError;
function jsError (msg, filenm, lineno) {
src = ' ' + msg + '\n file : ' + filenm + '\n line : ' + lineno;
alert(src);
return true;
}
function errormsg (target, message, value) {
if (message != null) alert(message);
if (target != null) target.focus();
return value;
}
function errorcolor (target, color, value) {
if (target == null || target == undefined) return;
if (color == null || color == '') color = '#eeeeee';
tmpColor = target.style.backgroundColor;
target.style.backgroundColor = color;
target.onkeydown = function(e) { this.style.backgroundColor = tmpColor; }
target.focus();
return value;
}
function confirmmsg (message, url) {
if (confirm(message)) location.href = url;
return;
}
// REGULER EXPRESSION
function _replace (niddle, search, string) {
var i = string.indexOf(niddle);
if (i != -1) {
var tmp = string.substring(0,i);
var tmp2 = string.substring(i, niddle.length);
var tmp3 = string.substring(i+ niddle.length);
result = tmp + search + tmp3;
} else {
result = string;
}
return result;
}
function _match (value, ptn) {
return (value.match(ptn)==null)?false:true;
}
// CHECK
function chknull (value, minl, maxl) {
value = value.replace(/ /g,"");
return (value.length < minl || value == '')?false:(value.length >maxl && maxl != undefined)?false:true;
}
function chknum (value) {
ptn = /^[0-9]([0-9])*$/;
return _match(value, ptn);
}
function chkkr (value) {
ptn = /^[0-9a-zA-Z]([0-9a-zA-Z])*$/;
return _match(value, ptn);
}
function chkeq(target) {
return (target.value == target.defaultValue)?true:false;
}
// SPECIAL VALUE TYPE
function chkID (value) {
ptn = /^[a-zA-Z][0-9a-zA-Z\-_]*$/
return _match(value, ptn);
}
function chkRRN (v1, v2) {
var s1, s2, i3=0; i4=0;
if (v2 == undefined || v2 == null) { if ( v1.indexOf('-') != -1) { v1.split('-'); s1 = v1[0]; s2 = v1[1]; } else {s1 = v1.substring(0, 6); s2 = v1.substring(6); } } else { s1 = v1; s2 = v2; }
for (var i=0;i<s1.length;i++) { var ch1 = s1.substring(i,i+1); if (ch1 < '0' || ch1 > '9') i3 = i3+1; } if ((s1 == '') || (i3 != 0)) return false;
for (var i=0;i<s2.length;i++) { var ch1 = s2.substring(i,i+1); if (ch1 < '0' || ch1 > '9') i4 = i4+1; } if ((s2 == '') || (i4 != 0)) return false;
//if (s1.substring(0,1) < 3) return false;
if (s2.substring(0,1) > 6) return false;
if ((s1.length > 7) || (s2.length > 8)) return false;
if ((s1 == '72') || (s2 == '18')) return false;
var f1=s1.substring(0,1); var f2=s1.substring(1,2); var f3=s1.substring(2,3); var f4=s1.substring(3,4); var f5=s1.substring(4,5); var f6=s1.substring(5,6);
var hap=f1*2+f2*3+f3*4+f4*5+f5*6+f6*7;
var l1=s2.substring(0,1); var l2=s2.substring(1,2); var l3=s2.substring(2,3); var l4=s2.substring(3,4); var l5=s2.substring(4,5); var l6=s2.substring(5,6); var l7=s2.substring(6,7);
hap=hap+l1*8+l2*9+l3*2+l4*3+l5*4+l6*5;
hap=hap%11; hap=11-hap; hap=hap%10;
return (hap != l7)?false:true;
}
function chkCMP(value) {
var sum = 0;
var getlist =new Array(10);
var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
for(var i=0; i<10; i++) { getlist[i] = value.substring(i, i+1); }
for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
sum = sum + parseInt((getlist[8]*5)/10);
sidliy = sum % 10;
sidchk = 0;
if(sidliy != 0) { sidchk = 10 - sidliy; }
else { sidchk = 0; }
if(sidchk != getlist[9]) { return false; }
return true;
}
function chkMAIL(value) {
ptn = /^[0-9a-zA-Z]([\-_]?[0-9a-zA-Z])*@[0-9a-zA-Z]([\-_]?[0-9a-zA-Z])*\.[a-zA-Z\.]{1,}$/;
return _match(value, ptn);
}
function chkPHONE(value) {
ptn = /^[0-9]{2,3}\-[0-9]{3,4}\-[0-9]{4}$/;
return _match(value, ptn);
}
function chkEXT(str, ext) {
tmpExt = str.substring(str.lastIndexOf('.')+1);
chk = 0;
for (var i=0; i < ext.length; i++) { if (ext[i].toUpperCase() == tmpExt.toUpperCase()) { chk++; break; } }
return (chk < 1)?false:true;
}
function chkGRP (target) {
chk = 0;
if (target.form.elements[target.name].length == null || target.form.elements[target.name].length == undefined) {
if (target.form.elements[target.name].checked) chk = 1;
else chk = 0;
} else {
for (var i=0; i < target.form.elements[target.name].length; i++) {
if (target.form.elements[target.name][i].checked) {
chk = 1;
break;
}
}
};
return (chk < 1)?false:true;
}
// SPECIAL INPUT TYPE
function _selectbox (targetname, targetarray, selectvalue, minnum, maxnum , selectstyle , setoption ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = ' <select name="' + targetname + '" class="form" ' + setoption + '>';
for (var i=minnum; i < maxnum; i++) {
str+= ' <option value="' + targetarray[i].value + '" ';
if (targetarray[i].value == selectvalue) str+= ' selected ';
if (selectstyle != null ) str+= ' style="' + selectstyle + '" ' ;
str+= ' >' + targetarray[i].text + '</option>';
}
str+= '</select>';
document.write(str);
}
function _selectbox_text( targetname, targetarray, selectvalue, minnum, maxnum , selectstyle ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = ' <input type="text" name="' + targetname + '" value="' + selectvalue + '" class="form" style="background-color:#efefef;" readOnly > ' ;
document.write(str);
if ( targetarray.length > 0 )
{
didx = targetarray.length ;
targetarray[didx] = new Option('Á÷Á¢ÀÔ·Â','direct_input');
maxnum++ ;
str = ' <select name="' + targetname + '_tmp_slt" class="form">';
for (var i=minnum; i < maxnum; i++) {
str+= ' <option value="' + targetarray[i].value + '" ';
if (targetarray[i].value == selectvalue) str+= ' selected ';
if (selectstyle != null ) str+= ' style="' + selectstyle + '" ' ;
str+= ' >' + targetarray[i].text + '</option>';
}
str+= '</select>';
document.write(str);
document.getElementsByName( targetname + '_tmp_slt' )[0].onchange = function() {
if ( this.value == 'direct_input' ) {
document.getElementsByName( targetname )[0].value = '' ;
document.getElementsByName( targetname )[0].style.backgroundColor = '' ;
document.getElementsByName( targetname )[0].readOnly = false ;
} else {
document.getElementsByName( targetname )[0].value = this.value ;
document.getElementsByName( targetname )[0].style.backgroundColor = '#efefef' ;
document.getElementsByName( targetname )[0].readOnly = true ;
}
}
}
if ( document.getElementsByName( targetname + '_tmp_slt' )[0].selectedIndex == 0 ) {
document.getElementsByName( targetname + '_tmp_slt' )[0].options[didx].selected = true ;
//document.getElementsByName( targetname )[0].value = '' ;
document.getElementsByName( targetname )[0].style.backgroundColor = '' ;
document.getElementsByName( targetname )[0].readOnly = false ;
}
}
function _multi_selectbox ( key , depth , selectes )
{
for ( i = 0 ; i < depth ; i++ )
{
// create object
_selectbox( key + '[]' , new Array , '' ) ;
target = document.getElementsByName( key + '[]' ) ;
// event
target[i].onchange = function ()
{
key = this.name.substring( 0 , this.name.indexOf('[]') ) ;
target_group = document.getElementsByName( this.name ) ;
if ( target_group.length == null ) return ;
search = false ;
for ( i = 0 ; i < target_group.length ; i++)
{
if ( target_group[i] == this ) { search = true ; continue ; }
if ( search )
{
for ( j = ( target_group[i].length - 1) ; j >= 0 ; j-- )
target_group[i].options[j] = null ;
next_target = eval ( key + (i+1)) ;
tmp_j = 0 ;
target_group[i].options[tmp_j] = new Option( next_target[tmp_j].text , next_target[tmp_j].value ) ;
tmp_num = target_group[(i-1)].value.substring( target_group[(i-1)].value.indexOf('numid=')+6 , target_group[(i-1)].value.indexOf(',pnumid=') ) ;
for ( j = 1 ; j < next_target.length ; j++) {
p_numid = next_target[j].value.substring( next_target[j].value.indexOf(',pnumid=')+8 ) ;
if ( p_numid == tmp_num )
target_group[i].options[target_group[i].length] = new Option( next_target[j].text , next_target[j].value ) ;
}
}
}
}
// put data
key_array = eval( key + (i+1) ) ;
for ( j = ( target[i].length - 1) ; j >= 0 ; j-- ) target[i].options[j] = null ;
target[i].options[0] = new Option( key_array[0].text , key_array[0].value ) ;
if ( i < 1 ) tmp_num = '0' ;
else tmp_num = target[(i-1)].value.substring( target[(i-1)].value.indexOf('numid=')+6 , target[(i-1)].value.indexOf(',pnumid=') ) ;
for ( j = 1 ; j < key_array.length ; j++) {
numid = key_array[j].value.substring( key_array[j].value.indexOf('numid=')+6 , key_array[j].value.indexOf(',pnumid=') ) ;
p_numid = key_array[j].value.substring( key_array[j].value.indexOf(',pnumid=')+8 ) ;
if ( p_numid == tmp_num ) {
tmp_i = target[i].length ;
target[i].options[tmp_i] = new Option( key_array[j].text , key_array[j].value ) ;
if ( numid == selectes[i] ) target[i].options[tmp_i].selected = true ;
}
}
}
}
function _selectnum (targetname, beginnum, endnum, maxnum, selectvalue , selectoption ) {
str = '<select name="' + targetname + '" class="form" ' + selectoption + '>';
str+= '<option value="">¼±ÅÃ</option>' ;
if (endnum == '' || endnum == null) endnum = parseInt(beginnum,10) + parseInt(maxnum,10);
for (var i=beginnum; i <= endnum; i++) {
str+= '<option value="' + i + '" ';
if (parseInt(selectvalue,10) == parseInt(i,10)) str+= ' selected ';
str+= '>' + i + '</option>';
}
str+= '</select>';
document.write(str);
}
function _nformbutton (targettype , targetarray, selectvalue, minnum, maxnum , line_limit ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = '';
d_i = 1 ;
for (var i=minnum; i < maxnum; i++) {
str+= '<nobr><input type="' + targettype + '" ';
str+= ' value="' + targetarray[i].value + '" ';
if (targetarray[i].value == selectvalue) str+= ' checked ';
else if ( selectvalue == null ) str+= ' checked ' ;
str+= ' > ' + targetarray[i].text + '</nobr>';
if ( line_limit != null && d_i%line_limit == 0 ) str+= '<br>' ;
d_i++ ;
}
document.write(str);
}
function _radiobutton (targetname, targetarray, selectvalue, minnum, maxnum , line_limit , input_option ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = '';
d_i = 1 ;
for (var i=minnum; i < maxnum; i++) {
str+= '<nobr><input type="radio" ';
str+= ' name="' + targetname + '" ';
str+= ' value="' + targetarray[i].value + '" ';
if (targetarray[i].value == selectvalue) str+= ' checked ';
else if ( selectvalue == null ) str+= ' checked ' ;
str+= ' ' + input_option + ' ' ;
str+= ' id="' + targetname + '______' + i + '" ><label for="' + targetname + '______' + i + '" >' + targetarray[i].text + '</label></nobr>';
if ( line_limit != null && d_i%line_limit == 0 ) str+= '<br>' ;
d_i++ ;
}
document.write(str);
}
function _no_checkbox ( targetarray, selectvalue, minnum, maxnum , line , input_option ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = '';
thevalue = selectvalue.split(',');
thevalue_len = thevalue.length ;
line_i = 1 ;
for (var i=minnum; i < maxnum; i++) {
str+= ' <nobr><input type="checkbox" ';
str+= ' value="' + targetarray[i].value + '" ';
chk = false ;
for (var j=0; j < thevalue_len; j++) {
if (String(targetarray[i].value) == String(thevalue[j])) { chk = true ; break ;}
}
if ( chk ) str+= ' checked onclick=" this.checked = true ; " ' ;
else str+= ' onclick=" this.checked = false ; " ' ;
str+= ' ' + input_option + '><label >' + targetarray[i].text + '</label> </nobr>';
if ( line != null && line_i%line === 0) str+= ' <br> ' ;
line_i++;
}
document.write(str);
}
function _checkbox (targetname, targetarray, selectvalue, minnum, maxnum , line , input_option , space_style ) {
if (minnum == null || minnum == undefined) minnum = 0;
if (maxnum == null || maxnum == undefined) maxnum = targetarray.length;
str = '';
thevalue = selectvalue.split(',');
line_i = 1 ;
for (var i=minnum; i < maxnum; i++) {
str+= ' <nobr><span ' + space_style + '><input type="checkbox" ';
str+= ' name="' + targetname + '" ';
str+= ' value="' + targetarray[i].value + '" ';
for (var j=0; j < thevalue.length; j++) {
if (targetarray[i].value == thevalue[j]) {
str+= ' checked ';
break;
}
}
str+= ' id="' + targetname + '______' + i + '" ' + input_option + '><label for="' + targetname + '______' + i + '" >' + targetarray[i].text + '</label></span></nobr>';
if ( line != null && line_i%line === 0) str+= ' <br> ' ;
line_i++;
}
document.write(str);
}
// WINDOW OPEN
function openPrintPage(objId , autoPrint , autoClose) {
var obj = document.getElementById(objId);
if ( obj == null ) return ;
if ( autoPrint == null ) autoPrint = 'Y' ;
if ( autoClose == null ) autoClose = 'Y' ;
objHtml = obj.innerHTML ;
var pop = window.open( '' , 'PRINTPAGE' , 'width=651,height=600,scrollbars=yes');
if ( pop == null ) {
alert('ÆË¾÷ÀÌ Â÷´ÜµÇ¾îÀÖ½À´Ï´Ù.');
return ;
}
tobjHtml =
'<html>' +
'<head>' +
'<style>' +
'body, td, th, input, form, textarea, pre, select , p{' +
' font-size : 11px;' +
' color: #000000;' +
' font-family : ±¼¸²;' +
' padding:0px;' +
' scrollbar-face-color: #FFFFFF; ' +
' scrollbar-shadow-color: #ADBCC5; ' +
' scrollbar-highlight-color: #ADBCC5; ' +
' scrollbar-3dlight-color: #FFFFFF; ' +
' scrollbar-darkshadow-color: #FFFFFF; ' +
' scrollbar-track-color: #FFFFFF;' +
' scrollbar-arrow-color: #ADBCC5;' +
'}' +
'' +
'p { margin:0px; }' +
'' +
'.png24 { ' +
' tmp:expression(setPng24(this)); ' +
'} ' +
' ' +
'img,table {' +
' border:0px;' +
' padding:0; ' +
' border-spacing:0px; ' +
' border-collapse:collapse;' +
' }' +
'.result_r_tit{' +
' font-size : 14px; COLOR: #000000; LINE-HEIGHT: 12pt; FONT-FAMILY: ±¼¸²; LETTER-SPACING: 0px; font-weight: bold;' +
'}' +
'.pd8 { padding:8px; } ' +
'.pd_l8 { padding-left:8px; } ' +
'</style>' +
'</head>' +
'<body>' + objHtml + '</body>' +
'</html>' ;
pop.focus();
pop.document.open();
pop.document.write(tobjHtml) ;
//pop.document.createStyleSheet('/css/css.css') ;
pop.document.close();
if ( autoPrint == 'Y' ) {
pop.print();
if ( autoClose == 'Y' ) pop.close();
}
}
function popimg(url, width, height, opt) {
if (opt != null && opt != '') opt = ',' + opt;
str = '<link href="/css/css.css" rel="stylesheet" type="text/css"><body topmargin=0 leftmargin=0 onmousedown="self.close();"><img src="' + url + '" border=0></body>';
pop = window.open('','zome','width=' + width + ',height=' + height + opt);
if ( pop == null ) {
alert(' ÆË¾÷ÀÌ Â÷´ÜµÇ¾îÀÖ½À´Ï´Ù. ' ) ;
} else {
pop.focus();
pop.document.write(str);
}
}
function nopenImage(url) {
}
function openImage(url) {
if (typeof url == 'undefined') return;
if ( navigator.userAgent.indexOf('MSIE') > 0 && navigator.appVersion.indexOf('MSIE 7.') > 0 ) {
timg = new Image;
timg.src = url;
// MSIE 7.0 Àΰæ¿ì
str = '<body topmargin=0 leftmargin=0>\n';
str+= '<div id="image_zone" onmousedown="self.close();"><img src="' + url + '" border=0 onmousedown="self.close();" id="view_image"></div>\n';
str+= '</body>';
w = timg.width ;
h = timg.height ;
opt_scroll = 'no' ;
if ( w > 800 ) { w = 820 ; opt_scroll = 'yes' ; }
if ( h > 800 ) { h = 820 ; opt_scroll = 'yes' ; }
pop = window.open('','image','width=' + w + ',height=' + h + ',scrollbars=' + opt_scroll );
if ( pop == null ) {
alert(' ÆË¾÷ÀÌ Â÷´ÜµÇ¾îÀÖ½À´Ï´Ù. ' ) ;
} else {
pop.focus();
pop.document.write(str);
}
} else {
timg = new Image;
timg.src = url;
timg.onload = function(e) {
w = this.width ;
h = this.height ;
opt_scroll = 'no' ;
if ( w > 800 ) { w = 820 ; opt_scroll = 'yes' ; }
if ( h > 800 ) { h = 820 ; opt_scroll = 'yes' ; }
pop = window.open('','image','width=' + w + ',height=' + h + ',scrollbars=' + opt_scroll );
str = '<body topmargin=0 leftmargin=0 onmousedown="self.close();"> \n';
//str+= '<img src="' + url + '" width="' + w + '" height="' + h + '" border=0 onmousedown="self.close();"> \n';
str+= '<img src="' + url + '" border=0 onmousedown="self.close();"> \n';
str+= '</body>';
pop = window.open('','image','width=' + w + ',height=' + h );
if ( pop == null ) {
alert(' ÆË¾÷ÀÌ Â÷´ÜµÇ¾îÀÖ½À´Ï´Ù. ' ) ;
} else {
pop.focus();
pop.document.write(str);
}
}
}
}
function poppage(url, nme, opt) {
if (opt == null || opt == undefined) opt = 'width=300, height=200';
if (nme == null || nme == undefined) nme = 'popup';
pop = window.open(url,nme,opt);
pop.focus();
}
// SPECIAL WINDOW OPEN
function popbrand (t1,t2) {
url = '/inc/pop/search_brand.html';
if (typeof opt == 'undefined') opt = 'width=480, height=500, resizable=no,scrollbars=yes';
pop = window.open(url + '?target1=' + t1 + '&target2=' + t2 , 'SearchBrand',opt);
pop.focus();
}
function popzip (t1,t2,t3,url,opt) {
/*
if (typeof url == 'undefined') url = '/inc/pop/search_zip.html';
if (typeof opt == 'undefined') opt = 'width=472, height=200, resizable=no,scrollbars=yes';
pop = window.open(url + '?target1=' + t1 + '&target2=' + t2 + '&target3=' + t3, 'ZIPCODE',opt);
pop.focus();
*/
new daum.Postcode({
oncomplete: function(data) {
// ÆË¾÷¿¡¼ °Ë»ö°á°ú Ç׸ñÀ» Ŭ¸¯ÇßÀ»¶§ ½ÇÇàÇÒ Äڵ带 ÀÛ¼ºÇÏ´Â ºÎºÐ.
// °¢ ÁÖ¼ÒÀÇ ³ëÃâ ±ÔÄ¢¿¡ µû¶ó ÁÖ¼Ò¸¦ Á¶ÇÕÇÑ´Ù.
// ³»·Á¿À´Â º¯¼ö°¡ °ªÀÌ ¾ø´Â °æ¿ì¿£ °ø¹é('')°ªÀ» °¡Áö¹Ç·Î, À̸¦ Âü°íÇÏ¿© ºÐ±â ÇÑ´Ù.
var fullAddr = ''; // ÃÖÁ¾ ÁÖ¼Ò º¯¼ö
var extraAddr = ''; // Á¶ÇÕÇü ÁÖ¼Ò º¯¼ö
// »ç¿ëÀÚ°¡ ¼±ÅÃÇÑ ÁÖ¼Ò Å¸ÀÔ¿¡ µû¶ó ÇØ´ç ÁÖ¼Ò °ªÀ» °¡Á®¿Â´Ù.
if (data.userSelectedType === 'R') { // »ç¿ëÀÚ°¡ µµ·Î¸í ÁÖ¼Ò¸¦ ¼±ÅÃÇßÀ» °æ¿ì
fullAddr = data.roadAddress;
} else { // »ç¿ëÀÚ°¡ Áö¹ø ÁÖ¼Ò¸¦ ¼±ÅÃÇßÀ» °æ¿ì(J)
fullAddr = data.jibunAddress;
}
// »ç¿ëÀÚ°¡ ¼±ÅÃÇÑ ÁÖ¼Ò°¡ µµ·Î¸í ŸÀÔÀ϶§ Á¶ÇÕÇÑ´Ù.
if(data.userSelectedType === 'R'){
//¹ýÁ¤µ¿¸íÀÌ ÀÖÀ» °æ¿ì Ãß°¡ÇÑ´Ù.
if(data.bname !== ''){
extraAddr += data.bname;
}
// °Ç¹°¸íÀÌ ÀÖÀ» °æ¿ì Ãß°¡ÇÑ´Ù.
if(data.buildingName !== ''){
extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
}
// Á¶ÇÕÇüÁÖ¼ÒÀÇ À¯¹«¿¡ µû¶ó ¾çÂÊ¿¡ °ýÈ£¸¦ Ãß°¡ÇÏ¿© ÃÖÁ¾ ÁÖ¼Ò¸¦ ¸¸µç´Ù.
fullAddr += (extraAddr !== '' ? ' ('+ extraAddr +')' : '');
}
// ¿ìÆí¹øÈ£¿Í ÁÖ¼Ò Á¤º¸¸¦ ÇØ´ç Çʵ忡 ³Ö´Â´Ù.
//document.getElementById('sample6_postcode').value = data.zonecode; //5ÀÚ¸® »õ¿ìÆí¹øÈ£ »ç¿ë
//document.getElementById('sample6_address').value = fullAddr;
// Ä¿¼¸¦ »ó¼¼ÁÖ¼Ò Çʵå·Î À̵¿ÇÑ´Ù.
//document.getElementById('sample6_address2').focus();
document.getElementsByName(t1)[0].value = String(data.zonecode).substring(0,3) ; //5ÀÚ¸® »õ¿ìÆí¹øÈ£ »ç¿ë
document.getElementsByName(t2)[0].value = String(data.zonecode).substring(3,5) ;
document.getElementsByName(t3)[0].value = fullAddr;
}
}).open();
}
function popid ( trgt ) {
pre_inputvalue = '' ;
if ( document.getElementById(trgt) != null ) {
if ( document.getElementById(trgt).tagName == 'INPUT' ) {
pre_inputvalue = document.getElementById(trgt).value ;
} else if ( document.getElementById(trgt).tagName == 'DIV' || document.getElementById(trgt).tagName == 'SPAN' ) {
pre_inputvalue = document.getElementById(trgt).innerHTML ;
}
}
if ( pre_inputvalue != '' ) {
url = '/inc/pop/search_id.html?search_id=' + pre_inputvalue ;
} else {
url = '/inc/pop/search_id.html' ;
}
opt = 'width=272,height=200,scrollbars=no,resizable=no';
pop = window.open(url,'SearchID',opt);
pop.focus();
}
function popnick (url,opt) {
if (typeof url == 'undefined') url = '/inc/pop/search_nick.html';
if (typeof opt == 'undefined') opt = 'width=272,height=200,scrollbars=no,resizable=no';
pop = window.open(url,'SearchNickName',opt);
pop.focus();
}
// DOCUMENT WRITE
function _write (targetarray, selectvalue) {
str = selectvalue;
if (str == null || str == undefined || str == '') return;
for (var i=0; i < targetarray.length; i++) if (targetarray[i].value == selectvalue) str = targetarray[i].text;
document.write(str);
}
function _choice (target,selectvalue,types) {
if (target == null) return;
if (target.type == null) { // array object (ex: radiobutton)
for (var i=0; i < target.length; i++)
if (target[i].value == selectvalue)
target[i].checked = true;
} else {
for (var i=0; i < target.options.length; i++)
if (target.options[i].value == selectvalue)
target.options[i].selected = true;
}
}
function _previmage(filetarget, imgtarget, width, height, failvalue) {
if (imgtarget == null || filetarget == null) return;
tmp = filetarget.value;
ext = tmp.substring(tmp.lastIndexOf('.')+1);
ext = ext.toLowerCase();
if (ext != "") {
// È®ÀåÀÚ Ã¼Å©
if (ext != "gif" && ext != "jpg" && ext != "jpeg" && ext != "png") {
filetarget.select();
document.execCommand('Delete');
alert(" gif, jpg, png ÀÌ¿ÜÀÇ À̹ÌÁö´Â ¾÷·Îµå ÇÒ ¼ö ¾ø½À´Ï´Ù. ");
imgtarget.innerHTML = failvalue;
return;
}
imgtarget.innerHTML = '<img src="' + tmp + '" width="' + width + '" height="' + height + '">';
} else {
imgtarget.innerHTML = failvalue;
}
return;
}
function _resetbutton ( imgurl, wid, hei ) {
var r = '<span style="overflow:hidden; width:' + wid + 'px; height:' + hei + 'px; background-image:url(' + imgurl + '); background-repeat:no-repeat; cursor:hand;"><input type="reset" value="Ãë¼Ò" style="width:' + wid + 'px;height:' + hei + 'px;filter:alpha(opacity=0);cursor:hand;" class="form"></span>';
document.write (r);
}
// CHANGE VALUES
function str_number(num) {
xs = num.split(',') ;
xs = xs.join('') ;
return xs;
}
function str_money(num) {
num = num + '';
xs = '';
for (var i = 0; i < num.length; i++) {
if (i%3 == 0 && i != 0)xs = ',' + xs;
xs = num.charAt(num.length - i - 1) + xs;
}
return xs;
}
// DESIGN
function drawline( i, r, c, a ) {
var j = Math.sqrt( (r * r) - (i*i) );
j = Math.floor( j );
return ( "<div align=\"" + a + "\">" + "<div style=\"height: 1px; width: " + j + "px; background: " + c + ";font-size: 1px;line-height: 1px;font-size: 1px;\"> <\/div>" );
}
function corner( h, r, c ) {
var t="";
if (h == 'ul') {
for (var i = r; i >= 1; i--) {
t+=drawline( i, r, c, 'right' );
}
} else if (h == 'ur') {
for (var i = r; i >= 1; i--) {
t+=drawline( i, r, c, 'left' );
}
} else if ( h == 'll') {
for (i = 1; i <= r; i++) {
t+=drawline( i, r, c, 'right' );
}
} else if ( h == 'lr') {
for (i = 1; i <= r; i++) {
t+=drawline( i, r, c, 'left' );
}
}
return t;
}
// COOKIE
function _getCookie(name)
{
var nameOfCookie = name + '=';
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+nameOfCookie.length);
if ( document.cookie.substring( x, y ) == nameOfCookie )
{
if ( (endOfCookie=document.cookie.indexOf( ';', y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( ' ', x ) + 1;
if ( x == 0 )
break;
}
return '';
}
function _setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
// TABLE
function _addTable(table , copyidx ) {
if ( copyidx == null ) copyidx = 0 ;
otbl = document.all[table];
orow = otbl.insertRow();
obase = otbl.rows[copyidx];
for (var i=0; i < obase.cells.length; i++) {
ocell = orow.insertCell();
ocell.innerHTML = obase.cells[i].innerHTML;
ocell.height = obase.cells[i].height ;
ocell.className = obase.cells[i].className ;
for (var j=0; j < ocell.children.length; j++) {
ocld = ocell.children[j];
if ( ocld.tagName.toUpperCase() == 'INPUT' ) {
switch ( ocld.type.toUpperCase() ) {
case 'TEXT' : ocld.value = ''; break;
case 'HIDDEN' : ocld.value = ''; break;
case 'CHECKBOX' : ocld.checked = false; break;
}
} else if ( ocld.tagName.toUpperCase() == 'SELECT' ) {
ocld.selectedIndex = 0 ;
}
}
}
}
function _deleteTable(table, row , maxrow) {
otbl = document.all[table];
if (row == null || typeof row == 'undefined' ) row = parseInt(otbl.rows.length,10) - 1;
if (maxrow == null || typeof maxrow == 'undefined') maxrow = 1;
if (otbl.rows.length == maxrow) return;
if ( typeof row == 'object' ) {
for (var i=0; i < otbl.rows.length; i++) {
if (otbl.rows[i] == row) {
otbl.deleteRow(i);
break;
}
}
} else {
otbl.deleteRow(row);
}
}
function copy_table_default_value_blank(tbl_name) {
x = document.getElementById(tbl_name) ;
row_len = x.rows.length ;
otbl = document.createElement('TABLE') ; x.parentElement.appendChild(otbl);
//cnt = preg_match_all('@([^\s<]+)\s*=\s*([\'"])(.*?)(?<!\x5c)\2@', x , $matches);
otbl.borderColor = x.borderColor ;
otbl.cellSpacing = x.cellSpacing ;
otbl.cellPadding = x.cellPadding ;
otbl.rules = x.rules ;
otbl.width = x.width ;
otbl.border = x.border ;
otbl.frame = x.frame ;
obody = document.createElement("TBODY") ; otbl.appendChild(obody);
for ( var i = 0 ; i < row_len ; i++ ) {
orow = document.createElement("TR") ; obody.appendChild(orow);
cell_len = x.rows[i].cells.length ;
for ( var j = 0 ; j < cell_len ; j++ ) {
ocell = document.createElement("TD") ; orow.appendChild(ocell);
ocell.align = x.rows[i].cells[j].align ;
ocell.width = x.rows[i].cells[j].width ;
ocell.height = x.rows[i].cells[j].height ;
ocell.bgColor = x.rows[i].cells[j].bgColor ;
ocell.rowSpan = x.rows[i].cells[j].rowSpan ;
ocell.colSpan = x.rows[i].cells[j].colSpan ;
ocell.className = x.rows[i].cells[j].className ;
ocell.innerHTML = x.rows[i].cells[j].innerHTML ;
children_len = ocell.children.length ;
for ( var k = 0 ; k < children_len ; k++ ) {
ocld = ocell.children[k];
if ( ocld.tagName.toUpperCase() == 'INPUT' ) {
switch ( ocld.type.toUpperCase() ) {
case 'TEXT' : ocld.value = ''; break;
case 'SELECT-ON' : ocld.selectedIndex = 0 ; break ;
case 'HIDDEN' : ocld.value = ''; break;
case 'CHECKBOX' : ocld.checked = false; break;
}
}
}
}
}
}
// FILE UPLOAD
function adduploadfile(cidx , target_name) {
theCode = document.getElementsByName("temp_code")[0];
if (theCode == null || theCode == undefined || theCode == '') return;
poppage('/inc/file/upload.php?code=' + cidx + '&tn=' + target_name + '&temp_code=' + theCode.value,'ÆÄÀϾ÷·Îµå','width=300, height=200');
}
function adduploadimage(cidx , target_name) {
theCode = document.getElementsByName("temp_code")[0];
if (theCode == null || theCode == undefined || theCode == '') return;
poppage('/inc/file/upload_image.php?code=' + cidx + '&tn=' + target_name + '&temp_code=' + theCode.value,'À̹ÌÁö¾÷·Îµå','width=300, height=200');
}
function addselectoption( opttext, optvalue ) {
var theslt = document.getElementById("temp_upload_list");
theslt.options[theslt.length] = new Option(opttext, optvalue );
}
function deluploadfile(cidx , target_name) {
theslt = document.getElementById("temp_upload_list");
if (theslt == null || theslt == undefined) return;
if (theslt.selectedIndex == -1 || theslt.selectedIndex == 0) return;
idx = theslt.options[theslt.selectedIndex].value;
if (idx == null || idx == undefined || idx < 1) return;
poppage('/inc/file/remove.php?code=' + cidx + '&num=' + idx + '&tn=' + target_name ,'ÆÄÀÏ»èÁ¦');
}
function delselectoption( opttext, optvalue ) {
theslt = document.getElementById("temp_upload_list");
if (theslt == null || theslt == undefined) return;
for (var i=0; i < theslt.length; i++)
if (theslt.options[i].value == optvalue && theslt.options[i].text == opttext) theslt.options[i] = null;
}
function limitselectcount( idx, tgt ) {
theslt = document.getElementById("temp_upload_list");
if (theslt == null || theslt == undefined) return;
for (var i=0; i < theslt.length; i++)
theslt.options[i].selected = false;
theslt.options[idx].selected = true;
}
// TIME
function _timepiece(ospan, dtype) {
if (dtype == null) dtype = " %Y-%m-%d %H:%i:%s ";
ndate = new Date;
tmp = '';
tmp = _replace('%Y', ndate.getYear(), dtype);
tmp = _replace('%m', (parseInt(ndate.getMonth(),10)+1), tmp);
tmp = _replace('%d', ndate.getDate(), tmp);
tmp = _replace('%H', ndate.getHours(), tmp);
tmp = _replace('%i', ndate.getMinutes(), tmp);
tmp = _replace('%s', ndate.getSeconds(), tmp);
document.all[ospan].innerHTML = tmp;
setTimeout ("_timepiece('" + ospan +"','" + dtype + "')",1000);
}
function _countdown() {
tm_f_d = document.getElementsByName('tm_countdown_f_d') ;
tm_f_h = document.getElementsByName('tm_countdown_f_h') ;
tm_f_m = document.getElementsByName('tm_countdown_f_m') ;
tm_f_s = document.getElementsByName('tm_countdown_f_s') ;
tm_l_d = document.getElementsByName('tm_countdown_l_d') ;
tm_l_h = document.getElementsByName('tm_countdown_l_h') ;
tm_l_m = document.getElementsByName('tm_countdown_l_m') ;
tm_l_s = document.getElementsByName('tm_countdown_l_s') ;
if ( tm_l_s == null ) return ;
else if ( tm_l_s.length == null ) return ;
else
{
for ( var i = 0 ; i < tm_l_s.length; i++ )
{
// ±âÁ¸ÀÇ ½Ã°£
total_times = (parseInt(tm_f_d[i].opt_count ,10) * 10 * 86400) + (parseInt(tm_l_d[i].opt_count ,10) * 86400) ;
total_times+= (parseInt(tm_f_h[i].opt_count ,10) * 10 * 3600) + (parseInt(tm_l_h[i].opt_count ,10) * 3600) ;
total_times+= (parseInt(tm_f_m[i].opt_count ,10) * 10 * 60) + (parseInt(tm_l_m[i].opt_count ,10) * 60) ;
total_times+= (parseInt(tm_f_s[i].opt_count ,10) * 10) + (parseInt(tm_l_s[i].opt_count ,10)) ;
// ÇöÀç ½Ã°£.... ¤·¤±¤·.... 1Ãʸ¶´Ù´Ï±î.. -1 À» ÇØÁÖ¸é µÉ µí... =_=;;;
total_times-- ;
// ½Ã°£À» ³ª´¯´Ï´Ù.
tm_d = parseInt(total_times/86400,10) ; total_times = total_times%86400 ;
tm_h = parseInt(total_times/3600,10) ; total_times = total_times%3600 ;
tm_m = parseInt(total_times/60,10) ; total_times = total_times%60 ;
tm_s = total_times ;
if ( tm_d < 0 ) { tm_f_d[i].src = '/img/tn_0.gif' ; tm_f_d[i].opt_count = 0 ; tm_l_d[i].src = '/img/tn_0.gif' ; tm_l_d[i].opt_count = 0 ; }
else if ( tm_d < 10 ) { tm_f_d[i].src = '/img/tn_0.gif' ; tm_f_d[i].opt_count = 0 ; tm_l_d[i].src = '/img/tn_' + tm_d + '.gif' ; tm_l_d[i].opt_count = tm_d ; }
else { tm_f_d[i].src = '/img/tn_' + parseInt(tm_d/10,10) + '.gif' ; tm_f_d[i].opt_count = parseInt(tm_d/10,10) ; tm_l_d[i].src = '/img/tn_' + parseInt(tm_d - (parseInt(tm_d/10,10)*10),10) + '.gif' ; tm_l_d[i].opt_count = parseInt(tm_d - (parseInt(tm_d/10,10)*10),10) ; }
if ( tm_h < 0 ) { tm_f_h[i].src = '/img/tn_0.gif' ; tm_f_h[i].opt_count = 0 ; tm_l_h[i].src = '/img/tn_0.gif' ; tm_l_h[i].opt_count = 0 ; }
else if ( tm_h < 10 ) { tm_f_h[i].src = '/img/tn_0.gif' ; tm_f_h[i].opt_count = 0 ; tm_l_h[i].src = '/img/tn_' + tm_h + '.gif' ; tm_l_h[i].opt_count = tm_h ; }
else { tm_f_h[i].src = '/img/tn_' + parseInt(tm_h/10,10) + '.gif' ; tm_f_h[i].opt_count = parseInt(tm_h/10,10) ; tm_l_h[i].src = '/img/tn_' + parseInt(tm_h - (parseInt(tm_h/10,10)*10),10) + '.gif' ; tm_l_h[i].opt_count = parseInt(tm_h - (parseInt(tm_h/10,10)*10),10) ; }
if ( tm_m < 0 ) { tm_f_m[i].src = '/img/tn_0.gif' ; tm_f_m[i].opt_count = 0 ; tm_l_m[i].src = '/img/tn_0.gif' ; tm_l_m[i].opt_count = 0 ; }
else if ( tm_m < 10 ) { tm_f_m[i].src = '/img/tn_0.gif' ; tm_f_m[i].opt_count = 0 ; tm_l_m[i].src = '/img/tn_' + tm_m + '.gif' ; tm_l_m[i].opt_count = tm_m ; }
else { tm_f_m[i].src = '/img/tn_' + parseInt(tm_m/10,10) + '.gif' ; tm_f_m[i].opt_count = parseInt(tm_m/10,10) ; tm_l_m[i].src = '/img/tn_' + parseInt(tm_m - (parseInt(tm_m/10,10)*10),10) + '.gif' ; tm_l_m[i].opt_count = parseInt(tm_m - (parseInt(tm_m/10,10)*10),10) ; }
if ( tm_s < 0 ) { tm_f_s[i].src = '/img/tn_0.gif' ; tm_f_s[i].opt_count = 0 ; tm_l_s[i].src = '/img/tn_0.gif' ; tm_l_s[i].opt_count = 0 ; }
else if ( tm_s < 10 ) { tm_f_s[i].src = '/img/tn_0.gif' ; tm_f_s[i].opt_count = 0 ; tm_l_s[i].src = '/img/tn_' + tm_s + '.gif' ; tm_l_s[i].opt_count = tm_s ; }
else { tm_f_s[i].src = '/img/tn_' + parseInt(tm_s/10,10) + '.gif' ; tm_f_s[i].opt_count = parseInt(tm_s/10,10) ; tm_l_s[i].src = '/img/tn_' + parseInt(tm_s - (parseInt(tm_s/10,10)*10),10) + '.gif' ; tm_l_s[i].opt_count = parseInt(tm_s - (parseInt(tm_s/10,10)*10),10) ; }
}
}
setTimeout ("_countdown()",1000); // 1ÃÊ¿¡ Çѹø À̹ÌÁö º¯°æÇÕ´Ï´Ù.
}
// ONCLICK EVENT( OR ONCHANGE )
function _change_checked(x , form , targetname) { // x´Â Àüü¼±ÅÃ
k =form.elements[targetname];
if (k == undefined) return;
len = k.length;
if (len == undefined) {
if (x.checked) k.checked = true;
else k.checked = false;
} else {
if (x.checked) for (var i=0; i < len; i++) k[i].checked = true;
else for (var i=0; i < len; i++) k[i].checked = false;
}
}
function _chkCheckbox(form , targetname , move_code , msg1 , msg2 ) {
if ( msg1 == null ) msg1 = ' ¿äûÇϽŠÀÛ¾÷À» ¼öÇàÇÕ´Ï´Ù. ' ;
if ( msg2 == null ) msg2 = ' °Ô½Ã¹°ÀÌ ¼±ÅõÇÁö ¾Ê¾Ò½À´Ï´Ù. ' ;
target = form ;
if ( target == undefined ) return ;
target = target.elements[targetname] ;
if ( target == undefined ) return ;
len = target.length ;
c = 0 ;
if ( len == undefined) { if ( target.checked) c = 1 ; }
else { for(var i=0; i < len; i++) { if (target[i].checked) c++; } }
if ( c > 0) { if ( confirm(msg1)) { form.mode.value = move_code ; form.submit() ; } }
else { alert(msg2); }
}
function changeParentsColors(target, original, changed) {
pprt = target.parentElement; // td
ptop = pprt.parentElement; // tr
cellLen = ptop.cells.length;
for (var i=0; i < cellLen; i++) {
if (ptop.cells[i].className == original) ptop.cells[i].className = changed;
else ptop.cells[i].className = original;
}
}
function searchTodayInfo(url) {
var tDate = new Date;
ty = tDate.getYear();
tm = tDate.getMonth();
tm = parseInt(tm,10) + 1;
if (tm < 10) tm = '0' + tm;
td = tDate.getDate();
td = parseInt(td,10);
if (td < 10) td = '0' + td;
url = url + "&bbox1=" + ty + "-" + tm + '-' + td;
tDate.setTime(tDate.getTime() + (1 * 24 * 60 * 60 * 1000));
ty = tDate.getYear();
tm = tDate.getMonth();
tm = parseInt(tm,10) + 1;
if (tm < 10) tm = '0' + tm;
td = tDate.getDate();
td = parseInt(td,10);
url = url + "&bbox2=" + ty + "-" + tm + '-' + td;
location.href = url;
}
function swapMenu() {
imgid = document.all(arguments[0].id);
tbl = document.all(arguments[1]);
if (arguments[2] == null) arguments[2] = '';
arguments[2] = arguments[2] + '.';
if (arguments[3] == null) arguments[3] = '_r';
arguments[3] = arguments[3] + '.';
if (arguments[0].src.indexOf(arguments[3]) == -1) return;
for (var i=0; i < imgid.length; i++) {
if (imgid[i] == arguments[0]) { tbl[i].style.display = ''; imgid[i].src = imgid[i].src.substring(0,imgid[i].src.lastIndexOf(arguments[3])) + arguments[2] + imgid[i].src.substring(imgid[i].src.lastIndexOf('.')+1); continue;}
if (imgid[i].src.indexOf(arguments[3]) == -1) { tbl[i].style.display = 'none'; imgid[i].src = imgid[i].src.substring(0,imgid[i].src.lastIndexOf(arguments[2])) + arguments[3] + imgid[i].src.substring(imgid[i].src.lastIndexOf('.')+1); continue;}
}
}
function change_search_urlcode ( obj , code , rurl ) {
var b_url , n_url , len , tnames = new Array , tvalues = new Array ;
b_url = rurl.substring ( 0 , rurl.indexOf('?') ) ;
n_url = rurl.substring ( rurl.indexOf('?')+1 ) ;
n_url = n_url.split('&') ;
len = n_url.length ;
codetyp = code + 'typ' ;
codebox = code + 'box' ;
if ( len == null ) {
if ( obj.value != '' ) {
location.href = b_url + '?' + codetyp + '=' + obj.name + '&' + codebox + '=' + obj.value ;
} else {
location.href = b_url ;
}
}
else {
var tmp , n_url2 = new Array , idx ;
for ( var i = 0 ; i < len ; i++ ) {
tmp = n_url[i].split('=') ;
if ( tmp[0] == codetyp ) {
tnames = tmp[1].split(',');
} else if ( tmp[0] == codebox ) {
tvalues = tmp[1].split(',');
} else {
n_url2[n_url2.length] = n_url[i] ;
}
}
len = tnames.length ;
for ( var i = 0 ; i < len ; i++ ) {
if ( tnames[i] == obj.name ) idx = i ;
}
if ( obj.value == '' ) { tnames.splice(idx,1); tvalues.splice(idx,1); }
else if ( idx != null ) tvalues[idx] = obj.value ;
else { tnames[len] = obj.name ; tvalues[len] = obj.value ; }
if ( tvalues.length > 0 ) {
location.href = b_url + '?' + n_url2.join('&') + '&' + codetyp + '=' + tnames.join(',') + '&' + codebox + '=' + tvalues.join(',') ;
} else {
location.href = b_url + '?' + n_url2.join('&')
}
}
}
function ShowToolTip( id , caller )
{
hideToolTip(id);
var objTarget = document.getElementById(id);
objTarget.style.top = (Region.getBottom(caller)) + "px";
objTarget.style.left = (Region.getLeft(caller) - 5) + "px";
objTarget.style.display = 'block';
}
function hideToolTip( id )
{
var objTarget = document.getElementById(id);
objTarget.style.display = 'none' ;
}
Copyright © 2017 || Recoded By Mr.Bumblebee