// ¾ÆÀÌÇÁ·¡ÀÓ
function iframe_autoresize(arg) {
    arg.height = eval(arg.name+".document.body.scrollHeight");
}

// °øÁö ÆË¾÷Ã¢À» ¶ç¿î´Ù.
function popUpWindow(htmlvalue,names, width, Height, top, left, scrollbar,resizable) { 
	if(top == "") top='0';
	if(left == "") left='0';
	if(scrollbar == "") scrollbar='no';
	if(resizable == "") resizable='no';
	window.open (htmlvalue, names, "scrollbars="+ scrollbar+", resizable="+ resizable+", width=" + width + ", height=" + Height + ",top=" + top + ",left=" + left + ", toolbar=no, location=no, directories=no, status=no, copyhistory=no, menubar=no");
}

// Get ¹æ½ÄÀ¸·Î »çÀÌÆ®¸¦ ÀÌµ¿ ½ÃÄÑÁØ´Ù.
function goURL(gURL,message) {
	
	if(message != "") {
		if(confirm(message)) {
			location.href=gURL;
			return;
		} else {
			return;
		}
	}
	
	document.location=gURL;
}


// Post ¹æ½ÄÀ¸·Î »çÀÌÆ®¸¦ ÀÌµ¿ ½ÃÄÑÁØ´Ù.
function goURLPost(gURL,message) {
	
	if(message != "") {
		if(confirm(message)) {
			postFormAction(gURL);
			return;
		} else {
			return;
		}
	}
	postFormAction(gURL);
}

// Get ¹æ½ÄÀÇ URL À» ºÐ¼®ÇÏ¿© Post ¹æ½ÄÀÇ Form À¸·Î Àü¼ÛÇÑ´Ù.
function postFormAction(gURL) {
	tempgURL_array = gURL.split("?");	// »çÀÌÆ® URL °ú ÆÄ¶ó¸ÞÅ¸º¯¼ö¸¦ ºÐ¸®ÇÑ´Ù.
	tmpURL = tempgURL_array[0];		// »çÀÌÆ® URL
	tmpPara = tempgURL_array[1];	// ÆÄ¶ó¸ÞÅ¸º¯¼ö
	writeform = "<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>";
	writeform = writeform + "<form name='autopost_form' action='"+tmpURL+"' method='post'>\n";
	if(tmpPara != "" && tmpPara != null) {
		tmpPara_array = tmpPara.split("&");	// ÆÄ¶ó¸ÞÅ¸º¯¼ö ¹è¿­
		for(i=0;tmpPara_array.length > i;i++) {
			para = tmpPara_array[i];
			para_array = para.split("=");	// ÆÄ¶ó¸ÞÅ¸ÀÇ ÀÌ¸§°ú °ªÀ» ³ª´«´Ù.
			writeform = writeform + "<input type='hidden' name='"+para_array[0]+"' value='"+para_array[1]+"'>\n";
		}
	}
	writeform = writeform + "</form>\n";
	writeform = writeform + "<script>document.autopost_form.submit();</script>\n";
	
	document.write(writeform);
}


/*
ÀÌ¹ÌÁö¸¦ ÆË¾÷À¸·Î ¶Ù¿ì°í Ã¢º¸´Ù ÀÌ¹ÌÁö°¡ Å¬°æ¿ì µå·¡±×ÇÏ¿© º¸±â°¡ °¡´ÉÇÏ´Ù.
imgpath : ÀÌ¹ÌÁö °æ·Î
wintitle : ÀÌ¹ÌÁö ÆË¾÷Ã¢ÀÇ Å¸ÀÌÆ² ÀÌ¸§
*/
function popupImageView(imgpath,wintitle) {
	// ÀÌ¹ÌÁö Á¤º¸¸¦ °¡Á®¿À±âÀ§ÇÑ ÀÌ¹ÌÁö°´Ã¼ »ý¼º
	var imageobj = new Image();
	imageobj.src = imgpath;
	
	img_width = imageobj.width;
	img_height = imageobj.height;
	
	
	winhtml = "<html>";
	winhtml += "<head>";
	winhtml += "<title>" + wintitle + "</title>";
	winhtml += "<script>";
	winhtml += "function winResize(){";
	winhtml += "	var bodyobj=document.body;";
	winhtml += "	var imageobj = document.images[0];";
	winhtml += "	img_width = imageobj.width;";
	winhtml += "	img_height = imageobj.height;";
	winhtml += "	rewidth=img_width-bodyobj.clientWidth;";
	winhtml += "	reheight=img_height-bodyobj.clientHeight-15;";
	winhtml += "	window.resizeBy(rewidth,reheight);";
	winhtml += "}";
	winhtml += "\n";
	winhtml += "var sx=0;";
	winhtml += "var sy=0;";
	winhtml += "document.onmousedown = dset;";
	winhtml += "function dset() {";
	winhtml += "	sx = event.x;";
	winhtml += "	sy = event.y;";
	winhtml += "}";
	winhtml += "\n";
	winhtml += "function imgmove() {";
	winhtml += "	dx = event.x;";
	winhtml += "	dy = event.y;";
	winhtml += "	mx =  sx - dx;";
	winhtml += "	my =  sy - dy;";
	winhtml += "	sx =  dx;";
	winhtml += "	sy =  dy;";
	winhtml += "	window.scrollBy(mx,my);";
	winhtml += "}";
	winhtml += "</"+"script>";
	winhtml += "</head>";
	winhtml += "<body style='margin:0' Onload='winResize()'>";
	winhtml += "<a style='cursor:move' Ondrag='imgmove();'><img src='" + imgpath + "' border=0 OnClick='window.close();'></a></body></html>";
	
	winobj = window.open("about:blank","","scrollbars=yes,status=yes,resizable=yes,width="+img_width+",height="+img_height+"");
	winobj.document.open("text/html", "replace");
	winobj.document.write(winhtml);
	winobj.document.close();
}
