var detect = navigator.userAgent.toLowerCase();
var os = detect.indexOf('win') + 1;

if(os) {
		var ie=document.all
		var ns4=document.layers
		var ns6=document.getElementById
		var scrollerobj, scrollerxpos, scrollerypos, scrollerwidth, scrollerheight
		var containerobj, containerxpos, containerypos, containerwidth, containerheight
		var contentobj, contentxpos, contentypos, contentwidth, contentheight
		var drag=0, initdrag=0, scrollerratio=0, moveratio=0;
		var origW=window.innerWidth; 
		var origH=window.innerHeight; 
		var chkresizetimer; 

}
		function checkwindowresize() { 
		
			var newW=window.innerWidth; 
			var newH=window.innerHeight; 
			if (newW==origW && newH==origH){ 
				chkresizetimer = setTimeout("checkwindowresize()",200); 
			} 
			else { 
			
				clearTimeout(chkresizetimer); 
				window.location.reload(); 
			} 
		} 
		
		function init() {
		if(os) {
		
			if(ie) {
			
				containerobj=document.all.container
				if(containerobj) {
			
				contentobj=containerobj.document.all.content
				scrollerobj=document.all.scrollholder.document.all.scroller
				
				
				
				containerxpos=parseInt(containerobj.style.left)
				containerypos=parseInt(containerobj.style.top)
				containerwidth=parseInt(containerobj.clientWidth)
				containerheight=parseInt(containerobj.clientHeight)
				
				contentxpos=parseInt(contentobj.style.left)
				contentypos=parseInt(contentobj.style.top)
				contentwidth=parseInt(contentobj.clientWidth)
				contentheight=parseInt(contentobj.clientHeight)
				
				scrollerxpos=parseInt(scrollerobj.style.left)
				scrollerypos=parseInt(scrollerobj.style.top)
				scrollerwidth=parseInt(scrollerobj.clientWidth)
				}
								
			}
			else if(ns4) {
			
				containerobj=document.container
				if(containerobj) {
				contentobj=containerobj.document.content
				
				scrollerobj=document.scrollholder.document.scroller
				
				//alert(parseInt(contentobj.left))
				
				containerxpos=parseInt(containerobj.left)
				containerypos=parseInt(containerobj.top)
				containerwidth=parseInt(containerobj.clip.width)
				containerheight=parseInt(containerobj.clip.height)
				
				contentxpos=parseInt(contentobj.left)
				contentypos=parseInt(contentobj.top)
				contentwidth=parseInt(contentobj.clip.width)
				contentheight=parseInt(contentobj.clip.height)
				
				scrollerxpos=parseInt(scrollerobj.left)
				scrollerypos=parseInt(scrollerobj.top)
				scrollerwidth=parseInt(scrollerobj.clip.width)
				}
			}

			if(containerobj) {
			scrollerratio=(containerheight/contentheight)	
			scrollerheight=Math.floor(containerheight*scrollerratio)
			
			
			if(scrollerheight >= containerheight) {
				scrollerheight=containerheight;
				if(ie) {
					scrollerobj.style.background="F1F1F1"
					
					document.onmousedown=function () {return false}
					document.onmouseup=function () {return false}
					document.onmousemove=function () {return false}
				}
			}			
			if(ie) {
				scrollerobj.style.height=scrollerheight
				}
			else if(ns4) {
				scrollerobj.clip.height=scrollerheight
				}

				
			moveratio=((contentheight-containerheight)/(containerheight-scrollerheight))	
			
			checkwindowresize()
			}
			return true;
			
			}
		}
		
		
		function mousedown(e) {
			if(os) {
			drag=1;
			
			if(ie) {
			
				//if(event.x > 400 && event.x < 420 && (event.y-100) > scrollerypos && (event.y-100) < scrollerypos+scrollerheight) {
					//alert(containerypos + " " + containerheight)
				//alert(scrollerypos+"-"+scrollerheight)		
					initdrag=event.y
					document.oldpos=scrollerypos
					
				//}
			}
			else if(ns4) {
		
				//if(e.pageX > scrollerxpos && e.pageX < scrollerxpos+scrollerwidth && e.pageY > scrollerypos && e.pageY < scrollerypos+scrollerheight) {
					//alert(containerypos + " " + containerheight)
					//alert(scrollerobj.style.left)
					initdrag=e.pageY;
					document.oldpos=scrollerypos	
					//document.imglayer1.document.images['downg'].src='downarrow2a.gif'
					//document.images['downg'].src
				//}
			}
			}
		}
		
		function mouseup(e) {
			drag=0;
			
		}
		
		function mouseclickup(e) {
			if(os) {
				if(scrollerypos < 10) {
					scrollerypos=10
				}
				
			if(ie) {
	
			scrollerypos=scrollerypos-10
			scrollerobj.style.top=scrollerypos
			contentobj.style.top=-(scrollerypos*moveratio)
			}
			else if(ns4) {
			scrollerypos=scrollerypos-10
			scrollerobj.top=scrollerypos
			contentobj.top=-(scrollerypos*moveratio)			
			}
			}
		}
		
		function mouseclickdown(e) {
			if(os) {
				 if(scrollerypos > containerheight-scrollerheight-10) {
					scrollerypos=containerheight-scrollerheight-10
				}	
			if(ie) {
	
			scrollerypos=scrollerypos+10
			scrollerobj.style.top=scrollerypos
			contentobj.style.top=-(scrollerypos*moveratio)
			}
			else if(ns4) {
			scrollerypos=scrollerypos+10
			scrollerobj.top=scrollerypos
			contentobj.top=-(scrollerypos*moveratio)			
			}			
			}	
		}
		
		function mousemove(e) {
			if(os) {
			if(drag) {
			
				if(ie) {				
					offsetypos=event.y-initdrag+document.oldpos
				}
				else if(ns4) {
					offsetypos=e.pageY-initdrag+document.oldpos
				}
				//document.all.t.value=initdrag+"-"+offsetypos+"-"+scrollerypos
				if(offsetypos < 0) {
					offsetypos=0
				}
				else if(offsetypos > containerheight-scrollerheight) {
					offsetypos=containerheight-scrollerheight
				}
				
				if(ie) {
					if(event.x > 620 && event.x < 640) {
					
						scrollerypos=offsetypos						
						scrollerobj.style.top=offsetypos
						contentobj.style.top=-(offsetypos*moveratio)
					}
					else {
						drag=0
					}
				}
				else if(ns4) {
					if(e.pageX >620 && e.pageX < 640) {
						scrollerypos=offsetypos						
						scrollerobj.top=offsetypos						
						contentobj.top=-(offsetypos*moveratio)
					}
					else {
						drag=0
					}			
				}
			}
			}
		}

		if(os) {
		
		if(ns4) {
			
			document.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.MOUSEMOVE);
		}
				
		document.onmousedown=mousedown
		document.onmouseup=mouseup
		document.onmousemove=mousemove
		
		}