	 
		
		//³υΚΌ»―
		function init_crop1()
		{
			
			var divPic = $("imgthis");
			Resize.init(topLeft1, divCrop1, 0, constrain, 30, 35, 480, 560);
			Resize.init(bottomLeft1, divCrop1, 1, constrain, 30, 35, 480, 560);
			Resize.init(topRight1, divCrop1, 2, constrain, 30, 35, 480, 560);
			Resize.init(bottomRight1, divCrop1, 3, constrain, 30, 35, 480, 560);
			divCrop1.style.left = (getLeft()+98) + "px";
			divCrop1.style.top = (getTop()+ 159) + "px"  ;
		 	divCrop1.style.width	= 100;
			divCrop1.style.height	= 100;
			$("imgthis2").style.width=100;
	        $("imgthis2").style.height=100;
			/*
			divCrop1.style.left = (getLeft()+$("imgthis").width/4) + "px";
			divCrop1.style.top = (getTop()+ $("imgthis").height/4) + "px"  ;
		 	divCrop1.style.width	= $("imgthis2").clientWidth;
			divCrop1.style.height	= $("imgthis2").clientHeight;*/
			window.status = $("imgthis2").clientWidth;
			divCrop1.onResize = function(x,y, mousex, mousey) {
			    var divPic = $("imgthis");
				var t = getTop();//parseInt(divPic.offsetTop);
				var l = getLeft(); //parseInt(divPic.offsetLeft);
				t=t-100
				l=l-100
				if (1==2)
				{
					if (x + divCrop1.offsetWidth > l + divPic.offsetWidth) {
						x = l + divPic.offsetWidth - divCrop1.offsetWidth;
						divCrop1.style.left = x + "px";
					}
					if (x < l) {
						x = l;
						divCrop1.style.left = x + "px";
					}
					if (y + divCrop1.offsetHeight > t + divPic.offsetHeight) {
						y = t + divPic.offsetHeight - divCrop1.offsetHeight;
						divCrop1.style.top = y + "px";
					}
					if (y < t) {
						y = t;
						divCrop1.style.top = y + "px";
					}
				
				//02-24
				if (divCrop1.offsetHeight > $("imgthis").offsetHeight) {
			
			        
					divCrop1.style.height = ($("imgthis").offsetHeight-7) + "px";
			
				}
				}
				setClipPos1();
			}
			Drag.init(divCropDrag1, divCrop1);
 			divCrop1.onDrag = function(x,y, mousex, mousey) {
	 			 var divPic = $("imgthis");
	 			 if (1==2)
				{
				var t = getTop();//parseInt(divPic.offsetTop);
				var l = getLeft(); //parseInt(divPic.offsetLeft);
				if (x + divCrop1.offsetWidth > l + divPic.offsetWidth) {
					x = l + divPic.offsetWidth - divCrop1.offsetWidth;
				}
				if (x < l) {
					x = l;
				}
				 
				if (y + divCrop1.offsetHeight > t + divPic.offsetHeight) {
					y = t + divPic.offsetHeight - divCrop1.offsetHeight;
				}
				if (y < t) {
					y = t;
				}
					}
				
				divCrop1.style.left = x + "px";
				divCrop1.style.top = y + "px";
				setClipPos1();
			}
		} 
		 
	
	function $() {
			var elements = new Array();

			for (var i = 0; i < arguments.length; i++) {
				var element = arguments[i];
				if (typeof element == 'string')
				element = document.getElementById(element);

				if (arguments.length == 1) 
				return element;

				elements.push(element);
			}

			return elements;
		}
		
		function getClipPos() {
			var t = (divPic.offsetTop);
			var l = (divPic.offsetLeft);
			var top = divCrop.offsetTop-t;
			var right = divCrop.offsetLeft+divCrop.offsetWidth-l;
			var bott = divCrop.offsetTop+divCrop.offsetHeight-t;
			var left = divCrop.offsetLeft-l;
			return {t:top,r:right,b:bott,l:left};
		}
		
		function setClipPos() {
			try
			{
			 
			var t = (divPic.offsetTop);
			var l = (divPic.offsetLeft);
			var top = divCrop.offsetTop-t;
			var right = divCrop.offsetLeft+divCrop.offsetWidth-l;
			var bott = divCrop.offsetTop+divCrop.offsetHeight-t;
			 
			var left = divCrop.offsetLeft-l;
			var r = {t:top,r:right,b:bott,l:left};
			var rect = "rect("+r.t+","+r.r+","+r.b+","+r.l+")";
			//divPic.style.clip = rect;
			var sc = 140/divCrop.offsetHeight;
			//picRes.style.zoom = (sc*100)+"%";
			 
			divRes.scrollTop = r.t*sc;
			divRes.scrollLeft = r.l*sc;
			
		    }
		    catch (e) {}
		}
		
		function getClipPos1() {
		    var divPic = $("imgthis");
			var t = (divPic.offsetTop);
			var l = (divPic.offsetLeft);
			var top = divCrop1.offsetTop-t;
			var right = divCrop1.offsetLeft+divCrop1.offsetWidth-l;
			var bott = divCrop1.offsetTop+divCrop1.offsetHeight-t;
			var left = divCrop1.offsetLeft-l;
			return {t:top,r:right,b:bott,l:left};
		}
		
		function setClipPos1() {
			try
			{
			    var divPic = $("imgthis");
				var t = (divPic.offsetTop);
				var l = (divPic.offsetLeft);
				var top = divCrop1.offsetTop-t;
				var right = divCrop1.offsetLeft+divCrop1.offsetWidth-l;
				var bott = divCrop1.offsetTop+divCrop1.offsetHeight-t;
				var left = divCrop1.offsetLeft-l;
				var r = {t:top,r:right,b:bott,l:left};
				var rect = "rect("+r.t+","+r.r+","+r.b+","+r.l+")";
				//divPic.style.clip = rect;
				
				$("imgthis2").style.width = divCrop1.clientWidth;
				$("imgthis2").style.height= divCrop1.clientHeight;
				//alert(divCrop1.clientWidth)
				//var sc = 140/divCrop1.offsetHeight;
				//picRes.style.zoom = (sc*100)+"%";
			 
		    }
		    catch (e) {}
		}
		
		function setClipPos2() {
			try
			{
			    var divPic = $("imgthis");
				var t = (divPic3.offsetTop);
				var l = (divPic3.offsetLeft);
				var top = divCrop3.offsetTop-t;
				var right = divCrop3.offsetLeft+divCrop3.offsetWidth-l;
				var bott = divCrop3.offsetTop+divCrop3.offsetHeight-t;
				var left = divCrop3.offsetLeft-l;
				var r = {t:top,r:right,b:bott,l:left};
				var rect = "rect("+r.t+","+r.r+","+r.b+","+r.l+")";
				//divPic.style.clip = rect;
				
				$("imgthis").style.width = divCrop3.clientWidth;
				$("imgthis").style.height= divCrop3.clientHeight;
				//alert(divCrop1.clientWidth)
				//var sc = 140/divCrop1.offsetHeight;
				//picRes.style.zoom = (sc*100)+"%";
			 
		    }
		    catch (e) {}
		}
		
		function setClipPos3() {
			try
			{
			    var divPic = $("imgthis");
				var t = (divPic4.offsetTop);
				var l = (divPic4.offsetLeft);
				var top = divCrop4.offsetTop-t;
				var right = divCrop4.offsetLeft+divCrop4.offsetWidth-l;
				var bott = divCrop4.offsetTop+divCrop4.offsetHeight-t;
				var left = divCrop4.offsetLeft-l;
				var r = {t:top,r:right,b:bott,l:left};
				var rect = "rect("+r.t+","+r.r+","+r.b+","+r.l+")";
				//divPic.style.clip = rect;
				
				$("imgthis").style.width = divCrop4.clientWidth;
				$("imgthis").style.height= divCrop4.clientHeight;
				//alert(divCrop1.clientWidth)
				//var sc = 140/divCrop1.offsetHeight;
				//picRes.style.zoom = (sc*100)+"%";
			 
		    }
		    catch (e) {}
		}
		
		//-------------------------------------------------------------------
