//**************************************
// µå¸²À§¹ö¿¡¼­ Á¦°øÇÏ´Â ÇÔ¼ö¶óÀÌºê·¯¸®
//**************************************


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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//trim°´Ã¼
String.prototype.trim = function(){
	return this.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
}
//ÁÖ¹Î¹øÈ£ °Ë»ç
function juminCheck(jumin){
	if(jumin.length != 13)
		return false;


	total = 0;
	temp = new Array(13);
	for(i = 1; i <= 13; i++){
		temp[i] = jumin.charAt(i-1);
	}
	for(i = 1; i<=12; i++){
		k = i+1;
		if(k >=10)
			k = k % 10 + 2;
		total = total + temp[i] * k;
	}
	mm = temp[3] + temp[4];
	dd = temp[5] + temp[6];
	totalmod = total % 11;
	chd = (11 - totalmod)%10;
	if(chd == temp[13] && mm < 13 && dd < 32 && (temp[7] == 1 || temp[7] == 2|| temp[7] == 3|| temp[7] == 4))
		return true;

	return false;
}

//ÇÏÀÌÆÛ ¸µÅ© ºÎºÐ¿¡ <a href="javascript:catalog_open('Ä«´Þ·Î±× ÀÌ¸§');"> À» ÀÛ¼º
function catalog_open(ecatalog_name){
	var win = window.open("http://www.n-catalog.com/album_db/main_album.htm?ecatalog_name="+ecatalog_name,"wCatalog","width=1024,height=768,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	win.focus();
}


//ÇØ´ç ÀÌ¹ÌÁö¸¦ »õÃ¢ ¶ç¿ì´Â ½ºÅ©¸³Æ® »ç¿ë¹ý : onclick=OpenImage(this.src)
function OpenImage(s){
	srcImg = new Image();
	clientWidth = screen.width;
	clientHeight = screen.height;
	srcImg.src = s;
	
	// ¿­·Á´Â ÆÄÀÏÀ» ÀÌ¸§
	var srcFileName = srcImg.src.substr(srcImg.src.lastIndexOf("/")+1, srcImg.src.length);

	// »õÃ¢ ¶ç¿ì°í ÀÌ¹ÌÁö »ðÀÔ
	win = window.open("","","width=15,height=15,scrollbars=no,resizable=no,left="+(clientWidth/2-15)+",top="+(clientHeight/2-15)+"");
	win.document.writeln("<html>");
	win.document.writeln("<head>");
	win.document.writeln("<title>"+document.title+" ["+srcFileName+"]</title>");
	win.document.writeln("</head>");
	win.document.writeln("<body style='margin:0px;' bgcolor='#333333'>");
	win.document.writeln("<table border='0' cellpadding='0' cellspacing='0' style='cursor:hand' onclick='self.close()'>");
	win.document.writeln(" <tr>");
	win.document.writeln("  <td align='center'><img src="+s+" name='winImg' style='cursor:hand' onclick='self.close()' alt='Å¬¸¯ÇÏ¸é »ç¶óÁý´Ï´Ù'></td>");
	win.document.writeln(" </tr>");
	win.document.writeln("</table>");
	win.document.writeln("</body>");
	win.document.writeln("</html>");

	srcImg = win.document.winImg;

	// ÀÌ¹ÌÁö°¡ ¸ðµÎ ·ÎµùµÉ¶§±îÁö ±â´Ù¸²
	while(true)
			if(srcImg.readyState == "complete")
					break;
	
	// »õÃ¢ÀÇ Å©±â ¼³Á¤
	var winWidth = srcImg.width+10;
	var winHeight = srcImg.height+29;

	// »õÃ¢ÀÌ ¶ç¿öÁú À§Ä¡ ¼³Á¤
	var left = (clientWidth/2)-(srcImg.width/2);
	var top = (clientHeight/2)-(srcImg.height/2);

	// ÀÌ¹ÌÁöÀÇ Å©±â overflow È®ÀÎÈÄ »õÃ¢ÀÇ Å©±â¿Í À§Ä¡ Àç¼³Á¤
	if(clientWidth <= srcImg.width){
			winWidth = clientWidth;
			left = 0;
			win.document.body.scroll = "auto";
	}
	if(clientHeight <= srcImg.height){
			winHeight = clientHeight-30;
			top = 0;
			win.document.body.scroll = "auto";
	}
	// ÀÌ¹ÌÁö·ÎµùÀÌ ³¡³µÀ½À¸·Î ÀÌ¹ÌÁöÀÇ Å©±â¸¦ »ç¿ëÇÒ¼ö ÀÖ´Ù.
	// ÇØ´ç ÀÌ¹ÌÁöÀÇ »çÀÌÁî¿¡ ¸Â°Ô À©µµ¿ì¸¦ Àç¼³Á¤ÇÑ´Ù.
	win.moveTo(left, top);
	win.resizeTo(winWidth, winHeight);
}

function adminOpen(){
	var win = window.open("/admin/login.htm","Admin","width=990,height=800,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	win.focus();
}

//¿ìÆí¹øÈ£Ã£±â
function getPostInfo(return_post1,return_post2,return_addr1){
	var f = document.frm;
	var pop_add = '../../core_post/pop_adresscheck.php?return_post1='+return_post1+'&return_post2='+return_post2+'&return_addr1='+return_addr1;

	window.open(pop_add,"post_search_pop","toolbar=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=1, width=400, height=283,top=300,left=400").focus();
}
