var TRIM_PATTERN = /(^\s*)|(\s*$)/g;
 
String.prototype.trim = function() {
 return this.replace(TRIM_PATTERN, "");
}

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_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 img_erro(obj,img){
	obj.src = img;
}

function n_format(rightchar){
	var moneychar="";
	var rightchar=String(rightchar);
	for(index=rightchar.length-1;index>=0;index--){
		splitchar=rightchar.charAt(index);
		moneychar=splitchar+moneychar;
		if(index%3==rightchar.length%3&&index!=0){ moneychar=','+moneychar; }
	}
	return moneychar;
}

//¾ÆÀÌÇÁ·¹ÀÓ ÀÚµ¿ Å©±â Á¶Àý ¼³Á¤
function reSize() {
    try {
        var objBody = iframe_main.document.body;
        var objFrame = document.getElementById("iframe_main");

        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);

        objFrame.style.height = ifrmHeight;

    }
        catch(e) {}
}
function init_iframe() {
    reSize();
    setTimeout('init_iframe()',1)
}

//¼ýÀÚ¸¸ ÀÔ·Â
function SetNum(obj){
	val=obj.value;
	re=/[^0-9]/gi;
	obj.value=val.replace(re,"");
}

//¼ýÀÚ°Ë»ö
function numcheck(check_num) {
	var inText = check_num.value;
	var ret;
	for (var i=0; i<inText.length; i++) {
		ret = inText.charCodeAt(i);
		if ((ret<48) || (ret>57))	return true;
	}
	return false;
}

function downLoad(bbs_id,b_id,cnt){
	location.href="/board/action/download.php?bbs_id="+bbs_id+"&b_id="+b_id+"&f="+cnt;
}

function viewFlash(URL,mode,wid,hei,text) 
{
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+wid+"' height='"+hei+"' title='"+text+"'>");
	document.write("<param name='movie' value='"+URL+"'/>");
	document.write("<param name='quality' value='high'/>");
	document.write("<param name='WMODE' value='"+mode+"' />");
	document.write("<embed src='"+URL+"' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' wmode='transparent' width='"+wid+"' height='"+hei+"'></embed>");
	document.write("</object>");
}


function media(file,w,h,auto,cont,state){
	document.write ('<OBJECT classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="'+w+'" height="'+h+'" id="movie">');
	document.write ('<PARAM NAME="Filename" VALUE="'+file+'"/>');
	document.write ('<param name="ClickToPlay" value="false"/>');
	document.write ('<param name="AutoSize" value="0"/>');
	document.write ('<param name="AutoStart" value="'+auto+'"/>');
	document.write ('<param name="ShowControls" value="'+cont+'"/>');
	document.write ('<param name="ShowAudioControls" value="false"/>');
	document.write ('<param name="ShowDisplay" value="0"/>');
	document.write ('<param name="ShowTracker" value="1"/>');
	document.write ('<param name="ShowStatusBar" value="'+state+'"/>');
	document.write ('<param name="EnableContextMenu" value="false"/>');
	document.write ('<param name="ShowPositionControls" value="false"/>');
	document.write ('<param name="ShowCaptioning" value="false"/>');
	document.write ('<param name="AutoRewind" value="true"/>');
	document.write ('<param name="Enabled" value="true"/>');
	document.write ('<param name="EnablePositionControls" value="true"/>');
	document.write ('<param name="EnableTracker" value="true"/>');
	document.write ('<param name="PlayCount" value="1"/>');
	document.write ('<param name="SendWarningEvents" value="true"/>');
	document.write ('<param name="SendErrorEvents" value="true"/>');
	document.write ('<param name="SendKeyboardEvents" value="false"/>');
	document.write ('<param name="SendMouseClickEvents" value="false"/>');
	document.write ('<param name="SendMouseMoveEvents" value="false"/>');
	document.write ('<param name="ShowGotoBar" value="false"/>');
	document.write ('<param name="TransparentAtStart" value="false"/>');
	document.write ('<param name="Volume" value="1000"/>');
	document.write ('</OBJECT>');
}

//ÀÌ¹ÌÁö »õÃ¢ 
function CaricaFoto(img)
{
	foto1= new Image();
	foto1.src=(img);
	Controlla(img);
}