//Drag Object
var Drag={
	"obj":null,
	"init":function(a, aRoot){
			a.onmousedown=Drag.start;
			a.root = aRoot;
			if(isNaN(parseInt(a.root.style.left)))a.root.style.left="0px";
			if(isNaN(parseInt(a.root.style.top)))a.root.style.top="0px";
			a.root.onDragStart=new Function();
			a.root.onDragEnd=new Function();
			a.root.onDrag=new Function();
		},
	"start":function(a){
			window.event.cancelBubble = true;
			var b=Drag.obj=this;
			a=Drag.fixE(a);
			var c=parseInt(b.root.style.top);
			var d=parseInt(b.root.style.left);
			b.root.onDragStart(d,c,a.clientX,a.clientY);
			b.lastMouseX=a.clientX;
			b.lastMouseY=a.clientY;
			document.onmousemove=Drag.drag;
			document.onmouseup=Drag.end;
			return false;
		},	
	"drag":function(a){
			a=Drag.fixE(a);
			var b=Drag.obj;
			var c=a.clientY;
			var d=a.clientX;
			var e=parseInt(b.root.style.top);
			var f=parseInt(b.root.style.left);
			var h,g;
			h=f+d-b.lastMouseX;
			g=e+c-b.lastMouseY;
			b.root.style.left=h+"px";
			b.root.style.top=g+"px";			
			b.lastMouseX=d;
			b.lastMouseY=c;
			b.root.onDrag(h,g,a.clientX,a.clientY);
			return false;
		},
	"end":function(){			
			document.onmousemove=null;
			document.onmouseup=null;
			Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style.left),parseInt(Drag.obj.root.style.top));
			Drag.obj=null;
		},
	"fixE":function(a){
			if(typeof a=="undefined")a=window.event;
			if(typeof a.layerX=="undefined")a.layerX=a.offsetX;
			if(typeof a.layerY=="undefined")a.layerY=a.offsetY;
			return a;
		}
};
		
		//-------------------------------------------------------------------
