String.prototype.isid = function() {
	if( this.length < 5 || this.length > 10 ) { return false; }
	if( this.charAt(0).search(/[^A-Za-z]/) > -1 ) { return false; }
	if( this.search(/[^A-Za-z0-9_-]{1,}/) == -1 && this.chknull() ) return true;
	else return false;
}

String.prototype.ispass = function() {
	if( this.length < 6 || this.length > 8 ) { return false; }
	if( this.search(/[^A-Za-z0-9_\-\!@#]{1,}/) == -1 && this.chknull() ) return true;
	else return false;
}

String.prototype.isemail = function() {
	if( this.search(/[A-Za-z0-9]{1,}@[A-Za-z0-9]{1,}\.[A-Za-z]{1,}$/) > -1 ) return true;
	else if( this.search(/[A-Za-z0-9]{1,}@[A-Za-z0-9]{1,}\.[A-Za-z]{2,}\.[A-Za-z]{2,}$/) > -1 ) return true;
	else return false;
}

String.prototype.isjumin = function() {
	var ssn_first, ssn_second;
	var chk_sum = 0, ii, dbl_num = 2, n_num, rem;
	
	if( this.search(/^[0-9]{6}\-[1-4][0-9]{6}$/) > -1 ) {
		ssn_first = parseInt( this.substring(0,1) );
		ssn_second = parseInt( this.substring(7,8) );
		
		if( ( (ssn_first > 0) && ((ssn_second > 0) && (ssn_second < 3)) ) 
		 || ( (ssn_first == 0) && ((ssn_second > 2) && (ssn_second < 5)) ) ) {
			for( ii = 0; ii < 13; ii++) {
				if(ii != 6) {
					if(dbl_num > 9) { dbl_num = 2; }
					n_num = parseInt( this.substring(ii, ii+1) );
					chk_sum += dbl_num * n_num;
					dbl_num++;
				}
			}
			rem = (11 - (chk_sum % 11)) % 10;

			if( rem == parseInt(this.substring(13,14)) ) { return true; }
			else { return false; }
			
		} else { return false; }
	} else { return false; }
}

String.prototype.istel = function() {
	if( this.search(/^0[0-9]{1,3}\-[0-9]{2,4}\-[0-9]{4}$/) > -1 ) { return true; }
	else { return false; }
}

String.prototype.chknull = function() {
	var thisv = this;
	for (; thisv.indexOf(" ") != -1 ; )	thisv = thisv.replace(" ","");
	if( thisv.length > 0 ) return true;
	else return false;
}

String.prototype.trim = function() {
	var thisv = this;
	return thisv.replace(/^\s+/,'').replace(/\s+$/,'');
}

// HTML Æ¯¼ö¹®ÀÚ¸¦ º¯È¯
String.prototype.htmlChars = function () {
	var str = ((this.replace('"', '&')).replace('"', '"')).replace('\'', '');
	return (str.replace('<', '&lt;')).replace('>', '&gt;');
}

function Popup_CenterWindow(url, wName, ww, wh) {
	var oPop;
	var sw = screen.availWidth;
	var sh = screen.availHeight;

	sw = (sw - ww) / 2;
	sh = (sh - wh) / 2;
	
	oPop =  window.open(url, wName, "left=" + sw + ",top=" + sh + ",width=" + ww + ",height=" + wh + ",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no");
	if(oPop == null) {
		alert("ÆË¾÷Â÷´ÜÀ» ÇØÁ¦ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		return null;
	} else {
		return oPop;
	}
}
function search(f, sCtl) {
	if(!sCtl.value.trim().htmlChars()) {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		sCtl.focus();
		return false;
	}
	f.page.value = 1;
}
function goPage( iPg ) {
	var frm;
	var tmpFrm;
	var TagLen = document.getElementsByTagName('form').length;
	if(TagLen == 0) {
		alert("FORM TAG¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.");
		return;
	} else if(TagLen == 1) {
		frm = document.getElementsByTagName('form')[0];
	} else {
		frm = null;
		for(var ii = 0; ii < TagLen; ii++) {
			tmpFrm = document.getElementsByTagName('form')[ii];
			if(tmpFrm.name == "SForm") {
				frm = document.getElementsByTagName('form')[ii];
				break;
			}
		}
		if(frm == null) {
			frm = document.getElementsByTagName('form')[0];
		}
	}
	if(frm.page) {
		frm.page.value = iPg;
		frm.submit();
	} else {
		alert("page element¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.");
	}
}
function goCPage( iPg ) {
	var frm;
	var tmpFrm;
	var TagLen = document.getElementsByTagName('form').length;
	if(TagLen == 0) {
		alert("FORM TAG¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.");
		return;
	} else if(TagLen == 1) {
		frm = document.getElementsByTagName('form')[0];
	} else {
		frm = null;
		for(var ii = 0; ii < TagLen; ii++) {
			tmpFrm = document.getElementsByTagName('form')[ii];
			if(tmpFrm.name == "SForm") {
				frm = document.getElementsByTagName('form')[ii];
				break;
			}
		}
		if(frm == null) {
			frm = document.getElementsByTagName('form')[0];
		}
	}
	if(frm.cpage) {
		frm.cpage.value = iPg;
		frm.submit();
	} else {
		alert(" cpage element¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.");
	}
}
function Read(f, seq, act) {
	f.action = act + ".asp";
	f.seq.value = seq;
	f.submit();
}
function List(f, act) {
	f.action = act;
	f.submit();
}
function EnableBtn(obj1, obj2) {
	if(obj1.checked) {
		if(obj2 != null) {
			obj2.disabled = false;
		}
	} else {
		if(obj2 != null) {
			obj2.disabled = true;
		}
	}
}
function SaveScrap_fan( surl ) {
	if(surl == '') {
		surl = escape(document.location.href);
	} else {
		surl = escape(surl);
	}
	Popup_CenterWindow("../07_join/pop_block.asp?surl=" + surl, "scp", 280, 265);
}
function SaveScrap() {
	Popup_CenterWindow("../07_join/pop_block.asp?surl=" + escape(document.location.href), "scp", 280, 265);
}

String.prototype.popupView = function () { 
	var img_view = this;
	var x = x + 20 ; 
	var y = y + 30 ; 
	var htmlz = "<html><head><title>ÀÌ¹ÌÁöÅ©°Ôº¸±â</title><style>body{margin:0;cursor:hand;}</style>"
	htmlz += "<script>function returnEventFalse(){event.returnValue = false;}function returnEventTrue() {event.returnValue = true;}"
	htmlz += "document.oncontextmenu = returnEventFalse;document.ondragstart = returnEventFalse;document.onselectstart = returnEventFalse;"
	htmlz += "</script></head><body scroll=auto onload='width1=document.all.Timage.width;if(width1>1024)width1=1024;height1=document.all.Timage.height;if(height1>768)height1=768;top.window.resizeTo(width1+30,height1+54);' onclick='top.window.close();'><img src='"+img_view+"'  title='Å¬¸¯ÇÏ½Ã¸é ´ÝÈü´Ï´Ù.' name='Timage' id='Timage'></body></html>" 
	var imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1"); 
	imagez.document.open(); 
	imagez.document.write(htmlz) 
	imagez.document.close(); 
}

function getCookieVal (offset)
{
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return document.cookie.substring(offset, endstr);
}

function getCookie (name) {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {   //while open
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }    //while close
   return "";
}

function setCookie(name, value) {
   var argv = setCookie.arguments;
   var argc = setCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;
   document.cookie = name + "=" + value +
        ((expires == null) ? "" : ("; expires="+expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
}

function onlyNumber() {
	if(event.keyCode != 13) {
		if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;
	}
}
function keypressed() {
	if (event.ctrlKey == true ){
		alert('CtrlÅ° »ç¿ëºÒ°¡´É ÇÕ´Ï´Ù.');
		return false;
	}

	if (event.altKey == true ){
		alert('AltÅ°´Â »ç¿ëºÒ°¡´É ÇÕ´Ï´Ù.');
		return false;
	}
}

/******************************
function returnEventFalse() {
	event.returnValue = false;
}

function returnEventTrue() {
	event.returnValue = true;
}

document.oncontextmenu = returnEventFalse;
document.ondragstart = returnEventFalse;
document.onselectstart = returnEventFalse;
***********************************/




function imgcheck(imgObj, bool)

{

    var imgWidth = 300;        //** ¼³Á¤ ÀÌ¹ÌÁö Æø°ª

    var imgHeight = 300;      //** ¼³Á¤ ÀÌ¹ÌÁö ³ôÀÌ°ª

 

    if(bool)        //** ÀÌ¹ÌÁö°¡ ·ÎµùÀÌ ´Ù µÇ¾úÀ»°æ¿ì

    {

        var O_Width = imgObj.width;        //** ÀÌ¹ÌÁöÀÇ ½ÇÁ¦ Æø

        var O_Height = imgObj.height;     //** ÀÌ¹ÌÁöÀÇ ½ÇÁ¦ ³ôÀÌ

        var ReWidth = O_Width;        //** º¯È­µÈ Æø ÀúÀå º¯¼ö

        var ReHeight = O_Height;      //** º¯È­µÈ ³ôÀÌ ÀúÀå º¯¼ö

 

        if(ReWidth > imgWidth)

        {

            ReWidth = imgWidth;

            ReHeight = (O_Height * ReWidth) / O_Width;

        }

 

        if(ReHeight > imgHeight)

        {

            ReWidth = (ReWidth * imgHeight) / ReHeight;

            ReHeight = imgHeight;

        }

 

        //**    Ã³¸®

            imgObj.width = ReWidth;

            imgObj.height = ReHeight;

            imgObj.alt = ReWidth +','+ ReHeight;

    }

    else            //** ÀÌ¹ÌÁö°¡ ÇØ´ç °æ·Î¿¡ ¾ø¾î ·Îµù ¿¡·¯°¡ »ý°åÀ»°æ¿ì

    {

        //** ¾Èº¸ÀÌ°Ô ½ºÅ¸ÀÏ ½ÃÆ®·Î Ã³¸®

            imgObj.style.display = 'none';

    }

}

   // ±×¸² ÀÌ¹ÌÁö ºñ·Ê Á¶Á¤
   function func_adjustimage(target_img)
   {
      var newX;
      var newY;
      var newHeight;
      var newWidth;
      var maxWidth = 450;
      var maxHeight = 400;
      var newImg = new Image();
      newImg.src = target_img.src;
      imgw = newImg.width;
      imgh = newImg.height;
      if (imgw > maxWidth || imgh > maxHeight)
      {
         if (imgw > imgh)
         {
            if (imgw > maxWidth)
               newWidth = maxWidth;
            else
               newWidth = imgw;
            newHeight = Math.round((imgh * newWidth) / imgw);
         }
         else
         {
            if (imgh > maxHeight)
               newHeight = maxHeight;
            else
               newHeight = imgh;
            newWidth = Math.round((imgw * newHeight) / imgh);
         }
      }
      else
      {
         newWidth = imgw;
         newHeight = imgh;
      }
       newX = maxWidth / 2 - newWidth / 2;
       newY = maxHeight / 2 - newHeight / 2;
       target_img.onload = null;
       target_img.src = newImg.src;
       target_img.width = newWidth;
       target_img.height = newHeight;
   }

 // ±×¸² ÀÌ¹ÌÁö ºñ·Ê Á¶Á¤
   function func_adjustimage1(target_img)
   {
      var newX;
      var newY;
      var newHeight;
      var newWidth;
      var maxWidth = 130;
      var maxHeight = 100;
      var newImg = new Image();
      newImg.src = target_img.src;
      imgw = newImg.width;
      imgh = newImg.height;
      if (imgw > maxWidth || imgh > maxHeight)
      {
         if (imgw > imgh)
         {
            if (imgw > maxWidth)
               newWidth = maxWidth;
            else
               newWidth = imgw;
            newHeight = Math.round((imgh * newWidth) / imgw);
         }
         else
         {
            if (imgh > maxHeight)
               newHeight = maxHeight;
            else
               newHeight = imgh;
            newWidth = Math.round((imgw * newHeight) / imgh);
         }
      }
      else
      {
         newWidth = imgw;
         newHeight = imgh;
      }
       newX = maxWidth / 2 - newWidth / 2;
       newY = maxHeight / 2 - newHeight / 2;
       target_img.onload = null;
       target_img.src = newImg.src;
       target_img.width = newWidth;
       target_img.height = newHeight;
   }