// JavaScript Document
	var isDragging=false;
	var isDrag=false;
	
	function getModel(){
	
		if(!$("divScrollbar")){
			return;
		}
		var parentWidth=$("divModelPhotosWrapper").offsetWidth;
		var childWidth=$("tableModelPhotos").offsetWidth;
		var diff = childWidth-parentWidth;
		
		var firstPosLeft=0;
		var pointerPosLeft=0;
		var diffPosLeft=0;
		
		if(childWidth>parentWidth){
			
			var isDrag=false;
			var divScroll = $("divScrollbar");
			divScroll.style.display='block';
			
			var divScrollChild = $("divScrollbarChild");
			divScrollChild.onmousedown=function(e){
				if(!e){e=window.event;}
				isDrag=true;
				isDragging=true;
				firstPosLeft = parseInt(this.style.left);
				pointerPosLeft = parseInt(Event.pointerX(e));
				diffPosLeft = pointerPosLeft-firstPosLeft;
				
				document.onmousemove=function(e){
					if(!e){e=window.event;}
					if(isDrag){
						var pointerX = Event.pointerX(e);
						divScrollChild.style.left=pointerX-diffPosLeft+"px";
						var moveX = parseInt(divScrollChild.style.left);
						var percent = diff/(divScroll.offsetWidth-30);
						percent = percent*moveX;
						percent=parseInt(Math.ceil(percent));
						//alert(percent);
						
						if(parseInt(divScrollChild.style.left)<0){
							$("tableModelPhotos").style.left="0px";
							divScrollChild.style.left=0+"px";
						//}else if(parseInt(divScrollChild.style.left)>parentWidth-divScrollChild.offsetWidth){
						}else if(parseInt(divScrollChild.style.left)>parentWidth-30){
							divScrollChild.style.left=parentWidth-30+"px";
						}else{
							$("tableModelPhotos").style.left=-percent+"px";
						}
						return false;
					}
				};
				document.onmouseup=function(){
					isDrag=false;
					isDragging=false;
					document.onmousemove=null;
					document.onmousedown=null;
				};
				document.onmousedown=function(){
					if(isDrag)
						return false;
					else
						return true;
				};
			};
			divScrollChild.onmousemove2=function(e){
				
			};
			divScrollChild.onmouseup=function(e){
				isDrag=false;
				isDragging=false;
				document.onmousemove=null;
				document.onmouseup=null;
			};
			
		}else{
			$("divScrollbar").style.display='none';
		}
	}
	
	var isDragging2=false;
	var isDrag2=false;
	
	function getModel2(){
	
		if(!$("divScrollbar2")){
			return;
		}
		var parentWidth=$("divModelPhotosWrapper2").offsetHeight;
		var childWidth=$("tableModelPhotos2").offsetHeight;
		var diff = childWidth-parentWidth;
		
		var firstPosLeft=0;
		var pointerPosLeft=0;
		var diffPosLeft=0;
		
		if(childWidth>parentWidth){
			
			var isDrag2=false;
			var divScroll = $("divScrollbar2");
			divScroll.style.display='block';
			
			var divScrollChild = $("divScrollbarChild2");
			divScrollChild.onmousedown=function(e){
				if(!e){e=window.event;}
				isDrag2=true;
				isDragging2=true;
				firstPosLeft = parseInt(this.style.top);
				pointerPosLeft = parseInt(Event.pointerY(e));
				diffPosLeft = pointerPosLeft-firstPosLeft;
				
				document.onmousemove=function(e){
					if(!e){e=window.event;}
					if(isDrag2){
						var pointerX = Event.pointerY(e);
						divScrollChild.style.top=pointerX-diffPosLeft+"px";
						var moveX = parseInt(divScrollChild.style.top);
						var percent = diff/(divScroll.offsetHeight-32);
						percent = percent*moveX;
						percent=parseInt(Math.ceil(percent));
						//alert(percent);
						
						if(parseInt(divScrollChild.style.top)<0){
							$("tableModelPhotos2").style.top="0px";
							divScrollChild.style.top=0+"px";
						//}else if(parseInt(divScrollChild.style.left)>parentWidth-divScrollChild.offsetWidth){
						}else if(parseInt(divScrollChild.style.top)>parentWidth-30){
							divScrollChild.style.top=parentWidth-30+"px";
						}else{
							$("tableModelPhotos2").style.top=-percent+"px";
						}
						return false;
					}
				};
				document.onmouseup=function(){
					isDrag2=false;
					isDragging2=false;
					document.onmousemove=null;
					document.onmousedown=null;
				};
				document.onmousedown=function(){
					if(isDrag2)
						return false;
					else
						return true;
				};
			};
			divScrollChild.onmousemove2=function(e){
				
			};
			divScrollChild.onmouseup=function(e){
				isDrag2=false;
				isDragging2=false;
				document.onmousemove=null;
				document.onmouseup=null;
			};
			
		}else{
			$("divScrollbar2").style.display='none';
		}
	}
	
	
	var isDragging3=false;
	var isDrag3=false;
	
	function getModel3(){
	
		if(!$("divScrollbar3")){
			return;
		}
		var parentWidth=$("divModelPhotosWrapper3").offsetHeight;
		var childWidth=$("tableModelPhotos3").offsetHeight;
		var diff = childWidth-parentWidth;
		
		var firstPosLeft=0;
		var pointerPosLeft=0;
		var diffPosLeft=0;
		
		if(childWidth>parentWidth){
			
			var isDrag3=false;
			var divScroll = $("divScrollbar3");
			divScroll.style.display='block';
			
			var divScrollChild = $("divScrollbarChild3");
			divScrollChild.onmousedown=function(e){
				if(!e){e=window.event;}
				isDrag3=true;
				isDragging3=true;
				firstPosLeft = parseInt(this.style.top);
				pointerPosLeft = parseInt(Event.pointerY(e));
				diffPosLeft = pointerPosLeft-firstPosLeft;
				
				document.onmousemove=function(e){
					if(!e){e=window.event;}
					if(isDrag3){
						var pointerX = Event.pointerY(e);
						divScrollChild.style.top=pointerX-diffPosLeft+"px";
						var moveX = parseInt(divScrollChild.style.top);
						var percent = diff/(divScroll.offsetHeight-32);
						percent = percent*moveX;
						percent=parseInt(Math.ceil(percent));
						//alert(percent);
						
						if(parseInt(divScrollChild.style.top)<0){
							$("tableModelPhotos3").style.top="0px";
							divScrollChild.style.top=0+"px";
						//}else if(parseInt(divScrollChild.style.left)>parentWidth-divScrollChild.offsetWidth){
						}else if(parseInt(divScrollChild.style.top)>parentWidth-30){
							divScrollChild.style.top=parentWidth-30+"px";
						}else{
							$("tableModelPhotos3").style.top=-percent+"px";
						}
						return false;
					}
				};
				document.onmouseup=function(){
					isDrag3=false;
					isDragging3=false;
					document.onmousemove=null;
					document.onmousedown=null;
				};
				document.onmousedown=function(){
					if(isDrag3)
						return false;
					else
						return true;
				};
			};
			divScrollChild.onmousemove2=function(e){
				
			};
			divScrollChild.onmouseup=function(e){
				isDrag3=false;
				isDragging3=false;
				document.onmousemove=null;
				document.onmouseup=null;
			};
			
		}else{
			$("divScrollbar3").style.display='none';
		}
	}
	
	
	var isDraggingAbs=[];
	var isDragAbs=[];
	
	function getModelAbs(divModelPhotosWrapper,tableModelPhotos,divScrollbar,divScrollbarChild,index){
	
		if(!$(divScrollbar)){
			return;
		}
		var parentWidth=$(divModelPhotosWrapper).offsetHeight;
		var childWidth=$(tableModelPhotos).offsetHeight;
		var diff = childWidth-parentWidth;
		
		var firstPosLeft=0;
		var pointerPosLeft=0;
		var diffPosLeft=0;
		
		if(childWidth>parentWidth){
			
			isDragAbs[index]=false;
			var divScroll = $(divScrollbar);
			divScroll.style.display='block';
			
			var divScrollChild = $(divScrollbarChild);
			divScrollChild.onmousedown=function(e){
				if(!e){e=window.event;}
				isDragAbs[index]=true;
				isDraggingAbs[index]=true;
				firstPosLeft = parseInt(this.style.top);
				pointerPosLeft = parseInt(Event.pointerY(e));
				diffPosLeft = pointerPosLeft-firstPosLeft;
				
				document.onmousemove=function(e){
					if(!e){e=window.event;}
					if(isDragAbs[index]){
						var pointerX = Event.pointerY(e);
						divScrollChild.style.top=pointerX-diffPosLeft+"px";
						var moveX = parseInt(divScrollChild.style.top);
						var percent = diff/(divScroll.offsetHeight-32);
						percent = percent*moveX;
						percent=parseInt(Math.ceil(percent));
						//alert(percent);
						
						if(parseInt(divScrollChild.style.top)<0){
							$(tableModelPhotos).style.top="0px";
							divScrollChild.style.top=0+"px";
						//}else if(parseInt(divScrollChild.style.left)>parentWidth-divScrollChild.offsetWidth){
						}else if(parseInt(divScrollChild.style.top)>parentWidth-30){
							divScrollChild.style.top=parentWidth-30+"px";
						}else{
							$(tableModelPhotos).style.top=-percent+"px";
						}
						return false;
					}
				};
				document.onmouseup=function(){
					isDragAbs[index]=false;
					isDraggingAbs[index]=false;
					document.onmousemove=null;
					document.onmousedown=null;
				};
				document.onmousedown=function(){
					if(isDragAbs[index])
						return false;
					else
						return true;
				};
			};
			divScrollChild.onmousemove2=function(e){
				
			};
			divScrollChild.onmouseup=function(e){
				isDragAbs[index]=false;
				isDraggingAbs[index]=false;
				document.onmousemove=null;
				document.onmouseup=null;
			};
			
		}else{
			$(divScrollbar).style.display='none';
		}
	}
	
	