//Resize Object
var Resize={
        "obj":null,
	"init":function(a, aRoot, direct, constrain, minw, minh, maxw, maxh){
			

			a.onmousedown=Resize.start;
			
			a.root = aRoot;
			a.direct = direct;	// 0-NW 1-SW 2-NE 3-SE
			a.constrain = constrain;
			if (minw) a.minw = minw;
			if (minh) a.minh = minh;
			if (maxw) a.maxw = maxw;
			if (maxh) a.maxh = maxh;
			if(isNaN(parseInt(a.root.style.left)))a.root.style.left="0px";
			if(isNaN(parseInt(a.root.style.top)))a.root.style.top="0px";
			a.root.onResizeStart=new Function();
			a.root.onResizeEnd=new Function();
			a.root.onResize=new Function();
		},
	"start":function(a){
			window.event.cancelBubble = true;
			var b=Resize.obj=this;
			a=Resize.fixE(a);
			var c=parseInt(b.root.style.top);
			var d=parseInt(b.root.style.left);
			b.root.onResizeStart(d,c,a.clientX,a.clientY);
			b.lastMouseX=a.clientX;
			b.lastMouseY=a.clientY;
			document.onmousemove=Resize.resize;
			document.onmouseup=Resize.end;
			return false;
		},	
	"resize":function(a){
			a=Resize.fixE(a);
			var b=Resize.obj;
			var c=a.clientY;
			var d=a.clientX;
			var e=parseInt(b.root.style.top);
			var f=parseInt(b.root.style.left);
			var wt=parseInt(b.root.style.width);
			var ht=parseInt(b.root.style.height);
			var h,g,hh,ww;
			h=f+d-b.lastMouseX;
			g=e+c-b.lastMouseY;
			window.status = b.direct
			switch (b.direct) {
				case 0:
					var cx = (b.lastMouseX-d);
					var cy = (b.lastMouseY-c);
					var hh = (ht+cy);
					if (b.minh && hh < b.minh) {
						hh = b.minh;
					}
					if (b.maxh && hh > b.maxh) {
						hh = b.maxh;
					}
					//var ww = Math.floor(hh*b.constrain);
					var ww;
					if ( constrain==-1 )
					{
					 
						ww =(wt + cx);
					}
					else
					{
						ww = Math.floor(hh*b.constrain);
					}
					window.status = ww;
					b.root.style.height = hh+"px";
					b.root.style.width = ww+"px";
					b.root.style.left=h+"px";
					b.root.style.top=g+"px";
					
					break;
				case 1:
					var cx = (b.lastMouseX-d);
					var cy = (b.lastMouseY-c);
					var hh = (ht-cy);
					if (b.minh && hh < b.minh) {
						hh = b.minh;
					}
					if (b.maxh && hh > b.maxh) {
						hh = b.maxh;
					}
					
					var ww;
					if ( constrain==-1 )
					{
						ww =wt+ cx;
					}
					else
					{
						ww = Math.floor(hh*b.constrain);
					}
					
					b.root.style.height = hh+"px";
					b.root.style.width = ww+"px";

					b.root.style.left=h+"px";
					break;
				case 2:
					var cx = (b.lastMouseX-d);
					var cy = (b.lastMouseY-c);
					var hh = (ht+cy);
					if (b.minh && hh < b.minh) {
						hh = b.minh;
					}
					if (b.maxh && hh > b.maxh) {
						hh = b.maxh;
					}
					
					var ww;
					if ( constrain==-1 )
					{
						ww =wt - cx;
					}
					else
					{
						ww = Math.floor(hh*b.constrain);
					}
					
					b.root.style.height = hh+"px";
					b.root.style.width = ww+"px";

					b.root.style.top=g+"px";
					break;
				case 3:
					var cx = (b.lastMouseX-d);
					var cy = (b.lastMouseY-c);
					var hh = (ht-cy);
					if (b.minh && hh < b.minh) {
						hh = b.minh;
					}
					if (b.maxh && hh > b.maxh) {
						hh = b.maxh;
					}
					var ww;
					if ( constrain==-1 )
					{
						ww =wt - cx;
					}
					else
					{
						ww = Math.floor(hh*b.constrain);
					}
					b.root.style.height = hh+"px";
					b.root.style.width = ww+"px";

					break;
			}
			b.lastMouseX=d;
			b.lastMouseY=c;
			b.root.onResize(h,g,a.clientX,a.clientY);
			return false;
		},
	"end":function(){			
			document.onmousemove=null;
			document.onmouseup=null;
			Resize.obj.root.onResizeEnd(parseInt(Resize.obj.root.style.left),parseInt(Resize.obj.root.style.top));
			Resize.obj=null;
		},
	"fixE":function(a){
			if(typeof a=="undefined")a=window.event;
			if(typeof a.layerX=="undefined")a.layerX=a.offsetX;
			if(typeof a.layerY=="undefined")a.layerY=a.offsetY;
			return a;
		}
};

