// JavaScript Document

<!--
	var savedTarget=null; // The target layer (effectively vidPane)
   	var savedParent=null;
   	var orgCursor=null;   // The original Cursor (mouse) Style so we can restore it
   	var dragOK=false;     // True if we're allowed to move the element under mouse
   	var dragXoffset=0;    // How much we've moved the element on the horozontal
   	var dragYoffset=0;    // How much we've moved the element on the verticle
   
   	function showWindow(src,caption)
	{
		divObj='eventwindow';
		
		var windowObj=getObj(divObj);
		var allowance=10;
		
		imgObj=new Image;
		imgObj.src=src;	
		
		windowObj.style.width=imgObj.width + (2*allowance) + 'px';
		//windowObj.style.height=imgObj.height;

		if (!windowObj) return false;
		
		var screenW=screen.width;
		
		if (window.innerHeight)
		{
			  toppos = window.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
			toppos = document.documentElement.scrollTop;
			
		}
		else if (document.body)
		{
			  toppos = document.body.scrollTop;
		}
		
        windowObj.innerHTML='<div class="drag_handle"><div id="drag_title">Enlarged Image</div><A HREF="javascript: hideWindow(\'' + divObj + '\')"><div id="drag_close">x</div></A></div>';
        var vidstring ='<div class="drag_body"><img src="' + src + '" /><div class="drag_caption">' + caption + '</div></div>';
        windowObj.innerHTML+=vidstring;
		
		windowObj.style.visibility='visible';
		
		windowObj.style.left=((screenW/2)-(windowObj.offsetWidth/2)) + 'px';
		windowObj.style.top=(toppos + 10) + 'px';
   	}
	
	function hideWindow(Obj)
	{
		var windowObj=getObj(Obj);
		if (!windowObj) return false;
			
		windowObj.style.visibility='hidden';
         windowObj.innerHTML=''; 
	}

   	function moveHandler(e)
	{
      	if (e == null) { e = window.event } 
      	if (e.button<=1&&dragOK)
		{
         	savedParent.style.left=e.clientX-dragXoffset+'px';
         	savedParent.style.top=e.clientY-dragYoffset+'px';
         	return false;
      	}
   	}

   	function cleanup(e) 
	{
      	document.onmousemove=null;
      	document.onmouseup=null;
		savedTarget.style.cursor=orgCursor;
	  	//savedParent.style.filter='alpha(opacity=100)';
	  	//savedParent.style.opacity='1';
      	dragOK=false;
   	}

   	function dragHandler(e)
	{
    	var cursor_type='-moz-grabbing';
      	if (e == null) { e = window.event; cursor_type='move';} 
      	var target = e.target != null ? e.target : e.srcElement;
      	if (target.className=="drag_handle") 
		{    
			orgCursor=target.style.cursor;
			target.style.cursor=cursor_type;
			savedTarget=target;
		 	var parentBox=target.parentNode;
			if (parentBox.className=="draggable")
			{
		 		savedParent=parentBox;
		 		//parentBox.style.filter='alpha(opacity=50)';
		 		//parentBox.style.opacity='0.5';
         		dragOK=true;
         		dragXoffset=e.clientX-parseInt(parentBox.style.left);
         		dragYoffset=e.clientY-parseInt(parentBox.style.top);
         		document.onmousemove=moveHandler;
         		document.onmouseup=cleanup;
         		return false;
			}
      	}
   }
   
   function getObj(id)
   {
	   var Obj=document.getElementById(id);
		return Obj;
   }
   document.onmousedown=dragHandler;
 //-->
