function alertMsg(msg, obj) {
	alert(msg);
	obj.focus();
	return;
}

function ChkJumin(str_jumin1,str_jumin2) { 
    errfound = false; 
    var str_jumin1; 
    var str_jumin2; 
    var checkImg=''; 

    var i3=0 
    for (var i=0;i<str_jumin1.length;i++) { 
        var ch1 = str_jumin1.substring(i,i+1); 
        if (ch1<'0' || ch1>'9') { i3=i3+1 } 
    } 
    if ((str_jumin1 == '') || ( i3 != 0 )) { 
        return false; 
    } 

    var i4=0 
    for (var i=0;i<str_jumin2.length;i++) { 
        var ch1 = str_jumin2.substring(i,i+1); 
        if (ch1<'0' || ch1>'9') { i4=i4+1 } 
    } 
    if ((str_jumin2 == '') || ( i4 != 0 )) { 
      return false; 
    } 

    if(str_jumin1.substring(0,1) < 4) { 
        return false; 
    } 

    if(str_jumin2.substring(0,1) > 2) { 
        return false; 
    } 

    if((str_jumin1.length > 7) || (str_jumin2.length > 8)) { 
        return false; 
    } 

    if ((str_jumin1 == '72') || ( str_jumin2 == '18')) { 
      return false; 
    } 
      
    var f1=str_jumin1.substring(0,1) 
    var f2=str_jumin1.substring(1,2) 
    var f3=str_jumin1.substring(2,3) 
    var f4=str_jumin1.substring(3,4) 
    var f5=str_jumin1.substring(4,5) 
    var f6=str_jumin1.substring(5,6) 
    var hap=f1*2+f2*3+f3*4+f4*5+f5*6+f6*7 
    var l1=str_jumin2.substring(0,1) 
    var l2=str_jumin2.substring(1,2) 
    var l3=str_jumin2.substring(2,3) 
    var l4=str_jumin2.substring(3,4) 
    var l5=str_jumin2.substring(4,5) 
    var l6=str_jumin2.substring(5,6) 
    var l7=str_jumin2.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 
    if (hap != l7) { 
      return false; 
    }      
        
    var i9=0 

    if (!errfound) 
        return true; 
}

function idchk(form_nm, id_nm, id_val) {
	var obj = eval("document." + form_nm + "." + id_nm);
	
	if (id_val.replace(/ /g, '') == '') {
		alertMsg('»ç¿ëÇÏ½Ç ¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù', obj);
		return;
	} else {	
		var url = '/main/id_chk_yes.asp?form_nm=' + form_nm + '&id_nm=' + id_nm + '&id_val=' + id_val;
		window.open (url, 'idchk', 'width=420, height=220, top=10, left=10');
	}
}	
			
function find_zip(form_nm, zipcd1_nm, zipcd2_nm, addr1_nm, addr2_nm) {
			
	var url = '/main/zip_find.asp?form_nm=' + form_nm + '&zipcd1_nm=' + zipcd1_nm + '&zipcd2_nm=' + zipcd2_nm + '&addr1_nm=' + addr1_nm + '&addr2_nm=' + addr2_nm;
	window.open (url, 'zipcd', 'width=440, height=300, top=10, left=10, scrollbars=yes, scrolling=auto');
}

//°ø¹éÁ¦°Å ÇÔ¼ö
function RemoveSpace(Str){
	if(Str != null && Str != ""){
		Str = Str.replace(/ /g, '');
	}else{
		Str = "";
	}

	return Str;
}

function resizeImg(doc, max_width){ 
	var a , b, s; 
	a = doc.width; 
	b = doc.height; 
	s = max_width; 
	
	if (a < s) {
		c = a;
	} else {
		c = s;
	}
	doc.width = c;
/*	
	if (a < s && b < s){ 
		c = a 
		d = b 
	}else{ 
		if (a > b){ 
			c = s ; 
			d = (b * c)/a; 
		}else if(a < b){ 
			d = s; 
			c = (a * d)/b; 
		}else{ 
			c = s; 
			d = s; 
		} 
	} 
	doc.width = c; 
	doc.height = d; 
*/
} 

function resizeImg2(doc, max_width, max_height){ 
	var a , b, c, d, s, t; 
	a = doc.width; 
	b = doc.height; 
	s = max_width; 
	t = max_height; 
	
	if (a < s) {
		c = a;
	} else {
		c = s;
	}
	doc.width = c;

	if (b < t) {
		d = b;
	} else {
		d = t;
	}
	doc.height = d;
} 

function OpenWin(url, wintitle, stat){
	var win = window.open(url, wintitle , stat);
	win.focus();
}

function filterlist(selectobj) {
	// VARIABLES
	// HTML SELECT object
	this.selectobj = selectobj;

	// Flags for regexp matching.
	// "i" = ignore case; "" = do not ignore case
	this.flags = "i";

	// Make a copy of the options array
	this.optionscopy = new Array();
	for (var i=0; i < selectobj.options.length; i++) {
		this.optionscopy[i] = new Option();
		this.optionscopy[i].text = selectobj.options[i].text;
		this.optionscopy[i].value = selectobj.options[i].value;
	}

	//==================================================
	// METHODS
	//==================================================

	//--------------------------------------------------	// This method resets the select list to the original state.
	// It also unselects all of the options.  
	this.reset = function() {this.set("");}

	//--------------------------------------------------	// This method removes all of the options from the select list,
	// then adds only the options that match the pattern regexp.
	// It also unselects all of the options.
	// In case of a regexp error, returns false	
	this.set = function(pattern) {		
		var loop=0, index=0, regexp, e;

		// Clear the select list so nothing is displayed
		this.selectobj.options.length = 0;

		// Set up the regular expression
		try {
			regexp = new RegExp(pattern, this.flags);
		} catch(e) {return;}

		// Loop through the entire select list
		for (loop=0; loop < this.optionscopy.length; loop++) {
			// Check if we have a match
			if (regexp.test(this.optionscopy[loop].text)) {
				// We have a match, so add this option to the select list
				this.selectobj.options.length = index + 1;
				this.selectobj.options[index].text = this.optionscopy[loop].text;
				this.selectobj.options[index].value = this.optionscopy[loop].value;
				this.selectobj.options[index].selected = false;
				// Increment the index
				index++;
			}
		}	}

	//--------------------------------------------------
	this.set_ignore_case = function(value) {
		// This method sets the regexp flags.
		// If value is true, sets the flags to "i".
		// If value is false, sets the flags to "".

		if (value) {this.flags = "i";}		else {this.flags = "";}
	}
}


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() + ";" 
} 

function closeWin()
{
  setCookie( "popup", "done" , 1); 
  this.close();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function naviPage(v_form, v_url, v_frame) {
	v_form.target = v_frame;
	v_form.action = v_url;
	v_form.submit();
}
	
function viewMem(v_commid, v_id) {
	window.open('/comm/moim/pop_mem_view.asp?commid=' + v_commid + '&uid=' + v_id, 'popMember', 'top=10, left=10, width=550, height=250');
}