function Controlla(img)
{
	if((foto1.width!=0)&&(foto1.height!=0))
	{
		viewFoto(img);
	}
	else
	{
		funzione="Controlla('"+img+"')";
		intervallo=setTimeout(funzione,20);
	}
}

function viewFoto(img)
{
	largh=foto1.width+20;
	altez=foto1.height;
	stringa="width="+largh+",height="+altez+",scrollbars=1,top=10,left=10";
	finestra=window.open("/board/include/img_pop.asp?img="+img,"",stringa);
}


//ÆÄÀÏÀÇ È®ÀåÀÚ¸¦ °¡Á®¿Å
function getFileExtension(filePath)
{
	var tmp = filePath.split(".");

	extension = tmp[tmp.length-1];

    return extension;
}


//·Ñ¿À¹ö ÀÌ¹ÌÁö º¯È¯
function ch_over(obj)
{
	if(obj.src.indexOf("_on") == -1){ 
		var img = obj.src.split('.gif');
		obj.src = img[0] + '_on.gif';
	}
}
function ch_out(obj)
{
	var img = obj.src.split('_on.gif');
	obj.src = img[0] + '.gif';
}

function isNull( s ) { 
	if( s == null ) return true; 

	var result = s.replace(/(^\s*)|(\s*$)/g, ""); 

	if( result ) return false; 
	else return true; 
}

function resizeImg(arg,w2,h2) {
    var w = eval(arg.width);
    var h = eval(arg.height);  
    if (w > eval(w2)) arg.width = w2;
    if (h > eval(h2)) arg.height = h2;
}

function move_url(str,p){
	if(p=="top"){
		top.location.href=str;
	}else{
		location.href=str;
	}
}


function date_chk(ymd1,ymd2){
	//ymd Çü½Ä : y/m/d H:i;
	
	date1	= ymd1.replace(/\-/gi,"/");
	date2	= ymd2.replace(/\-/gi,"/");
	d1 = new Date(date1); 
	d2 = new Date(date2); 

	if (d1 > d2) return true;
	else return false;
}

function timeview(sTday,eNday){ 
    var sTyear=sTday.substr(0,4);var sTmonth=sTday.substr(5,2);var sTday=sTday.substr(8,2); 
    var eNyear=eNday.substr(0,4);var eNmonth=eNday.substr(5,2);var eNday=eNday.substr(8,2); 
    var sTall=new Date(sTyear, sTmonth-1, sTday); 
    var eNall=new Date(eNyear, eNmonth-1, eNday); 
    return (eNall.getTime()-sTall.getTime())/(24*60*60*1000); 
} 

