var LightBox = 		{
			
			close : function()
				{
					this.stage.remove();
				},
			init : function(config)
				{
					// lo = literal object
					// jo = jQuery object
					// de = dom element
					// s = string
					// n = number
					// a = array
					// f = function
					
					// sc = simple config
					// db = database : jQuery select may be including > 1 element, so db is for init. the elements and store the related attibutes, configs or anything else in array or object
				
					var THIS = this,
						s_selector			= "HS-LightBox",
						s_selector_re		= new RegExp(""+s_selector+"{1,}\\\[([\\\[a-zA-Z0-9_\.\\\-\/:\?=\&,%\\\]]{1,})\\\]","g"),
						jo_selectedTarget	= jQuery(".[class*="+s_selector+"]").filter(function()	{	return !!(jQuery(this).attr("class").match(s_selector_re));	}),
						n_selectedTarget	= jo_selectedTarget.length,
						
						a_groupIDs			= [],
						db_array			= [],
						db_literalObject	= {}
						;
							db_literalObject.whole 	= [];
							db_literalObject.single = [];
							db_literalObject.group 	= [];
					
					
// 01. Scan Page "elements" & copy related attributes and objects as array and into domElement as object
(function()
	{
		var debug = [];
		jo_selectedTarget.each(function(index,domElement)
			{
				var jTHIS 			= jQuery(this),
					s_clsName		= jTHIS.attr("class"),
					s_selector		= s_clsName.match(s_selector_re),
					a_sc_inSelector	= hs_array.getIndex(s_selector,[","]),
					n_selector_length = a_sc_inSelector.length,
					s_href			= jTHIS.attr("href"),
					s_type			= hs_array.getArrayName(a_sc_inSelector[0])[1],
					var3,
					var3_indentifier,
					var3_content
					;
					
					debug.push(a_sc_inSelector.length);
					db_array.push([jTHIS,a_sc_inSelector,s_href]);
					
					
					if(db_literalObject[s_type][a_sc_inSelector[1]] == undefined)
					db_literalObject[s_type][a_sc_inSelector[1]] = [];
					
					if(db_literalObject[s_type][a_sc_inSelector[1]].self == undefined)
					db_literalObject[s_type][a_sc_inSelector[1]].self = [];
					
					if(db_literalObject[s_type][a_sc_inSelector[1]].triggerID == undefined)
					db_literalObject[s_type][a_sc_inSelector[1]].triggerID = [];
					
					//db_literalObject[s_type][a_sc_inSelector[1]].push([jTHIS,a_sc_inSelector,s_href]);
					
					domElement.type = s_type;
					domElement.asThumb = "true";
						
						if(n_selector_length >=3)
						{
							for(var i=2;i<n_selector_length;i++)
							{
								var3 = a_sc_inSelector[i];
								
								try{var3_indentifier = hs_array.getArrayName(var3)[1];} catch(ex)	{}
								
								if(var3_indentifier == "detail")
								{
									var3_content = hs_array.getIndex(var3,[","]);
									var3_content[0] = var3_content[0].split(":");
									var3_content[1] = var3_content[1].split(":");
									
									domElement.info_titleID = var3_content[0][1];
									domElement.info_descriptionID = var3_content[1][1];
								}
								else if(var3_indentifier == "asThumb")
								{
									var3_content = hs_array.getIndex(var3,[","]);
									domElement.asThumb = var3_content[0];
								}
								else if(var3_indentifier == "selfID")
								{
									var3_content = hs_array.getIndex(var3,[","]);
									db_literalObject[s_type][a_sc_inSelector[1]].self[var3_content[0]] = jTHIS;
								}
								else if(var3_indentifier == "triggerID")
								{
									var3_content = hs_array.getIndex(var3,[","]);
									domElement.triggerID = var3_content[0];
								}
								
							}
						}
						
						domElement.groupID_IDs = [];
						
						db_literalObject[s_type][a_sc_inSelector[1]].push([jTHIS,a_sc_inSelector,s_href]);
						if(s_type == "group")
						{
							domElement.groupName 	= a_sc_inSelector[1];
							domElement.groupID 		= db_literalObject[s_type][a_sc_inSelector[1]].length-1;
							
							domElement.isImageThumb = jTHIS.children("img").length>=1?true:false;
							
								if(domElement.isImageThumb)
								{
									domElement.srcImageThumb = jTHIS.children("img").first().attr("src");
								}
						}
						
						//hs_debug.show(hs_array.parse_array(db_literalObject[s_type][a_sc_inSelector[1]].self),true);
						//hs_debug.show(hs_array.parse_array(db_literalObject[s_type][a_sc_inSelector[1]].triggerID),true);
						
						//hs_debug.show(domElement.groupID,true);
						
					domElement.href = s_href;
					
			});
					//hs_debug.show(hs_array.parse_array(a_groupIDs),true);
					
	})();
					
// 02. 
(function()
{	
	// ! init !
	var lo_html = {}, lo_body = {}, lo_global = {};
		
		lo_global.imageSize_storage = {};
		
		lo_global.loading_imgElement_size = [50,50];
		lo_global.loading_imgElement = "<img src='img/loading.gif' border='0' width='"+lo_global.loading_imgElement_size[0]+"' height='"+lo_global.loading_imgElement_size[1]+"'/>";
		
	// 02a. initial object event
	lo_global.firstTarget = db_array[0][0];
	(function()
	{
		var i,de_target;	
			
		for(i=0;i<n_selectedTarget;i++)
		{	
			
			de_target = db_array[i][0];
			de_target.bind("click",function(e)
				{
					var jTHIS = jQuery(this),
						type = jTHIS[0].type,
						groupName = jTHIS[0].groupName,
						triggerID,
						showTarget = jTHIS;
						;
						
						triggerID = jTHIS[0].triggerID;
						
						try	{
						if(triggerID)
						showTarget = db_literalObject[type][groupName].self[triggerID];
							} catch(ex)
							{
								
							}
					e.preventDefault();
					
					//hs_restrict.disable_selection(lo_body.self);
					hs_restrict.disable_drag(lo_body.self);
					
					// using HSJs to create lightBox background
					//lo_global.lightBox_background = hs_dom.lightBox_background({backgroundColor:"#000000",opacity:.5});
					
					// using global call functions
					lo_global.f_create_lightBox(showTarget);
					
				});
		};
		
		
		
	})();
							
	// 02b. initial general object
	(function()
	{	
		var jo_html_Target = jQuery("html"),
			jo_body_target = jQuery("body");
		lo_html.self 		= jo_html_Target;
		lo_html._width 		= jo_html_Target.width();
		lo_html._height 	= jo_html_Target.height();
		lo_html._sWidth 	= jo_html_Target[0].scrollWidth;
		lo_html._sHeight 	= jo_html_Target[0].scrollHeight;
		lo_html._cWidth 	= jo_html_Target[0].clientWidth;
		lo_html._cHeight 	= jo_html_Target[0].clientHeight;
	
		lo_body.self = jo_body_target;
		lo_body._width 		= jo_body_target.width();
		lo_body._height 	= jo_body_target.height();
		lo_body._sWidth 	= jo_body_target[0].scrollWidth;
		lo_body._sHeight 	= jo_body_target[0].scrollHeight;
		lo_body._cWidth 	= jo_body_target[0].clientWidth;
		lo_body._cHeight 	= jo_body_target[0].clientHeight;
		
	})();

	// function: lightBox close						
	lo_global.f_close_lightBox = function()
	{	
		lo_global.jo_lightBox_infoPanel.stop().animate({bottom:-25},{duration:300,queue:false,complete:function()	
		{
			jQuery(this).remove();
			
			lo_global.jo_lightBox_eastPanel.stop().animate({right:lo_global.jo_lightBox_eastPanel.width() * -1},{duration:300,queue:false,complete:function()	{
				jQuery(this).remove();
			}});
			
			lo_global.jo_lightBox_introPanel.stop().animate({opacity:0},{duration:300,queue:false,complete:function()	{
				jQuery(this).remove();
			}});
			
			lo_global.jo_lightBox_centerPanel.stop().animate({opacity:0},{duration:300,queue:false,complete:function()	{
				jQuery(this).remove();
					lo_global.jo_lightBox_outer.stop().animate({opacity:0},{duration:300,queue:false,complete:function()	{
						jQuery(this).remove();
					}});
					lo_global.lightBox_background.stop().animate({opacity:0},{duration:300,queue:false,complete:function()	{jQuery(this).remove();}})
					
					
				
			}});
		}});
	};
							
	// function: lightBox apply loading element
	lo_global.f_loading = function(applyTo,simpleConfig)
	{
		simpleConfig = !simpleConfig?{}:simpleConfig;
			simpleConfig.cssStyle_position = !simpleConfig.cssStyle_position?"relative":simpleConfig.cssStyle_position;
		lo_global.jo_loadingPanel = hs_dom.append(applyTo,"<div>"+lo_global.loading_imgElement+"</div>");
		lo_global.jo_loadingPanel.css({position:"relative",top:0,left:0,margin:"auto",overflow:"hidden",width:lo_global.loading_imgElement_size[0],height:lo_global.loading_imgElement_size[1]});
		lo_global.jo_loadingPanel_family = hs_dom.vAlign(lo_global.jo_loadingPanel);
		
		lo_global.jo_loadingPanel = lo_global.jo_loadingPanel_family.self;
		 
		return lo_global.jo_loadingPanel;
	};
							
	// function: lightBox object transform
	lo_global.objectTransform = function(index)
	{
		lo_global.centerLoading.css({opacity:1});
		
		var db_thumb = db_literalObject[lo_global.jTarget[0].type][lo_global.jTarget[0].groupName];
			db_thumb_length = db_thumb.length;
		
		var direction;
		if(index>=0 && index<db_thumb_length)
		{
			if(lo_global.jTarget[0].groupID < index)
			direction = "next";
			else if(lo_global.jTarget[0].groupID > index)
			direction = "prev";
		
			lo_global.jTarget = db_literalObject[lo_global.jTarget[0].type][lo_global.jTarget[0].groupName][index][0];
			if(lo_global.jTarget[0].asThumb == "false")
			{
				if(direction == "prev")
				{	
					lo_global.objectTransform(index - 1);
				}
				else if(direction == "next")
				{
					lo_global.objectTransform(index + 1);
				}
			}
			else
			{
			
		var href = db_literalObject[lo_global.jTarget[0].type][lo_global.jTarget[0].groupName][index][2];
			hs_image.imgLoaded(href,function(w,h)
			{	
			lo_global.centerLoading.stop().animate({opacity:0},{duration:1000,queue:false,complete:function()	{}});
		
				lo_global.f_initial_imageSize(w,h);

				// action [existing element]: hide>remove image>append new image element>reset style
				lo_global.jo_lightBox_imgPanel.stop().animate({opacity:0},{duration:300,queue:true,complete:function()	{
				
					lo_global.jo_lightBox_img.remove();
					lo_global.jo_lightBox_img = hs_dom.append(lo_global.jo_lightBox_imgPanel,"<img src='"+href+"' border='0'/>");
					lo_global.jo_lightBox_img.css({position:"absolute",left:0,top:0});
					
					lo_global.jo_lightBox_img.css({width:lo_global.imageSize_storage.fs[1],height:lo_global.imageSize_storage.fs[2],left:lo_global.imageSize_storage.fs_xyPos[0],top:lo_global.imageSize_storage.fs_xyPos[1]});
					
					lo_global.f_information();
					
					lo_global.f_load_detail(lo_global.jTarget);
					
				}}).animate({opacity:1},{duration:1000,queue:true,complete:function()	{}});;
			});
		}	};
	};
	
	// function: lightBox thumb list
	lo_global.thumbList = function()
	{
		var thumbList_array = db_literalObject[lo_global.jTarget[0].type][lo_global.jTarget[0].groupName],
			de_pilotElement = document.createElement("div");	// dom element
		
			de_pilotElement = hs_dom.append(lo_global.jo_lightBox_eastPanel,"<div></div>");	// jQuery object
			
			de_pilotElement.css({position:"relative",margin:"auto",width:120,height:"80%",overflow:"hidden"});
				
				var middle_height = de_pilotElement.height() - 46;
			lo_global.jo_thumbList_scrollUp = hs_dom.append(de_pilotElement,"<div><img src='scrollImage/scroll_thumb_small_01.png' border='0' width='120' height='23'/></div>");
			lo_global.jo_thumbList_scrollUp.css({position:"relative",top:0,left:0,	width:"100%",height:23,zIndex:100,cursor:"pointer"});
			
		
			//lo_global.jo_thumbList = hs_dom.append(jQuery(de_pilotElement),"<div></div>");
			lo_global.jo_thumbList = hs_dom.append(de_pilotElement,"<div></div>");
			lo_global.jo_thumbList.css({position:"relative",top:0,left:0,width:"100%",height:middle_height,overflow:"hidden",
				backgroundAttachment:"fixed",
				backgroundPosition:"50% 20%",
				backgroundRepeat:"repeat-x",
				backgroundImage:"url(scrollImage/scroll_thumb_small_02.png)"});
			
				
			
			lo_global.jo_thumbList_scrollDn = hs_dom.append(de_pilotElement,"<div><img src='scrollImage/scroll_thumb_small_03.png' border='0' width='120' height='23'/></div>");
			lo_global.jo_thumbList_scrollDn.css({position:"relative",top:0,left:0,	width:"100%",height:23,zIndex:100,cursor:"pointer"});
			
			
			var scrollNumber = lo_global.jo_thumbList.height();
			lo_global.jo_thumbList_scrollUp.bind("click",function(e)
				{
					lo_global.jo_thumbList.stop().animate({scrollTop:"-="+scrollNumber},{duration:1500,queue:false,easing:"swing",complete:function()	{}});
				});
			lo_global.jo_thumbList_scrollDn.bind("click",function(e)
				{
					lo_global.jo_thumbList.stop().animate({scrollTop:"+="+scrollNumber},{duration:1500,queue:false,easing:"swing",complete:function()	{}});
				});
			
			
			lo_global.jo_thumb = [];
			for(var i=0;i<thumbList_array.length;i++)
			{
				var jObject = thumbList_array[i][0],
						asThumb;
						
						
						
						if(jObject[0].asThumb != "true")
						continue;
						
				lo_global.jo_thumb[i] = hs_dom.append(lo_global.jo_thumbList,"<div></div>");
				lo_global.jo_thumb[i].css({position:"relative",width:120,height:130,overflow:"hidden"});
					
					
						//asThumb = thumbList_array[i][2];
						if(jObject[0].isImageThumb)
						asThumb = jObject[0].srcImageThumb;
						else
						asThumb = "img/image.png";
					
					// [0] => get(0) from jQuery
					lo_global.jo_thumb[i][0].jo_loading = lo_global.f_loading(lo_global.jo_thumb[i]);					
					lo_global.jo_thumb[i][0].jo_thumb 	= hs_dom.append(lo_global.jo_thumb[i],"<div><img src='"+asThumb+"' border='0'/></div>");			
					lo_global.jo_thumb[i][0].jo_thumb.hide();
					
					lo_global.jo_thumb[i][0].jo_thumb.css({position:"absolute",top:0,left:0,width:120,height:130,overflow:"hidden"});
					
					// copy groupID : [0] => get(0) from jQuery
					lo_global.jo_thumb[i][0].jo_thumb[0].groupID = thumbList_array[i][0][0].groupID;
					
					lo_global.jo_thumb[i][0].jo_thumb[0].isImageThumb = jObject[0].isImageThumb;
					
					var abc = "";
					hs_image.imgLoaded(lo_global.jo_thumb[i][0].jo_thumb.find("img"),function(w,h,literalObject)
					{
						var a_size = hs_image.img_scale(jQuery(literalObject.domElement),110,120,true,{sampleW:w,sampleH:h});
							jQuery(literalObject.domElement).css({width:a_size[0],height:a_size[1]});								

								jQuery(literalObject.domElement)[0]._width 	= a_size[0];
								jQuery(literalObject.domElement)[0]._height = a_size[1];
								
								//alert(a_size[0] +" - "+ jQuery(literalObject.domElement)[0]._width);
							literalObject.domElement.imageSize 		= [a_size[0],a_size[1]];
							literalObject.domElement.imageFamily 	= hs_dom.hvAlign(jQuery(literalObject.domElement));

							jQuery(literalObject.domElement_parent).show();
							jQuery(literalObject.domElement_parent).css({opacity:0});
							jQuery(literalObject.domElement_parent).stop().animate({opacity:1},{duration:600,queue:false,complete:function()	{}});

							if(!literalObject.domElement_parent.isImageThumb)
							{
							var mask = hs_image.imgMask(jQuery(literalObject.domElement));
								mask.css({cursor:"pointer"});
								mask.bind("click",function(){lo_global.objectTransform(literalObject.domElement_parent.groupID);});
							}
							else
							{
							var mask = hs_image.pngMask(jQuery(literalObject.domElement),"img/imageFrame.png",{x:6,y:6});
								mask.css({cursor:"pointer"});
								mask.bind("click",function(){lo_global.objectTransform(literalObject.domElement_parent.groupID);});
							}
							//var abc = htmlspecialchars(literalObject.domElement.imageFamily.family.outer.parent()[0].outerHTML);
								//hs_debug.show(abc,true);
							
							
					
					});
			};
	};
	
	// function: lightBox control buttons
	lo_global.f_controlButton = function()
	{
		
		lo_global.controlButtonPanel = hs_dom.append(lo_global.jo_lightBox_eastPanel,"<div></div>");
		lo_global.controlButtonPanel.css({position:"absolute",left:0,bottom:0,width:"100%",height:"20%",backgroundColor:"#ffffff",opacity:1});
		
		lo_global.controlButton =  hs_dom.append(lo_global.controlButtonPanel,"<div></div>");
		lo_global.controlButton.css({position:"relative"});
		
		
		lo_global.jo_control___zoomI 	= hs_dom.append(lo_global.controlButton,"<div><img src='img/zoomIn.png' border='0' 	width='42' height='42'/></div>");
		lo_global.jo_control___zoomO 	= hs_dom.append(lo_global.controlButton,"<div><img src='img/zoomOut.png' border='0' width='42' height='42'/></div>");
		lo_global.jo_control___zoomFs 	= hs_dom.append(lo_global.controlButton,"<div><img src='img/zoomFit.png' border='0' width='42' height='42'/></div>");
		lo_global.jo_control___zoomF100 = hs_dom.append(lo_global.controlButton,"<div><img src='img/zoom100.png' border='0' width='42' height='42'/></div>");
			
			hs_dom.append(lo_global.controlButton,"<div style='clear:both;'></div>");
			
		lo_global.jo_control___zoomI.css({		width:42,height:42,overflow:"hidden",float:"left",display:'block',margin:4});
		lo_global.jo_control___zoomO.css({		width:42,height:42,overflow:"hidden",float:"left",display:'block',margin:4});
		lo_global.jo_control___zoomFs.css({		width:42,height:42,overflow:"hidden",float:"left",display:'block',margin:4});
		lo_global.jo_control___zoomF100.css({	width:42,height:42,overflow:"hidden",float:"left",display:'block',margin:4});
		
		lo_global.controlButton.css({width:100,height:100});
		
		lo_global.controlButton.css({margin:"auto"});
	
		var abcccc = [];
		lo_global.f_control_zoom = function(mode,callback)
		{
			//hs_debug.show(1,true);
			lo_global.ioSize 	= [lo_global.imageSize_storage.f100[1],lo_global.imageSize_storage.f100[2]];
			lo_global.icSize 	= [lo_global.jo_lightBox_img.width(),lo_global.jo_lightBox_img.height()];
			lo_global.irsRate	= [lo_global.icSize[0]/lo_global.ioSize[0],lo_global.icSize[1]/lo_global.ioSize[1]];
			
			lo_global.ifSize	= [lo_global.imageSize_storage.fs[1],lo_global.imageSize_storage.fs[2]];
			
			var index_inPercentage = Math.round(lo_global.imageSize_storage.existing_size[0] * 100),
				size,xyPos,
				zoom
				;
			 
			if(hs_array.is_array(mode))
			{
				
				lo_global.imageSize_storage.existing_size 	= [mode[0],mode[1],mode[2]];
				lo_global.imageSize_storage.existing_xyPos	= [mode[3],mode[4]];
				lo_global.jo_lightBox_img.stop().animate({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]},{duration:600,queue:false,complete:function()	{}});
				//lo_global.jo_lightBox_img.css({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]});

			}else
			{
				
				if(mode == "+")
				{
					zoom = "In";
					index_inPercentage += 20;
				}
				else if(mode == "++")
				{
					zoom = "In";
					index_inPercentage += 2;
				}
				else if(mode == "+++")
				{
					zoom = "In";
					index_inPercentage += 5;
				}
				else if(mode == "-")
				{
					zoom = "Out";
					index_inPercentage -= 20;
				}
				else if(mode == "--")
				{
					zoom = "Out";
					index_inPercentage -= 2;
				}
				else if(mode == "---")
				{
					zoom = "Out";
					index_inPercentage -= 5;
				}
				
				index_inPercentage = index_inPercentage > 100 ? 100 : index_inPercentage;
				index_inPercentage = index_inPercentage < 0 ? 0 : index_inPercentage;
				
				size 	= lo_global.imageSize_storage.whole_size[index_inPercentage];
				xyPos 	= lo_global.imageSize_storage.whole_xyPos[index_inPercentage];
				
				
				
				if((size[1] < 100 || size[2] < 100) && (zoom == "Out"))
				{
					lo_global.imageSize_storage.existing_size 	= hs_image.img_scale_virtual([lo_global.imageSize_storage.f100[1],lo_global.imageSize_storage.f100[2]],[100,100]);
					lo_global.imageSize_storage.existing_xyPos 	= hs_cssStyle.hvAlignment_virtual(["center","middle"],[lo_global.imageSize_storage.existing_size[1],lo_global.imageSize_storage.existing_size[2]],lo_global.jo_lightBox_centerPanel_size);
					
					if(callback)
					callback();
				}
				else if(size[1] > lo_global.imageSize_storage.f100[1] || size[2] > lo_global.imageSize_storage.f100[2] || mode == "f100")
				{
					lo_global.imageSize_storage.existing_size 	= lo_global.imageSize_storage.f100;
					lo_global.imageSize_storage.existing_xyPos 	= lo_global.imageSize_storage.f100_xyPos;
					
					if(callback)
					callback();
				}
				else if(mode == "fs")
				{
					lo_global.imageSize_storage.existing_size 	= lo_global.imageSize_storage.fs;
					lo_global.imageSize_storage.existing_xyPos 	= lo_global.imageSize_storage.fs_xyPos;
					
					if(callback)
					callback();
				}
				else
				{	
					lo_global.imageSize_storage.existing_size 	= lo_global.imageSize_storage.whole_size[index_inPercentage];
					lo_global.imageSize_storage.existing_xyPos 	= lo_global.imageSize_storage.whole_xyPos[index_inPercentage];
					
				}
					
					if(mode == "++" || mode  == "--")
					{
						lo_global.jo_lightBox_img.css({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]});
						//lo_global.jo_lightBox_img.css({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1]});
						//lo_global.jo_lightBox_img.stop().animate({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]},{duration:300,queue:false,complete:function()	{}});
					}
					else
					lo_global.jo_lightBox_img.stop().animate({left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]},{duration:600,queue:false,complete:function()	{}});
					
				}
					lo_global.f_information();
		};
		lo_global.jo_control___zoomI.bind("click",function(e)
			{	
				e.stopPropagation();
				if(!jQuery(this)[0].notClick)
				lo_global.f_control_zoom('+');
			});
		lo_global.jo_control___zoomI.bind("mousedown",function(e)
			{	
				e.stopPropagation();
				var THIS = this;
				jQuery(THIS)[0].notClick = false;
				jQuery(THIS)[0].timer = setTimeout(function(){
					jQuery(THIS)[0].notClick = true;
					jQuery(THIS)[0].timer = setInterval(function()
					{lo_global.f_control_zoom('++',function()	{clearInterval(jQuery(THIS)[0].timer);});},13);
				},300);
			}).bind("mouseup",function(e)	{
				
				e.stopPropagation(e);
				clearInterval(jQuery(this)[0].timer);
				});
		lo_global.jo_control___zoomO.bind("click",function(e)
			{	
				e.stopPropagation();
				if(!jQuery(this)[0].notClick)
				lo_global.f_control_zoom('-');
			});
		lo_global.jo_control___zoomO.bind("mousedown",function(e)
			{	
				//e.stopPropagation();
				var THIS = this;
				jQuery(THIS)[0].notClick = false;
				jQuery(THIS)[0].timer = setTimeout(function(){
					jQuery(THIS)[0].notClick = true;
					jQuery(THIS)[0].timer = setInterval(function()
					{lo_global.f_control_zoom('--',function()	{clearInterval(jQuery(THIS)[0].timer);});},13);
				},300);
			}).bind("mouseup",function(e)	{
				e.stopPropagation();
				clearInterval(jQuery(this)[0].timer);
				});
		lo_global.jo_control___zoomFs.bind("click",	function(e)		{e.stopPropagation(); lo_global.f_control_zoom('fs');	});
		lo_global.jo_control___zoomF100.bind("click",	function(e)	{e.stopPropagation(); lo_global.f_control_zoom('f100');	});
	};
	
	lo_global.f_playerControls = function(applyTo)
	{
		if(!hs_browser.isIE())
		{
		lo_global.jo_lightBox_prev = hs_dom.append(applyTo,"<div><img src='img/prev.png' border='0'/></div>");
		lo_global.jo_lightBox_next = hs_dom.append(applyTo,"<div><img src='img/next.png' border='0'/></div>");
		}
		else
		{
		lo_global.jo_lightBox_prev = hs_dom.append(applyTo,"<div><img src='img/prev.png' border='0' style=\"width:55px;height:23px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/prev.png', sizingMethod='scale');\"/></div>");
		lo_global.jo_lightBox_next = hs_dom.append(applyTo,"<div><img src='img/next.png' border='0' style=\"width:55px;height:23px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/next.png', sizingMethod='scale');\"/></div>");
		
		}
		hs_dom.vAlign(lo_global.jo_lightBox_prev.find("img")).self;
		hs_dom.vAlign(lo_global.jo_lightBox_next.find("img")).self;
		
		lo_global.jo_lightBox_prev.css({position:"absolute",top:0,left:0,zIndex:1231,width:80,height:"100%",opacity:.1,textAlign:"center",backgroundColor:"#fae6fc",cursor:"pointer"});
		lo_global.jo_lightBox_next.css({position:"absolute",top:0,right:0,zIndex:1231,width:80,height:"100%",opacity:.1,textAlign:"center",backgroundColor:"#fae6fc",cursor:"pointer"});
		
		lo_global.jo_lightBox_prev.bind("mouseover",function()	{jQuery(this).animate({opacity:.5},{duration:300,queue:false,complete:function()	{}});}).bind("mouseout",function()
			{
				jQuery(this).animate({opacity:.2},{duration:300,queue:false,complete:function()	{}});
			});
		lo_global.jo_lightBox_next.bind("mouseover",function()	{jQuery(this).animate({opacity:.5},{duration:300,queue:false,complete:function()	{}});}).bind("mouseout",function()
			{
				jQuery(this).animate({opacity:.2},{duration:300,queue:false,complete:function()	{}});
			});
		lo_global.jo_lightBox_prev.bind("click",function()	{	lo_global.objectTransform(lo_global.jTarget[0].groupID-1);	});
		lo_global.jo_lightBox_next.bind("click",function()	{	lo_global.objectTransform(lo_global.jTarget[0].groupID+1);	});
		
	};
	
	lo_global.f_closeButton = function(applyTo)
	{
		if(!hs_browser.isIE())
		lo_global.jo_lightBox_close	= hs_dom.append(applyTo,"<div><img src='img/close_chi.png' border='0'/></div>");
		else
		lo_global.jo_lightBox_close	= hs_dom.append(applyTo,"<div><img src='img/close_chi.png' border='0' style=\"width:100px;height:35px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='close_chi.png', sizingMethod='scale');\"/></div>");
															
		lo_global.jo_lightBox_close.css({position:"absolute",top:15,right:15,width:100,height:35,textAlign:"right",zIndex:1250,opacity:0,cursor:"pointer"});
		
		lo_global.jo_lightBox_close.bind("mouseover",function(e)
			{	jQuery(this).stop().animate({opacity:.8},{duration:300,queue:false,complete:function()	{}});
			}).bind("mouseout",function(e)	
				{	jQuery(this).stop().animate({opacity:.5},{duration:300,queue:false,complete:function()	{}});
				});
		lo_global.jo_lightBox_close.bind("click",function(e){
			e.stopPropagation();
			lo_global.f_close_lightBox();
															});
															
	};
	
	lo_global.f_information = function()
	{
		
		var s = parseInt(lo_global.imageSize_storage.existing_size[0] * 100) + "%" +"&nbsp;&nbsp;&nbsp;<span style='font-size:11px;font-weight:normal;'>[&nbsp;"+Math.round(lo_global.imageSize_storage.existing_size[1])+"px&nbsp;,&nbsp;"+parseInt(lo_global.imageSize_storage.existing_size[2])+"px&nbsp;]</span>";
			lo_global.jo_lightBox_infoPanel_textPanel[0].innerHTML = s;
			//hs_cssStyle.dropShadow(lo_global.jo_lightBox_infoPanel_textPanel,{color:"#999999"});
	};
										
	lo_global.f_create_lightBox = function(jTarget)
	{
		lo_global.jTarget = jTarget;
		
		// - create dom element : lo_global.jo_lightBox_outer
		(function()
		{
			var applyTo;
				applyTo = lo_body.self;
				applyTo = jQuery("div.slideshowPanel");
				
			
			lo_global.jo_lightBox_outer = hs_dom.append(applyTo,"<div></div>");
			//lo_global.jo_lightBox_outer.addClass("HS-cssStyle-fixed");
			lo_global.jo_lightBox_outer.css({position:"relative",top:0,left:0});
			lo_global.jo_lightBox_outer.css({zIndex:1000,overflow:"hidden",width:"100%",height:"100%"});
			
		})();
		
		// - create dom element : lo_global.jo_lightBox_inner
		(function()
		{
			lo_global.jo_lightBox_inner = hs_dom.append(lo_global.jo_lightBox_outer,"<div id='outer'></div>");
			lo_global.jo_lightBox_inner.css({position:"relative",zIndex:1010,overflow:"hidden",width:"100%",height:"100%",margin:"auto"});
		})();
		
		// - create dom element : lo_global.jo_lightBox_elementPanel
		(function()
		{
			// -- create dom element : lo_global.jo_lightBox_elementPanel_background
			(function()
			{
				lo_global.jo_lightBox_elementPanel_background = hs_dom.append(lo_global.jo_lightBox_inner,"<div id='elementPanel_background'></div>");
				lo_global.jo_lightBox_elementPanel_background.css({position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden"});
				
			})();
			
			// -- create dom element : lo_global.jo_lightBox_elementPanel
			(function()
			{
				lo_global.jo_lightBox_elementPanel = hs_dom.append(lo_global.jo_lightBox_inner,"<div id='elementPanel'></div>");
				lo_global.jo_lightBox_elementPanel.css({position:"relative",zIndex:1020,overflow:"hidden",width:980,height:500,margin:"auto"});
				
				// ~ make element h&v center
				lo_global.jo_lightBox_elementPanel_family 	= hs_dom.vAlign(lo_global.jo_lightBox_elementPanel);
				// ~ -><- retrive element
				lo_global.jo_lightBox_elementPanel 			= lo_global.jo_lightBox_elementPanel_family.self;
				
				//lo_global.jo_lightBox_elementPanel.addClass("debug03_ff0000");
					
				/*
				(function()
					{
						
						lo_global.jo_lightBox_tipsPanel = hs_dom.append(lo_global.jo_lightBox_elementPanel,"<div></div>");
						lo_global.jo_lightBox_tipsPanel.css({position:"absolute",bottom:80,right:30,zIndex:2200});
						//lo_global.jo_lightBox_tipsPanel.hide();
						
						lo_global.jo_lightBox_tipsPanel[0].innerHTML = "<img src='img/tips.png'/>";
						
						
						hs_image.imgLoaded(lo_global.jo_lightBox_tipsPanel.find("img"),function()
							{
								var timer = setTimeout(function(){
									lo_global.jo_lightBox_tipsPanel.remove();
								},3000);
							});
					
					})();
					*/
					
				// -- create dom element : lo_global.jo_lightBox_centerPanel
				(function()
				{
					lo_global.jo_lightBox_centerPanel = hs_dom.append(lo_global.jo_lightBox_elementPanel,"<div></div>");
					lo_global.jo_lightBox_centerPanel.css({position:"absolute",top:0,left:0,zIndex:1030,width:"65%",height:"100%",overflow:"hidden"});
					lo_global.jo_lightBox_centerPanel_size = [lo_global.jo_lightBox_centerPanel.width(),lo_global.jo_lightBox_centerPanel.height()];
						
						
						lo_global.jo_lightBox_imgPanel 	= hs_dom.append(lo_global.jo_lightBox_centerPanel ,"<div></div>");
						lo_global.jo_lightBox_imgPanel.css({position:"absolute",left:0,top:0,opacity:0,width:"100%",height:"100%",textAlign:"center",overflow:"hidden",zIndex:100});
				
				
						//alert(jTarget[0].href);
						
						
					lo_global.jo_lightBox_centerPanel.css({backgroundImage:"url(img/lightBox_background.png)"});
					
					lo_global.jo_lightBox_introPanel = hs_dom.append(lo_global.jo_lightBox_elementPanel,"<div></div>");
					lo_global.jo_lightBox_introPanel.css({position:"absolute",top:0,right:"0%",zIndex:1030,width:"23%",height:"100%",overflow:"hidden"});
					lo_global.jo_lightBox_introPanel.css({backgroundImage:"url(img/infoBackground.png)"});
					
						
						lo_global.jo_lightBox_detailPanel = hs_dom.append(lo_global.jo_lightBox_introPanel ,"<div></div>");
						lo_global.jo_lightBox_detailPanel.css({position:"absolute",left:0,top:0,width:"100%",height:"100%",textAlign:"center",overflowX:"hidden",overflowY:"hidden",zIndex:1200});
							
							lo_global.jo_lightBox_detailPanel_textPanel = hs_dom.append(lo_global.jo_lightBox_detailPanel,"<div></div>");
							lo_global.jo_lightBox_detailPanel_textPanel.css({position:"relative",width:"100%",height:"100%",color:"#f3bef3",fontFamily:"arial",fontSize:13,textAlign:"left"});
							
								lo_global.jo_lightBox_detailPanel_textPanel_title 		= hs_dom.append(lo_global.jo_lightBox_detailPanel_textPanel,"<div></div>");
									lo_global.jo_lightBox_detailPanel_textPanel_title.css({position:"relative",fontWeight:"bold",fontSize:16,color:"#FF11BA",margin:10});
									
								var title_size = [lo_global.jo_lightBox_detailPanel_textPanel_title.width(),lo_global.jo_lightBox_detailPanel_textPanel_title.height()];
								
								lo_global.jo_lightBox_detailPanel_textPanel_description = hs_dom.append(lo_global.jo_lightBox_detailPanel_textPanel,"<div></div>");
								
									//lo_global.jo_lightBox_detailPanel_textPanel_description_caption = hs_dom.append(lo_global.jo_lightBox_detailPanel_textPanel_description,"<div>詳細介紹：</div>");
									//lo_global.jo_lightBox_detailPanel_textPanel_description_caption.css({fontWeight:"bold",color:"#909090"});
									//lo_global.jo_lightBox_detailPanel_textPanel_description_caption.hide();
									lo_global.jo_lightBox_detailPanel_textPanel_description_content = hs_dom.append(lo_global.jo_lightBox_detailPanel_textPanel_description,"<div></div>");
									lo_global.jo_lightBox_detailPanel_textPanel_description_content.css({color:"#000000",lineHeight:"18px",padding:10,paddingTop:0,marginTop:15});
								
								//lo_global.jo_lightBox_detailPanel_textPanel_title = hs_dom.append(lo_global.jo_lightBox_detailPanel_textPanel,"<div></div>");
								
							//hs_cssStyle.dropShadow(lo_global.jo_lightBox_detailPanel_textPanel_title,{color:"#d354d3"});
							
						//lo_global.jo_lightBox_detailPanel_background = hs_dom.append(lo_global.jo_lightBox_introPanel ,"<div></div>");
						//lo_global.jo_lightBox_detailPanel_background.css({position:"absolute",left:0,top:0,opacity:.3,backgroundColor:"#ffffff",width:"100%",height:"100%",textAlign:"center",overflow:"hidden",zIndex:110});
						
						//lo_global.jo_lightBox_detailPanel.css({width:"100%",height:"50%"});
						//lo_global.jo_lightBox_detailPanel_background.css({width:lo_global.jo_lightBox_detailPanel.width(),height:lo_global.jo_lightBox_detailPanel.height()});
						
					
					
					// -- create dom element : lo_global.jo_lightBox_infoPanel
					(function()
					{
						lo_global.jo_lightBox_infoPanel = hs_dom.append(lo_global.jo_lightBox_centerPanel,"<div id='infoPanel'></div>");
						lo_global.jo_lightBox_infoPanel.css({position:"absolute",bottom:-25,left:0,zIndex:1500,width:"100%",height:25,overflow:'hidden'});
						
						lo_global.jo_lightBox_infoPanel_background 	= hs_dom.append(lo_global.jo_lightBox_infoPanel,"<div id='infoPanel_background'></div>");
						lo_global.jo_lightBox_infoPanel_background.css({position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.2,backgroundColor:"#ffffff"});
						
						lo_global.jo_lightBox_infoPanel_textContent = hs_dom.append(lo_global.jo_lightBox_infoPanel,"<div id='textContent'></div>");
						lo_global.jo_lightBox_infoPanel_textContent.css({position:"absolute",top:0,left:0,width:"100%",height:"100%"});
							
							lo_global.jo_lightBox_infoPanel_textPanel = hs_dom.append(lo_global.jo_lightBox_infoPanel_textContent,"<div></div>");
							lo_global.jo_lightBox_infoPanel_textPanel.css({position:"relative",fontSize:16,fontWeight:"bold",fontFamily:"arial",color:"#ffffff",height:25,lineHeight:"25px",paddingLeft:"8px"});	
					})();
					
					// -- create dom element : lo_global.jo_lightBox_mask
					(function()
					{
						lo_global.jo_lightBox_mask = hs_dom.append(lo_global.jo_lightBox_centerPanel,"<div id='mask'></div>");
						lo_global.jo_lightBox_mask.css({position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:1050,opacity:0,overflow:"hidden",backgroundColor:"#ffffff"});
							
					})();
					
					
				
				})();
				
				// -- create dom element : lo_global.jo_lightBox_eastPanel
				(function()
				{
					lo_global.jo_lightBox_eastPanel = hs_dom.append(lo_global.jo_lightBox_elementPanel,"<div></div>");
					lo_global.jo_lightBox_eastPanel.css({position:"absolute",top:0,right:"23%",zIndex:1100,width:"13%",height:"100%",overflow:"hidden",backgroundColor:"#ffffff"});
				
				})();	
			})();
		})();
	
		lo_global.centerLoading = lo_global.f_loading(lo_global.jo_lightBox_centerPanel);
		lo_global.thumbList();
		lo_global.f_controlButton();
		
		lo_global.f_load_detail = function(jTarget)
			{
				
				if(jQuery("#"+jTarget[0].info_titleID)[0])
				lo_global.jo_lightBox_detailPanel_titleHTML = jQuery("#"+jTarget[0].info_titleID)[0].innerHTML;
				else
				lo_global.jo_lightBox_detailPanel_titleHTML = "";
				if(jQuery("#"+jTarget[0].info_descriptionID)[0])
				{
				lo_global.jo_lightBox_detailPanel_descriptionCaptionHTML = "";
				//lo_global.jo_lightBox_detailPanel_descriptionCaptionHTML = "詳細資料：";
				lo_global.jo_lightBox_detailPanel_descriptionHTML = jQuery("#"+jTarget[0].info_descriptionID)[0].innerHTML;
				}else
				{
					lo_global.jo_lightBox_detailPanel_descriptionCaptionHTML = "";
					lo_global.jo_lightBox_detailPanel_descriptionHTML = "";
				}
				lo_global.jo_lightBox_detailPanel_textPanel_title[0].innerHTML = lo_global.jo_lightBox_detailPanel_titleHTML;
				
				//lo_global.jo_lightBox_detailPanel_textPanel_description_caption[0].innerHTML = lo_global.jo_lightBox_detailPanel_descriptionCaptionHTML;
				lo_global.jo_lightBox_detailPanel_textPanel_description_content[0].innerHTML = lo_global.jo_lightBox_detailPanel_descriptionHTML;
				
				
				var title_size = [lo_global.jo_lightBox_detailPanel_textPanel_title.width(),lo_global.jo_lightBox_detailPanel_textPanel_title.height()];
				
				lo_global.jo_lightBox_detailPanel_textPanel_description.css({position:"absolute",top:title_size[1],marginTop:10,marginLeft:0,overflow:"auto",width:"100%",height:(lo_global.jo_lightBox_detailPanel_textPanel_description.parent().height() - title_size[1] - 12)});
				
				//hs_cssStyle.dropShadow(lo_global.jo_lightBox_detailPanel_textPanel_title,{color:"#d354d3"});
				
			};
		
		lo_global.f_load_detail(jTarget);
			
		lo_global.f_initial_imageSize = function(w,h)
			{
				lo_global.imageSize_storage.whole_size	= [];
				lo_global.imageSize_storage.whole_xyPos	= [];
			
				lo_global.imageSize_storage.fs 			= hs_image.img_scale_virtual([w,h],lo_global.jo_lightBox_centerPanel_size);
				lo_global.imageSize_storage.fs_xyPos	= hs_cssStyle.hvAlignment_virtual(["center","middle"],[lo_global.imageSize_storage.fs[1],lo_global.imageSize_storage.fs[2]],lo_global.jo_lightBox_centerPanel_size);
				lo_global.imageSize_storage.f100		= [1,w,h];
				lo_global.imageSize_storage.f100_xyPos	= hs_cssStyle.hvAlignment_virtual(["center","middle"],[w,h],lo_global.jo_lightBox_centerPanel_size);
				
				lo_global.imageSize_storage.existing_size 	= lo_global.imageSize_storage.fs;
				lo_global.imageSize_storage.existing_xyPos 	= lo_global.imageSize_storage.fs_xyPos;
			
				(function()
				{
					var size 	= [],
						xyPos	= []
						;
					for(var i=0;i<=100;i++)
					{
						size 	= [Math.round(i*w/100),Math.round(i*h/100)];
						xyPos	= hs_cssStyle.hvAlignment_virtual(["center","middle"],size,lo_global.jo_lightBox_centerPanel_size);
						
						lo_global.imageSize_storage.whole_size[i] 	= [i/100,size[0],size[1]];
						lo_global.imageSize_storage.whole_xyPos[i] 	= xyPos;
					}
				})();
				
				//lo_global.imageSize_storage.existing_size 	= lo_global.imageSize_storage.whole_size[10];
				//lo_global.imageSize_storage.existing_xyPos 	= lo_global.imageSize_storage.whole_xyPos[10]
			
				
			};
		
		hs_image.imgLoaded(jTarget[0].href,function(w,h)
		{	
		
			lo_global.centerLoading.stop().animate({opacity:0},{duration:1000,queue:false,complete:function()	{}});
		
			lo_global.f_initial_imageSize(w,h);
		
			
			lo_global.f_playerControls(lo_global.jo_lightBox_centerPanel);
			//lo_global.f_closeButton(lo_global.jo_lightBox_centerPanel);
			
			lo_global.jo_lightBox_img = hs_dom.append(lo_global.jo_lightBox_imgPanel,"<img src='"+jTarget[0].href+"' border='0'/>");
			lo_global.jo_lightBox_img.css({position:"absolute",left:lo_global.imageSize_storage.existing_xyPos[0],top:lo_global.imageSize_storage.existing_xyPos[1],width:lo_global.imageSize_storage.existing_size[1],height:lo_global.imageSize_storage.existing_size[2]});
			
			
				lo_global.jo_lightBox_imgPanel.stop().animate({opacity:1},{duration:500,queue:false,complete:function()	{
					
					lo_global.jo_lightBox_infoPanel.stop().animate({bottom:0},{duration:600,queue:false,complete:function()	{}});
					//lo_global.jo_lightBox_close.stop().animate({opacity:.5},{duration:300,queue:false,complete:function()	{}});
				}});
				
			
			
				lo_global.f_information();
		
		
		
			(function()	{
					
							var drag = true;
							var ifWheel = false;
							if(drag)
							lo_global.jo_lightBox_mask.bind("mousedown",function(e)
								{
									var html = jQuery("html");
									var jTHIS = jQuery(this),
										jTHIS_parent = jTHIS.parent();
									var current_imageSize = lo_global.imageSize_storage.existing_size;
									var current_image_xyPos = lo_global.imageSize_storage.existing_xyPos;
									
									
									var elementPanel_height 			= lo_global.jo_lightBox_elementPanel_family.self.height();
									var elementPanel_wrapper_height 	= lo_global.jo_lightBox_elementPanel_family.family.outer.height();
									// for calculate the outerSpace
									var offset = [hs_dom.offset(jTHIS[0],"offsetLeft"),(elementPanel_wrapper_height - elementPanel_height)/2];

									var outerSpace = [offset[0] + html.scrollLeft(),offset[1] + html.scrollTop()];
										jTHIS[0].old_cursor = jTHIS.css("cursor");
										jTHIS.css({opacity:0,cursor:"move"});
										
										//jTHIS.hide();
										
										
										var init_mousePos,
											mousePos,
											object_xyPos_difference,
											new_imagePos
											;
										
										// default
										jTHIS[0].zooming = false;
									
										html.bind("mousedown",function(e)
											{	
												init_mousePos 	= [e.pageX - outerSpace[0],e.pageY - outerSpace[1]];
												mousePos 		= init_mousePos;
												
												new_imagePos = [current_image_xyPos[0],current_image_xyPos[1]]
												object_xyPos_difference = [];
													html.bind("mousemove",function(e){
														
														jTHIS[0].zooming = true;
														
														mousePos = [e.pageX - outerSpace[0],e.pageY - outerSpace[1]];
														object_xyPos_difference[0] = mousePos[0] - init_mousePos[0];
														object_xyPos_difference[1] = mousePos[1] - init_mousePos[1];
														
														new_imagePos = 
														[	current_image_xyPos[0] + object_xyPos_difference[0],
															current_image_xyPos[1] + object_xyPos_difference[1]			
														];
														
														debug = [
															mousePos,
															init_mousePos,
															
															object_xyPos_difference,
															current_image_xyPos
															];
															
														//hs_debug.show(hs_array.parse_array(debug),true);
														
														
														lo_global.jo_lightBox_img.css({position:"absolute",width:current_imageSize[1],height:current_imageSize[2],left:new_imagePos[0],top:new_imagePos[1]});
													
													});
													
								
												
											}).bind("mouseup mouseleave",function(e)
												{
													lo_global.imageSize_storage.existing_xyPos = new_imagePos;
													jQuery(this).unbind("mouseup");
													jQuery(this).unbind("mousedown");
													jQuery(this).unbind("mousemove");
													
												});
										
									
								});
							
							if(!drag)
							lo_global.jo_lightBox_mask.bind("mousedown",function(e)
								{
									var jTHIS = jQuery(this).parent();
									var current_imageSize = lo_global.imageSize_storage.existing_size;
									
									// default
									jTHIS[0].zooming = false;
									
									if(current_imageSize[0] < 1)
									{	var elementPanel_height 			= lo_global.jo_lightBox_elementPanel_family.self.height();
										var elementPanel_wrapper_height 	= lo_global.jo_lightBox_elementPanel_family.family.outer.height();
										// for calculate the outerSpace
										var offset = [hs_dom.offset(lo_global.jo_lightBox_mask[0],"offsetLeft"),(elementPanel_wrapper_height - elementPanel_height)/2];
										
										jTHIS[0].old_cursor = jTHIS.css("cursor");
										lo_global.draggable_alias = hs_mouse.drawRectangle(jTHIS,e,{sampleX:offset[0],sampleY:offset[1]},function(x,y,w,h)
											{
												jTHIS.css({cursor:jTHIS[0].old_cursor});
												
												var centerPanel_size = lo_global.jo_lightBox_centerPanel_size
												
												// sample_size is the current image size
												var sample_size 	= [lo_global.imageSize_storage.existing_size[0],lo_global.imageSize_storage.existing_size[1],lo_global.imageSize_storage.existing_size[2]]
												var sample_xyPos 	= [lo_global.imageSize_storage.existing_xyPos[0],lo_global.imageSize_storage.existing_xyPos[1]];
												
												var gaps = [x - sample_xyPos[0],y - sample_xyPos[1]];
												
												var a_zoom 			= hs_image.img_zoom_virtual([w,h],centerPanel_size),
													n_zoom_rate 	= a_zoom[0],				// the rate enlarge from size[w,h] to centerPanel_size
													n_sample_zoom_rate 	= sample_size[0],		// the current rate of existing image size
													n_coming_zoom_rate 	= n_sample_zoom_rate * n_zoom_rate;
														/*
															virtual box size [w,h] * rate1 = centerPanel_size;	
															current img size [w,h] * rate2 = img size [w?,h?];
																* rate1 (must be same as) = rate2 = n_zoom_rate
																
															so, the image enlarged rate : current rate * n_zoom_rate = coming/after enlarged rate
														*/
												
												
												var relative_size = [],
													virtual_size = [],
													virtual_xyPos = [];
													
												
													relative_size 	= [sample_size[1] - (gaps[0] + w),sample_size[2] - (gaps[1] + h)];
													virtual_size 	= [sample_size[1]*2 - w,sample_size[2]*2 - h];

													if(n_coming_zoom_rate>=1)
													{
														sample_size = lo_global.imageSize_storage.f100;
														n_zoom_rate = 1 / n_sample_zoom_rate;
													}
													
													relative_size[0] *= n_zoom_rate;
													relative_size[1] *= n_zoom_rate;
													
													virtual_size[0] *= n_zoom_rate;
													virtual_size[1] *= n_zoom_rate;
												
													virtual_xyPos	= hs_cssStyle.hvAlignment_virtual(["center","middle"],virtual_size,centerPanel_size);
													
													virtual_xyPos[0] += relative_size[0]; 
													virtual_xyPos[1] += relative_size[1];  
													
													if(n_coming_zoom_rate<1)
													{
													sample_size[0] = n_coming_zoom_rate;
													sample_size[1] *= n_zoom_rate;
													sample_size[2] *= n_zoom_rate;
													}
													
													
													
													
													var debug = "";
														debug += "sample_size[0] = "+sample_size[0]+" <BR/>";
														debug += "gaps[0] = "+gaps[0]+" <BR/>";
														debug += "x = "+x+" ; y = " +y+ "<BR/>";
														debug += "w = "+w+" <BR/>";
														debug += "sample_xyPos[0] = "+sample_xyPos[0]+" <BR/>";
														debug += "virtual_size[0] = "+virtual_size[0]+" <BR/>";
														
													// 01. checking : gaps => correct
													// 02. w : w
													
													
													var generator = [
															n_sample_zoom_rate,
															n_zoom_rate,
															gaps,
															
															relative_size,
															[w,h],
															sample_size,
															virtual_size,
															virtual_xyPos
																	];
													
													//hs_debug.show(debug);
													hs_debug.show(hs_array.parse_array(generator),true);
													
													lo_global.f_control_zoom([sample_size[0],sample_size[1],sample_size[2],virtual_xyPos[0],virtual_xyPos[1]]);
											
											});

									}
									
									
								});
							
							if(ifWheel)
							lo_global.jo_lightBox_mask.bind("mouseover mousemove",function(e)
								{
									var html = jQuery("html");
									var jTHIS = jQuery(this),
										jTHIS_parent = jTHIS.parent();
										
									var elementPanel_height 			= lo_global.jo_lightBox_elementPanel_family.self.height();
									var elementPanel_wrapper_height 	= lo_global.jo_lightBox_elementPanel_family.family.outer.height();
									// for calculate the outerSpace
									var offset = [hs_dom.offset(lo_global.jo_lightBox_mask[0],"offsetLeft"),(elementPanel_wrapper_height - elementPanel_height)/2];
									
									var outerSpace = [offset[0] + html.scrollLeft(),offset[1] + html.scrollTop()];
									var mousePos;
									var centerPointer = [];
									
									var imageSize 	= [];
									var imagePos	= [];
									
									var lPosRate	= [];
									var rPosRate	= [];
									
									var relative_size	= [];


										html.bind("mousemove",function(e){
											mousePos 		= [e.pageX - outerSpace[0],e.pageY - outerSpace[1]];
											imageSize 		= [lo_global.jo_lightBox_img.width(),lo_global.jo_lightBox_img.height()];
											imagePos 		= [parseInt(lo_global.jo_lightBox_img.css("left")),parseInt(lo_global.jo_lightBox_img.css("top"))];
											
											centerPointer 	= [imageSize[0]/2,imageSize[1]/2];
											lPosRate = [
													(mousePos[0] - imagePos[0])/imageSize[0],
													(mousePos[1] - imagePos[1])/imageSize[1]
												];
											rPosRate = [
													(imagePos[0] + imageSize[0] - mousePos[0])/imageSize[0],
													(imagePos[1] + imageSize[1] - mousePos[1])/imageSize[1],
													
												];
											
											var debug = [
												outerSpace,
												mousePos,
												
												imageSize,
												imagePos,
												
												centerPointer,
												lPosRate,
												rPosRate
											];
											
											//hs_debug.show(hs_array.parse_array(debug));
										});
									
										
										jQuery(this).bind("mousewheel",function(e,delta)
											{
													
													if (delta > 0)
													{
var centerPanel_size = lo_global.jo_lightBox_centerPanel_size;

// sample_size is the current image size
var sample_size 	= lo_global.imageSize_storage.existing_size;
var sample_xyPos 	= lo_global.imageSize_storage.existing_xyPos;

var go_percentage_number = parseInt(sample_size[0]*100) - 5;
	//go_percentage_number = go_percentage_number>=100?100:go_percentage_number;

var coming_size 	= lo_global.imageSize_storage.whole_size[go_percentage_number];
var coming_xyPos	= lo_global.imageSize_storage.whole_xyPos[go_percentage_number];	

if(coming_size[1]>=centerPanel_size[0] && coming_size[2]>=centerPanel_size[1])
	{
	var virtual_size	= [coming_size[1],coming_size[2]];
	var virtual_xyPos 	= hs_cssStyle.hvAlignment_virtual(["center","middle"],virtual_size,centerPanel_size);
	var go_l_rate 		= [coming_size[1] * lPosRate[0],coming_size[2] * lPosRate[1]];
	var go_r_rate 		= [coming_size[1] * rPosRate[0],coming_size[2] * rPosRate[1]]

		var zoomPoint = [coming_xyPos[0] + go_l_rate[0] - mousePos[0],
						coming_xyPos[1] + go_l_rate[1] - mousePos[1]];

		virtual_xyPos[0] -= zoomPoint[0];
		virtual_xyPos[1] -= zoomPoint[1];

		
		lo_global.f_control_zoom([coming_size[0],coming_size[1],coming_size[2],virtual_xyPos[0],virtual_xyPos[1]]);
	
	}
	else
	lo_global.f_control_zoom('---');
													}
													else if (delta < 0)
													{

									
var centerPanel_size = lo_global.jo_lightBox_centerPanel_size;

// sample_size is the current image size
var sample_size 	= lo_global.imageSize_storage.existing_size;
var sample_xyPos 	= lo_global.imageSize_storage.existing_xyPos;

var go_percentage_number = parseInt(sample_size[0]*100) + 5;
	go_percentage_number = go_percentage_number>=100?100:go_percentage_number;

var coming_size 	= lo_global.imageSize_storage.whole_size[go_percentage_number];
var coming_xyPos	= lo_global.imageSize_storage.whole_xyPos[go_percentage_number];	

	if(coming_size[1]>=centerPanel_size[0] && coming_size[2]>=centerPanel_size[1])
	{
var virtual_size	= [coming_size[1],coming_size[2]];
var virtual_xyPos 	= hs_cssStyle.hvAlignment_virtual(["center","middle"],virtual_size,centerPanel_size);
var go_l_rate 		= [coming_size[1] * lPosRate[0],coming_size[2] * lPosRate[1]];
var go_r_rate 		= [coming_size[1] * rPosRate[0],coming_size[2] * rPosRate[1]]
	
	var zoomPoint = [coming_xyPos[0] + go_l_rate[0] - mousePos[0],
					coming_xyPos[1] + go_l_rate[1] - mousePos[1]];

	virtual_xyPos[0] -= zoomPoint[0];
	virtual_xyPos[1] -= zoomPoint[1];

	lo_global.f_control_zoom([coming_size[0],coming_size[1],coming_size[2],virtual_xyPos[0],virtual_xyPos[1]]);
	}
	else
	lo_global.f_control_zoom('+++');
	
													}
													
													e.stopPropagation();
													e.preventDefault();
											});
										
										
									jQuery(this).unbind("mousemove");
										
								});
							
							
							lo_global.jo_lightBox_mask.bind("click",function(e)
								{
									var jTHIS = jQuery(this);
									if(!jTHIS[0].zooming)
									{
										lo_global.jo_control___zoomFs.trigger("click");
									}
								});							
							lo_global.jo_lightBox_mask.bind("mouseup",function(e)
									{
										var jTHIS = jQuery(this);
											jTHIS.css({cursor:jTHIS[0].old_cursor});
									});
							
			})();

		});
	};
lo_global.firstTarget.trigger("click");
})();


				}
					};
	
