	/************************************************
	 * 이미지 뷰어                                  *
	 ************************************************
	 * Code by 윤석재(Nios)                         *
	 * Version : 1.01                               *
	 * Last Modified : 2004-05-19                   *
	 ************************************************/
	 
	
	var intX, intY = false;
	var zoom_factor = 1.4;
	var zoom_size = 0;

	function centering(id){
		
		document.getElementById(id).scrollLeft = document.getElementById(id).scrollWidth / 2 - document.getElementById(id).clientWidth / 2;
		document.getElementById(id).scrollTop = document.getElementById(id).scrollHeight / 2 - document.getElementById(id).clientHeight / 2;
	}

	function zoomin(id){
		if(zoom_size==0)
			zoom_size = document.getElementById(id).width / zoom_factor;
		document.getElementById(id).width = document.getElementById(id).width * zoom_factor;
	}

	function zoomout(id){
		if(zoom_size==0)
			zoom_size = document.getElementById(id).width / zoom_factor;
		document.getElementById(id).width = document.getElementById(id).width / zoom_factor;
	}

	function zoomall(id){
		var win = window.open("preview_image.asp?src=" + document.getElementById(id).src,"carom2004_preview_image","width=300,height=300,toolbars=no,scrollbars=yes,top=0,left=0");
	}

	function onDown(id){
		id.style.cursor = "move";
		intX = event.clientX;
		intY = event.clientY;
	}

	function onUp(id){
		id.style.cursor = "hand";
	}

	function onMove(id){
		if(event.button == 1){
			id.style.cursor = "move";
			id.scrollLeft = id.scrollLeft - (event.clientX - intX);
			intX = event.clientX;
			id.scrollTop = id.scrollTop - (event.clientY - intY);
			intY = event.clientY;
		}
	}

	function create_image_viewer(id,src,imgpath, width, height){
		document.writeln("<div id=" + id + " style='border:1px #ABABAB solid; overflow:auto;left:0px;top:0px;width:" + width + "px;height:" + height + "px;cursor:hand;' onmousemove=onMove(this); ondrag='return false;' onselectstart='return false' onmousedown=onDown(this); onmouseup=onUp(this); align=center><img onload=centering('" + id + "'); id=" + id + "_img src=\"" + src + "\"></div><table width=100%><tr><td align=center><img src=" + imgpath + "btn_zoomin.gif onclick=zoomin('" + id + "_img') style=cursor:hand;> <img src=" + imgpath + "btn_zoomout.gif onclick=zoomout('" + id + "_img') style=cursor:hand;> <img src=" + imgpath + "btn_zoomall.gif onclick=zoomall('" + id + "_img') style=cursor:hand;></td></tr></table>\n");
	}