//È­¸éÁß¾Ó ÆË¾÷Ã¢ À§Ä¡
function center_popup(w,h,url,scroll,name){
	if(scroll=="undefined")	scrool	= "no";
	if(name=="undefined")	name	= "normal";

	if (screen.width < 1025){
		LeftPosition=0;
		TopPosition=0;
	} else {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	window.open(url,name,"width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition+", scrollbars="+scroll).focus();
}

function zone_popup(w,h,t,l,url,scroll,name){
	window.open(url,name,"width="+w+",height="+h+",top="+t+",left="+l+", scrollbars="+scroll).focus();
}
function alertWin(sURL,sMsg,sWidth,sHeight,sTop,sLeft,sResize)
{
	var sFeatures = new Array();
	sFeatures[0] = (sWidth > 0)? "dialogWidth:"+sWidth+"px":"dialgWidth:300px";
	sFeatures[1] = (sHeight > 0)? "dialogHeight:"+sHeight+"px":"dialogHeight:300px";
	sFeatures[2] = (sTop > 0)? "dialogTop:"+sTop+"px":"";
	sFeatures[3] = (sLeft > 0)? "dialogLeft:"+sLeft+"px":"";
	sFeatures[4] = (!sTop && !sLeft)? "center:Yes":"";
	sFeatures[5] = (sResize)? "resizeable:"+sResize:"resizeable:No";
	sFeatures[6] = "help:No";
	sFeatures[7] = "status:No";
	sFeatures = sFeatures.join(";");
	window.showModalDialog(sURL,self,sFeatures);
}

var menu1 = '';
var menu2 = '';
function leftMenu(m1,m2) {
    if( menu1 != m1 ){
	    if( menu1 !='' ){
	        document.getElementById(menu1).style.display = 'none';
	        document.getElementById(menu2).style.display = 'block';
		}
	    document.getElementById(m1).style.display = '';
	    document.getElementById(m2).style.display = 'none';
		menu1 = m1;
		menu2 = m2;
    } else {
        document.getElementById(m1).style.display = 'none';
        document.getElementById(m2).style.display = 'block';
        menu1 = '';
        menu2 = '';
    }
}



function selectbox_hidden(layer_id) 
{ 
	var ly = eval(layer_id); 

	// ·¹ÀÌ¾î ÁÂÇ¥ 
	var ly_left  = ly.offsetLeft; 
	var ly_top    = ly.offsetTop; 
	var ly_right  = ly.offsetLeft + ly.offsetWidth; 
	var ly_bottom = ly.offsetTop + ly.offsetHeight; 

	// ¼¿·ºÆ®¹Ú½ºÀÇ ÁÂÇ¥ 
	var el; 

	for (i=0; i<document.forms.length; i++) { 
			for (k=0; k<document.forms[i].length; k++) { 
					el = document.forms[i].elements[k];    
					if (el.type == "select-one") { 
							var el_left = el_top = 0; 
							var obj = el; 
							if (obj.offsetParent) { 
									while (obj.offsetParent) { 
											el_left += obj.offsetLeft; 
											el_top  += obj.offsetTop; 
											obj = obj.offsetParent; 
									} 
							} 
							el_left  += el.clientLeft; 
							el_top    += el.clientTop; 
							el_right  = el_left + el.clientWidth; 
							el_bottom = el_top + el.clientHeight; 

							// ÁÂÇ¥¸¦ µûÁ® ·¹ÀÌ¾î°¡ ¼¿·ºÆ® ¹Ú½º¸¦ Ä§¹üÇßÀ¸¸é ¼¿·ºÆ® ¹Ú½º¸¦ hidden ½ÃÅ´
							if ( (el_left >= ly_left && el_top >= ly_top && el_left <= ly_right && el_top <= ly_bottom) || 
									(el_right >= ly_left && el_right <= ly_right && el_top >= ly_top && el_top <= ly_bottom) || 
									(el_left >= ly_left && el_bottom >= ly_top && el_right <= ly_right && el_bottom <= ly_bottom) || 
									(el_left >= ly_left && el_left <= ly_right && el_bottom >= ly_top && el_bottom <= ly_bottom) ) 
									el.style.visibility = 'hidden'; 
					} 
			} 
	} 
} 

// °¨Ãß¾îÁø ¼¿·ºÆ® ¹Ú½º¸¦ ¸ðµÎ º¸ÀÌ°Ô ÇÔ 
function selectbox_visible() 
{ 
	for (i=0; i<document.forms.length; i++) { 
			for (k=0; k<document.forms[i].length; k++) { 
					el = document.forms[i].elements[k];    
					if (el.type == "select-one" && el.style.visibility == 'hidden') 
							el.style.visibility = 'visible'; 
			} 
	} 
}


function selectboxShow(bVisible)
{ 
	for(q=0;q<document.forms.length;q++){
		for(i=0;i<document.forms[q].elements.length;i++){
			if(document.forms[q].elements[i].type=='select-one'){
				document.forms[q].elements[i].style.visibility = (bVisible=="Y") ? "visible" : "hidden"; 
			}
		}
	}
}


function imgResize()
{ 
	var maxsize = 600;
    var content = $("DivContents"); 
    var img = content.getElementsByTagName("img"); 
    for(i=0; i<img.length; i++) 
    { 

        if ( eval('img[' + i + '].width > maxsize') ) 
        { 
            var heightSize = ( eval('img[' + i + '].height')*maxsize )/eval('img[' + i + '].width') ; 
            eval('img[' + i + '].width = maxsize') ; 
            eval('img[' + i + '].height = heightSize') ; 
        } 
    } 
} 

//¼¿·ºÆ®¹Ú½º º¯°æ
function chk_link(objName,sel){
	var obj	= document.getElementsByName(objName);
	for(i=0;i<obj.length;i++){
		obj[i].style.display = (eval(sel)==i) ? "" : "none";
	}
}

function showMail(str){
	var iconObj = document.getElementById("emailIcon_"+str);
	var mailObj = document.getElementById("email_"+str);
	iconObj.style.display = "none";
	mailObj.style.display = "";
}

function popupShow(w,h,url,name,centerChk,left,top,closeChk,skin){
	if(name=="undefined")	name	= "normal";
	if (skin == "Y")
	{
		w = 465;
		h = 475;
		if(closeChk != "Y"){
			h = h + 35;
		}else{
			h = h;
		}			
	}else{
		w = eval(w);
		h = eval(h);
	}
	if(centerChk == "Y"){
		if (screen.width < 1025){
			LeftPosition=0;
			TopPosition=0;
		} else {
			LeftPosition=(screen.width)?(screen.width-w)/2:100;
			TopPosition=(screen.height)?(screen.height-h)/2:100;
		}
	}else{
		LeftPosition=left;
		TopPosition=top;
	}
	window.open(url,name,"width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition+", scrollbars=no").focus();
}

function JuminCheck(ResNo1, ResNo2){
	var chk = 0;
	var yy  = ResNo1.substring(0,2);
	var mm  = ResNo1.substring(2,4);
	var dd  = ResNo1.substring(4,6);
	var sex = ResNo2.substring(0,1);

	if(ResNo1.length != 6) return true;

	if((sex != 1 && sex != 2 && sex != 3 && sex != 4) || (ResNo2.length != 7)) return true;   

	if((ResNo1.length == 6) && (ResNo2.length == 7)) {
		var ich = parseInt(sex, 10); 
		switch(ich) {
			case 1: break;
			case 2: break;
			case 3: if(yy == 00) break;
			case 4: if(yy == 00) break;
			default:
			return true;
		}
	}

	for(var i = 0; i <=5; i++) { 
		chk = chk + (((i % 8) + 2) * parseInt(ResNo1.substring(i, i + 1)));
	}

	for(var i = 6; i <= 11; i++) {
	chk = chk + (((i % 8) + 2) * parseInt(ResNo2.substring(i - 6, i - 5)));
	}

	chk = 11 - (chk % 11);
	chk = chk % 10;

	if(chk != ResNo2.substring(6, 7)) return true;
	return false
}

function id_chk(objName){
/*
	var obj = document.getElementById(objName);
	if (isNull(obj.value)){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		obj.focus();
	}else{
*/
		center_popup(408,215,'/board/include/id_search.asp',0,'id_search');
//	}
}

function postSearch(str){
	center_popup(430,463,'/board/include/add_search.asp?po='+str,0,'post_search');
}

function PrepareSave(objName) {
	var oEditor = FCKeditorAPI.GetInstance(objName) ;
	document.getElementById(objName).value = oEditor.GetXHTML() ;
}

function check_it(obj){
	chk_bt	= document.getElementsByName("no[]");
	for(i=0;i<chk_bt.length;i++){
		chk_bt[i].checked = (obj.checked == true) ? true : false;
	}
}


function vwimgrzmv(obj,imgsrc) {
	var rz = 0;
	var scrl = 0;
	var rzwidth = obj.width + 5;
	var rzheight = obj.height + 25;
	var mvleft = (window.screen.width - obj.width) / 2;
	var mvtop = (window.screen.height - obj.height - 25) / 2;
	var imgwin = null;
	var ie = navigator.appName.indexOf('Microsoft Internet Explorer')>-1 ? true : false;

	if(obj.height>window.screen.height) {
		rz = 0;
		scrl = 1;
		rzwidth = obj.width + 23;
		rzheight = window.screen.height - 30;
		mvtop = 0;
	}

	if(obj.width>window.screen.width) {
		rz = 0;
		scrl = 1;
		rzwidth = window.screen.width;
		mvleft = 0;
	}

	if(!imgsrc) imgsrc = obj.src;

	imgwin = window.open('','_blank','toolbar=0,menubar=0,status=1,scrollbars=' + scrl + ',resizable=' + rz + ',width=0,height=0,left=' + ((window.screen.availWidth-245)/2) + ',top=' + ((window.screen.availHeight-105)/2));
	if(imgwin) {
		imgwin.blur();
		imgwin.moveTo(0,0);
		imgwin.resizeTo(0,0);

		imgwin.document.write(("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><" + "html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ko\" xml:lang=\"utf-8\"><" + "head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><" + "title>object</" + "title><style type=\"text/css\">body { margin:0; }</style></" + "head>" +
			"<" + "body>" +
			"<img src=\"" + imgsrc.replace('+',' ') + "\" id=\"uploaded_image\" " +
			" onload=\"" +
				"var rz = 0;" +
				"var scrl = 0;" +
				"var rzwidth = this.width + 5;" +
				"var rzheight = this.height + 25 + " + (ie?55:30)  + ";" +
				"var mvleft = (window.screen.width - this.width) / 2;" +
				"var mvtop = (window.screen.height - this.height-25) / 2;" +
				"var imgwin = null;" +
				"if(this.height >= window.screen.height - 10) {" +
					"rzwidth = this.width + 23;" +
					"rzheight = window.screen.height - 30;" +
					"mvtop = 0;" +
				"} " +
				"if(this.width >= window.screen.width - 10) {" +
					"rz = 1;" +
					"scrl = 1;" +
					"rzwidth = window.screen.width;" +
					"mvleft = 0;" +
				"}" +
				"window.resizeTo(rzwidth, rzheight);" +
				"window.moveTo(mvleft, mvtop);" +
				"window.scrollbars = scrl;" +
				"window.resizable = rz;" +
				"\"" +
			" onerror=\"alert('ÀÌ¹ÌÁöÆÄÀÏÀÌ ¾ø°Å³ª ÆÄÀÏÀÌ¸§ÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.\\nÆÄÀÏÀÌ¸§¿¡ ÇÑ±ÛÀÌ Æ÷ÇÔµÇ¾î ÀÖÀ¸¸é ºä¾îÃ¢¿¡ ¿À·ù°¡ ¹ß»ýÇÒ¼öµµ ÀÖ½À´Ï´Ù.');self.close();\"" +
			" onclick=\"window.close();\"" +
			" style=\"cursor:hand;cursor:pointer;\" alt=\"Å¬¸¯ÇÏ½Ã¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù\" />" +
			"<" + "script type=\"text/javascript\">" +
				"function init() {" +
					"var img = document.getElementById('uploaded_image');" +
					"if(img) {" +
						"if(img.width >= window.screen.width -10) {" +
							"img.width = window.screen.width - 10;" +
						"}" +
						"if(img.height >= window.screen.height-50) {" +
							"document.body.scroll='auto';" +
						"}" +
						"document.title = img.width + '*' + img.height;" +
					"}" +
				"}" +
				"window.onLoad = init();" +
			"</" + "script" + ">" +
			"</" + "body></" + "html>"));
		imgwin.status = "Resolution:" + window.screen.width + "x" + window.screen.height;
		imgwin.focus();
	}
}

function controlImage(img_id,img_width) {
	var maxWidth = img_width < 1 ? document.body.clientWidth-100 : img_width;
	var w = document.getElementById(img_id).width;

	document.getElementById(img_id).style.visibility = "hidden";

	if(w <= 0) {
		time_id = window.setTimeout("controlImage('" + img_id + "')",10);
	}
	else {
		if(w > maxWidth) {
			document.getElementById(img_id).width = maxWidth;
		}
		document.getElementById(img_id).style.visibility = "visible";
	}
}

//ÄíÅ°°ª ÃßÃâ
//@param cookieName ÄíÅ°¸í

function getCookie( cookieName ){
	var search = cookieName + "=";
	var cookie = document.cookie;

	// ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
	if( cookie.length > 0 )	{
		// ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
		startIndex = cookie.indexOf( cookieName );
		// ¸¸¾à Á¸ÀçÇÑ´Ù¸é
		if( startIndex != -1 ){
			// °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
			startIndex += cookieName.length;
			// °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
			endIndex = cookie.indexOf( ";", startIndex );
			// ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
			if( endIndex == -1) endIndex = cookie.length;
				// ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
			return unescape( cookie.substring( startIndex + 1, endIndex ) );
		}else{
			// ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
			return false;
		}
	}else{
		// ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
		return false;
	}
}



//ÄíÅ° ¼³Á¤
//@param cookieName ÄíÅ°¸í
//@param cookieValue ÄíÅ°°ª
//@param expireDay ÄíÅ° À¯È¿³¯Â¥

function setCookie( cookieName, cookieValue, expireDate ){
	var today = new Date();
	today.setDate( today.getDate() + expireDate);
	document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/;";
}

//ÄíÅ° »èÁ¦
//@param cookieName »èÁ¦ÇÒ ÄíÅ°¸í

function deleteCookie( cookieName ){
	var expireDate = new Date();
	//¾îÁ¦ ³¯Â¥¸¦ ÄíÅ° ¼Ò¸ê ³¯Â¥·Î ¼³Á¤ÇÑ´Ù.
	expireDate.setDate( expireDate.getDate() - 1 );
	document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
}

function ShowFlash(url, width, height){
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" VIEWASTEXT>');
        document.write('<param name="movie" value="' + url + '">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="wmode" value="transparent">');
        document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
        document.write('</object>');
}


function checkBoxValueChk(){
	try{
		var data = "";
		var chkObj = document.getElementsByName("items");
		for(i=0;i<chkObj.length;i++){
			if(chkObj[i].checked) data = data + chkObj[i].value + ",";
		}
		data = data.substring(0,data.length-1);					
		return data;
	}catch(e){alert(e);}
}
function allCheck(obj){
	var data = "";
	var chkObj = document.getElementsByName("items");
	for(i=0;i<chkObj.length;i++){
		chkObj[i].checked = obj.checked 
	}
}


function allChk(obj){
	var chkBox = document.getElementsByName("chk[]");
	for(i=0;i<chkBox.length;i++){
		chkBox[i].checked = obj.checked;
	}
}

function chkVal(){
	var data = "";
	var chkBox = document.getElementsByName("chk[]");
	for(i=0;i<chkBox.length;i++){
		if(chkBox[i].checked) data += chkBox[i].value + ",";
	}
	data = data.substring(0,data.length - 1);
	return data;
}

function loginWrite(url){
	var c = confirm("·Î±×ÀÎÈÄ ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?","");
	if(c) location.href="/05member/member01.asp?ret="+url

}


function regcheck(num){
   var month='(0[1-9]|1[0-2])';
   var date='(0[1-9]|[1-2][0-9]|3[0-1])';
   var regMonth = new RegExp(month);
   var regDate = new RegExp(date);
   if(!regMonth.test(num.substring(2,4))){
      return false;
   }
   if(!regDate.test(num.substring(4,6))){
      return false;
   }
   var tab=[2,3,4,5,6,7,8,9,2,3,4,5];
   var sum=0,i=0;
   for(i=0;i<12;i++) sum+=parseInt(num.charAt(i))*tab[i];
   if(((11-(sum%11))%10!=num.charAt(12))){
      return false;
   }
   return true;
}


function fgn_no_chksum(reg_no) {
    var sum = 0;
    var odd = 0;
   
    buf = new Array(13);
    for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));

    odd = buf[7]*10 + buf[8];
   
    if (odd%2 != 0) {
      return false;
    }

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
      return false;
    }
    
    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);


    sum=11-(sum%11);
   
    if (sum>=10) sum-=10;

    sum += 2;

    if (sum>=10) sum-=10;

    if ( sum != buf[12]) {
        return false;
    }
    else {
        return true;
    }
}

function member_out_c1(){
	var c = confirm("È¸¿øÅ»Åð ÇÏ½Ã°Ú½À´Ï±î?\n\n¸¶ÀÏ¸®Áö ¹× ±âÁ¸Á¤º¸°¡ ¿µ±¸È÷ »èÁ¦µË´Ï´Ù.","");
	if(c) location.href="/board/action/member_delete.asp?site_v=c1";
}

 
function open_url(v){

	href=document.getElementById(v).value;
	if(href==""){
		alert("»çÀÌÆ®¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.");
		document.getElementById("open_site_url").focus();
	}else{
		window.open(href,'_blank')
	}
}
