<!--
var _startX = 0;			// mouse starting positions
var _startY = 0;
var _offsetX = 0;			// current element offset
var _offsetY = 0;
var _dragElement;			// needs to be passed from OnMouseDown to OnMouseMove
var _oldZIndex = 0;			// we temporarily increase the z-index during drag
var isElementloaded = false;
var creditsText = '';
var Divref =null;
InitDragDrop();

function InitDragDrop()
{
	document.onmousedown = OnMouseDown;
	document.onmouseup = OnMouseUp;
}

function OnMouseDown(e)
{
	// IE is retarded and doesn't pass the event object
	if (e == null) 
		e = window.event; 
	
	// IE uses srcElement, others use target
	var target = e.target != null ? e.target : e.srcElement;
	


	// for IE, left click == 1
	// for Firefox, left click == 0
	if ((e.button == 1 && window.event != null || 
		e.button == 0) && 
		target.id == 'MOVE')
		{
		// grab the mouse position
		_startX = e.clientX;
		_startY = e.clientY;
		
		// grab the clicked element's position
		_offsetX = ExtractNumber(Divref.style.left);
		_offsetY = ExtractNumber(Divref.style.top);
		
		// bring the clicked element to the front while it is being dragged
		_oldZIndex = Divref.style.zIndex;
		Divref.style.zIndex = 10000;
		
		// we need to access the element in OnMouseMove
		_dragElement = Divref;

		// tell our code to start moving the element with the mouse
		document.onmousemove = OnMouseMove;
		
		// cancel out any text selections
		document.body.focus();
		
		// prevent text selection in IE
		document.onselectstart = function () { return false; };
		// prevent IE from trying to drag an image
		Divref.ondragstart = function() { return false; };
		
		// prevent text selection (except IE)
		return false;
	}
}

function ExtractNumber(value)
{
	var n = parseInt(value);
	
	return n == null || isNaN(n) ? 0 : n;
}

function OnMouseMove(e)
{
	if (e == null) 
		var e = window.event; 

	// this is the actual "drag code"
	_dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px';
	_dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px';
	
	
}

function OnMouseUp(e)
{
	if (_dragElement != null)
	{
		_dragElement.style.zIndex = _oldZIndex;

		// we're done with these events until the next OnMouseDown
		document.onmousemove = null;
		document.onselectstart = null;
		_dragElement.ondragstart = null;

		// this is how we know we're not dragging
		_dragElement = null;
		
		
	}
}

	function createPopupElement()
	{
	  var obj = document.createElement("DIV");
	   document.body.appendChild(obj);
	   obj.style.backgroundColor = '#FFFFFF'; 
	   obj.style.border='inset 1px black'; 
	   obj.style.padding='9px'; 
	   obj.style.display='none'; 
	   obj.style.position='absolute'; 
	   obj.style.zIndex  = '100000';
       obj.style.filter='alpha(opacity=100)';
	   obj.style.opacity='-1'; 
	   obj.style.MozOpacity ='1';
	   isElementloaded = true;
	   return obj;
	}
	
	 function closePopup()
	 	{
	 	    Divref.style.display = 'none';
			Divref.innerHTML='';
	 	}
		
		function openPopup(url,left,top,width,height,scrolling)
		{	
			  if(isElementloaded)
			  {
				closePopup();
				PopulatedWindow(Divref,url,left,top,width,height,scrolling);
			  }
			  else
			  {
				   	var obj = createPopupElement();
					Divref = obj;
					PopulatedWindow(obj,url,left,top,width,height,scrolling);
					
				   
			  }
		}
		
		function PopulatedWindow(obj,url,left,top,width,height,scrolling)
		{
			
			
			obj.innerHTML ='<table width="100%" border="0" cellspacing="2" cellpadding="2"><tr><td width="80%" style="font:Arial, Helvetica, sans-serif; font-size:10px;" align="left">'+creditsText+'</td><td><table width="100%" border="0"><tr><td align="center" class="Verdanagrey11">&nbsp;</td><td align="center" class="Verdanagrey11"><label onclick="closePopup()"style="text-decoration: none;font-weight: bold;FONT-SIZE: 11px;COLOR: #7F7F7F;FONT-FAMILY:Verdana;">CLOSE</label></td></tr></table></td></tr></table><iframe id="ifrm" frameborder="0" width="'+width+'" height="'+(height-50)+'" src="'+url+'" scrolling="'+scrolling+'"></iframe>';
		
		 
		    var winleft = parseInt(document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft )+parseInt(left);
		    var wintop = parseInt(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)+parseInt(top);
			
		   obj.style.left = winleft+"px";
		   obj.style.top = top+"px";
		   obj.style.width=width+"px"; 
		   obj.style.height=height+"px";
		   obj.style.display = "block"; 
		  
		}
