	
	var systemPanelCount = 0;	// Number of columns for dragable boxes
	var systemPanelColumnParentBoxId = 'body';	// Id of box that is parent of all your dragable boxes
	//var src_rightImage = 'images/arrow_right.gif';
	//var src_downImage = 'images/arrow_down.gif';
	//var src_refreshSource = 'images/refresh.gif';
	//var src_smallRightArrow = 'images/small_arrow.gif';
	
	var systemPanelTransparencyWhenDragging = true;
	//var txt_editLink = 'Edit';
	//var txt_editLink_stop = 'End edit';
	var systemPanelAutoScrollSpeed = 10;	// Autoscroll speed	- Higher = faster	
	var systemPanelDragObjectBorderWidth = 1;	// Border size of your RSS boxes - used to determine width of dotted rectangle
		
	//var nameOfCookie = 'dragable_rss_boxes';	// Name of cookie
	
	/* END USER VARIABLES */
	
	var systemPanelColumnParentBox;
	var systemPanelsObj;
	
	var systemPanelAjaxObjects = new Array();
	
	var systemPanelBoxIndex = 0;	
	var systemPanelAutoScrollActive = false;
	var systemPanelsArray = new Array();
	
	var systemPanelDragDropCounter = -1;
	var systemPanelDragObject = false;
	var systemPanelDragObjectNextSibling = false;
	var systemPanelDragObjectParent = false;
	var systemPanelDestinationObj = false;
	
	var systemPanelMouse_x;
	var systemPanelMouse_y;
	
	var systemPanelEl_x;
	var systemPanelEl_y;	
	
	var rectangleDiv;
	var systemPanelOkToMove = true;

	var systemPanelDocumentHeight = false;
	var systemPanelDocumentScrollHeight = false;
	var systemPanelDragableAreaWidth = false;
		
	var systemPanelOpera = navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false;
	
	var systemPanelStaticObjectArray = new Array();
	
	function systemPanelAutoScroll(direction,yPos)
	{
		var topPosFix = typeof window.pageYOffset != 'undefined' ?
			window.pageYOffset:document.documentElement &&
			document.documentElement.scrollTop ?
			document.documentElement.scrollTop: document.body.scrollTop?
			document.body.scrollTop:0;
		
		if(document.documentElement.scrollHeight>systemPanelDocumentScrollHeight && direction>0)return;
		if(systemPanelOpera)return;
		window.scrollBy(0,direction);
		if(!systemPanelDragObject)return;
		
		if(direction<0){
			if(topPosFix>0){
				systemPanelDragObject.style.top = (systemPanelEl_y - systemPanelMouse_y + yPos + topPosFix) + 'px';		
			}else{
				systemPanelAutoScrollActive = false;
			}
		}else{
			if(yPos>(systemPanelDocumentHeight-50)){	
				systemPanelDragObject.style.top = (systemPanelEl_y - systemPanelMouse_y + yPos + topPosFix) + 'px';			
			}else{
				systemPanelAutoScrollActive = false;
			}
		}
		if(systemPanelAutoScrollActive)setTimeout('systemPanelAutoScroll('+direction+',' + yPos + ')',5);
	}
		
	function systemPanelInitDragDropBox(e)
	{
		
		var topPosFix = typeof window.pageYOffset != 'undefined' ?
			window.pageYOffset:document.documentElement &&
			document.documentElement.scrollTop ?
			document.documentElement.scrollTop: document.body.scrollTop?
			document.body.scrollTop:0;
		
		systemPanelDragDropCounter = 1;
		if(document.all)e = event;
		
		if (e.target) source = e.target;
			else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;
		
		if(source.tagName.toLowerCase()=='img' || source.tagName.toLowerCase()=='a' || source.tagName.toLowerCase()=='input' || source.tagName.toLowerCase()=='td' || source.tagName.toLowerCase()=='tr' || source.tagName.toLowerCase()=='table')return;
		
	
		systemPanelMouse_x = e.clientX;
		systemPanelMouse_y = e.clientY;	
		var numericId = this.id.replace(/[^0-9]/g,'');
		systemPanelEl_x = systemPanelGetLeftPos(this.parentNode.parentNode)/1;
		systemPanelEl_y = systemPanelGetTopPos(this.parentNode.parentNode)/1 - topPosFix;
			
		systemPanelDragObject = this.parentNode.parentNode;
		
		systemPanelDocumentScrollHeight = document.documentElement.scrollHeight + 100 + systemPanelDragObject.offsetHeight;
		
		if(systemPanelDragObject.nextSibling){
			systemPanelDragObjectNextSibling = systemPanelDragObject.nextSibling;
			if(systemPanelDragObjectNextSibling.tagName!='DIV')systemPanelDragObjectNextSibling = systemPanelDragObjectNextSibling.nextSibling;
		}
		systemPanelDragObjectParent = systemPanelsArray[numericId]['parentObj'];
			
		systemPanelDragDropCounter = 0;
		systemPanelInitDragDropBoxTimer();	
		
		return false;
	}
	
	
	function systemPanelInitDragDropBoxTimer()
	{
		if(systemPanelDragDropCounter>=0 && systemPanelDragDropCounter<10){
			systemPanelDragDropCounter++;
			setTimeout('systemPanelInitDragDropBoxTimer()',10);
			return;
		}
		if(systemPanelDragDropCounter==10){
			systemPanelMouseoutBoxHeader(false,systemPanelDragObject);
		}
		
	}

	function systemPanelMoveDragableElement(e){
		var topPosFix = typeof window.pageYOffset != 'undefined' ?
			window.pageYOffset:document.documentElement &&
			document.documentElement.scrollTop ?
			document.documentElement.scrollTop: document.body.scrollTop?
			document.body.scrollTop:0;
			
		if(document.all)e = event;
		if(systemPanelDragDropCounter<10)return;
		
		if(document.all && e.button!=1 && !systemPanelOpera){
			systemPanelStop_dragDropElement();
			return;
		}
		
		if(document.body!=systemPanelDragObject.parentNode){
			systemPanelDragObject.style.width = (systemPanelDragObject.offsetWidth - (systemPanelDragObjectBorderWidth*2)) + 'px';
			systemPanelDragObject.style.position = 'absolute';	
			systemPanelDragObject.style.textAlign = 'left';
			if(systemPanelTransparencyWhenDragging){	
				systemPanelDragObject.style.filter = 'alpha(opacity=70)';
				systemPanelDragObject.style.opacity = '0.7';
			}	
			systemPanelDragObject.parentNode.insertBefore(rectangleDiv,systemPanelDragObject);
			rectangleDiv.style.display='block';
			document.body.appendChild(systemPanelDragObject);

			rectangleDiv.style.width = systemPanelDragObject.style.width;
			rectangleDiv.style.height = (systemPanelDragObject.offsetHeight - (systemPanelDragObjectBorderWidth*2)) + 'px'; 
		}
		
		if(e.clientY<50 || e.clientY>(systemPanelDocumentHeight-50)){
			if(e.clientY<50 && !systemPanelAutoScrollActive){
				systemPanelAutoScrollActive = true;
				systemPanelAutoScroll((systemPanelAutoScrollSpeed*-1),e.clientY);
			}
			
			if(e.clientY>(systemPanelDocumentHeight-50) && document.documentElement.scrollHeight<=systemPanelDocumentScrollHeight && !systemPanelAutoScrollActive){
				systemPanelAutoScrollActive = true;
				systemPanelAutoScroll(systemPanelAutoScrollSpeed,e.clientY);
			}
		}else{
			systemPanelAutoScrollActive = false;
		}		

		
		var leftPos = e.clientX;
		var topPos = e.clientY + topPosFix;
		
		systemPanelDragObject.style.left = (e.clientX - systemPanelMouse_x + systemPanelEl_x) + 'px';
		systemPanelDragObject.style.top = (systemPanelEl_y - systemPanelMouse_y + e.clientY + topPosFix) + 'px';
								
		if(!systemPanelOkToMove)return;
		systemPanelOkToMove = false;

		systemPanelDestinationObj = false;	
		rectangleDiv.style.display = 'none'; 
		
		var objFound = false;
		var tmpParentArray = new Array();
		
		if(!objFound){
			for(var no=1;no<systemPanelsArray.length;no++){
				if(systemPanelsArray[no]['obj']==systemPanelDragObject)continue;
				tmpParentArray[systemPanelsArray[no]['obj'].parentNode.id] = true;
				if(!objFound){
					var tmpX = systemPanelGetLeftPos(systemPanelsArray[no]['obj']);
					var tmpY = systemPanelGetTopPos(systemPanelsArray[no]['obj']);

					if(leftPos>tmpX && leftPos<(tmpX + systemPanelsArray[no]['obj'].offsetWidth) && topPos>(tmpY-20) && topPos<(tmpY + (systemPanelsArray[no]['obj'].offsetHeight/2))){
						
						systemPanelDestinationObj = systemPanelsArray[no]['obj'];
						if(systemPanelDestinationObj.parentNode.id.indexOf('systemPanelsColumn')>=0){
							systemPanelDestinationObj.parentNode.insertBefore(rectangleDiv,systemPanelsArray[no]['obj']);
							rectangleDiv.style.display = 'block';
							objFound = true;
						}
						break;
						
					}
					
					if(leftPos>tmpX && leftPos<(tmpX + systemPanelsArray[no]['obj'].offsetWidth) && topPos>=(tmpY + (systemPanelsArray[no]['obj'].offsetHeight/2)) && topPos<(tmpY + systemPanelsArray[no]['obj'].offsetHeight)){
						objFound = true;
						if(systemPanelsArray[no]['obj'].nextSibling){
							
							systemPanelDestinationObj = systemPanelsArray[no]['obj'].nextSibling;
							if(systemPanelDestinationObj.parentNode.id.indexOf('systemPanelsColumn')>=0){
								if(!systemPanelDestinationObj.tagName)systemPanelDestinationObj = systemPanelDestinationObj.nextSibling;
								if(systemPanelDestinationObj!=rectangleDiv)systemPanelDestinationObj.parentNode.insertBefore(rectangleDiv,systemPanelDestinationObj);
							}
						}else{
							systemPanelDestinationObj = systemPanelsArray[no]['obj'].parentNode;
							if(systemPanelDestinationObj.id.indexOf('systemPanelsColumn')>=0){
								systemPanelsArray[no]['obj'].parentNode.appendChild(rectangleDiv);
							}
						}
						rectangleDiv.style.display = 'block';
						break;					
					}
					
					
					if(!systemPanelsArray[no]['obj'].nextSibling && leftPos>tmpX && leftPos<(tmpX + systemPanelsArray[no]['obj'].offsetWidth)
					&& topPos>(tmpY + (systemPanelsArray[no]['obj'].offsetHeight))){
						systemPanelDestinationObj = systemPanelsArray[no]['obj'].parentNode;
						if(systemPanelDestinationObj.id.indexOf('systemPanelsColumn')>=0){
							systemPanelsArray[no]['obj'].parentNode.appendChild(rectangleDiv);	
							rectangleDiv.style.display = 'block';	
							objFound = true;
						}				
						
					}
				}
				
			}
		
		}
		
		if(!objFound){
			
			for(var no=1;no<=systemPanelCount;no++){
				if(!objFound){
					var obj = document.getElementById('systemPanelsColumn' + no);			
					
						var left = systemPanelGetLeftPos(obj)/1;						
					
						var width = obj.offsetWidth;
						if(leftPos>left && leftPos<(left+width)){
							systemPanelDestinationObj = obj;
							if(systemPanelDestinationObj.id.indexOf('systemPanelsColumn')>=0){
								obj.appendChild(rectangleDiv);
								rectangleDiv.style.display='block';
								objFound=true;		
							}
						}				
					
				}
			}		
			
		}
	
		setTimeout('systemPanelOkToMove=true',5);
		
	}
	
	function systemPanelStop_dragDropElement()
	{
		
		if(systemPanelDragDropCounter<10){
			systemPanelDragDropCounter = -1
			return;
		}
		systemPanelDragDropCounter = -1;
		if(systemPanelTransparencyWhenDragging){
			systemPanelDragObject.style.filter = null;
			systemPanelDragObject.style.opacity = null;
		}		
		systemPanelDragObject.style.position = 'static';
		systemPanelDragObject.style.width = null;
		var numericId = systemPanelDragObject.id.replace(/[^0-9]/g,'');
		if(systemPanelDestinationObj && systemPanelDestinationObj.id!=systemPanelDragObject.id){
			
			if(systemPanelDestinationObj.id.indexOf('systemPanelsColumn')>=0){
				systemPanelDestinationObj.appendChild(systemPanelDragObject);
				systemPanelsArray[numericId]['parentObj'] = systemPanelDestinationObj;
			}else{
				systemPanelDestinationObj.parentNode.insertBefore(systemPanelDragObject,systemPanelDestinationObj);
				systemPanelsArray[numericId]['parentObj'] = systemPanelDestinationObj.parentNode;
			}
							
		}else{
			if(systemPanelDragObjectNextSibling){
				systemPanelDragObjectParent.insertBefore(systemPanelDragObject,systemPanelDragObjectNextSibling);	
			}else{
				systemPanelDragObjectParent.appendChild(systemPanelDragObject);
			}				
			
			
		}
	
		systemPanelAutoScrollActive = false;
		rectangleDiv.style.display = 'none'; 
		systemPanelDragObject = false;
		systemPanelDragObjectNextSibling = false;
		systemPanelDestinationObj = false;
		

		systemPanelDocumentHeight = systemPanelPageHeight();	
	}
	
	function systemPanelPageHeight(){
		return window.innerHeight != null ? window.innerHeight :
		document.documentElement
		&& document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.body != null?
		document.body.clientHeight : null;
	} 
	
	function systemPanelGetTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
	  }
	  return returnValue;
	}
	
	function systemPanelGetLeftPos(inputObj)
	{
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
	  }
	  return returnValue;
	}
		
		
	function systemPanelMouseoverBoxHeader()
	{
		if(systemPanelDragDropCounter==10)return;
		var id = this.id.replace(/[^0-9]/g,'');
		if(document.getElementById('systemPanelEditLink' + id))document.getElementById('systemPanelEditLink' + id).style.visibility = 'visible';
		
	}
	function systemPanelMouseoutBoxHeader(e,obj)
	{
		if(!obj)obj=this;
		
		var id = obj.id.replace(/[^0-9]/g,'');
		
	}
	
	function systemPanelRefreshRSS()
	{
	}
	
	function systemPanelShowHideBoxContent(e,inputObj)
	{
	}
	
	function systemPanelMouseover_CloseButton()
	{
	}
	
	function systemPanelHighlightCloseButton()
	{
	}
	
	function systemPanelMouseout_CloseButton()
	{
	}
	
	function systemPanelClosesystemPanel(e,inputObj)
	{
		
	}
	
	
	
	
	function systemPanelAddBoxHeader(parentObj,externalUrl,notDrabable)
	{
		var div = document.getElementById('systemPanelHeader' + systemPanelBoxIndex);
		
		div.onmouseover = systemPanelMouseoverBoxHeader;
		div.onmouseout = systemPanelMouseoutBoxHeader;
		if(!notDrabable){
			div.onmousedown = systemPanelInitDragDropBox;
		}
	}
	
	
	
	function systemPanelCreateABox(columnIndex,heightOfBox,externalUrl,uniqueIdentifier,notDragable)
	{
		systemPanelBoxIndex++;
		if (!notDragable) {
			var maindiv = document.getElementById('systemPanel' + systemPanelBoxIndex);
			var div = document.getElementById('systemPanelInner' + systemPanelBoxIndex);
			
			systemPanelAddBoxHeader(div,externalUrl,notDragable);
			
			var obj = document.getElementById('systemPanelsColumn' + columnIndex);		
			var subs = obj.getElementsByTagName('DIV');
			
			systemPanelsArray[systemPanelBoxIndex] = new Array();
			systemPanelsArray[systemPanelBoxIndex]['obj'] = maindiv;
			systemPanelsArray[systemPanelBoxIndex]['parentObj'] = maindiv.parentNode;
			systemPanelsArray[systemPanelBoxIndex]['uniqueIdentifier'] = uniqueIdentifier;
			systemPanelsArray[systemPanelBoxIndex]['heightOfBox'] = heightOfBox;
			systemPanelsArray[systemPanelBoxIndex]['boxState'] = 1;	// Expanded
			
			temp = maindiv.parentNode.innerHTML;
			temp = temp.replace(/</g, '&lt;');
			temp = temp.replace(/>/g, '&gt;');
			temp = temp + '<hr>';
			
			systemPanelStaticObjectArray[uniqueIdentifier] = systemPanelBoxIndex;
		} else {
			var maindiv = document.getElementById('systemPanel' + systemPanelBoxIndex);
			systemPanelsArray[systemPanelBoxIndex] = new Array();
			systemPanelsArray[systemPanelBoxIndex]['obj'] = maindiv;
			systemPanelsArray[systemPanelBoxIndex]['parentObj'] = maindiv.parentNode;
			systemPanelsArray[systemPanelBoxIndex]['uniqueIdentifier'] = uniqueIdentifier;
			systemPanelsArray[systemPanelBoxIndex]['heightOfBox'] = null;
			systemPanelsArray[systemPanelBoxIndex]['boxState'] = null;	// Expanded
			
		}
		return systemPanelBoxIndex;
		
	}
		
	function systemPanelCancelSelectionEvent(e)
	{
		if(document.all)e = event;
		
		if (e.target) source = e.target;
			else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;
		if(source.tagName.toLowerCase()=='input')return true;
						
		if(systemPanelDragDropCounter>=0)return false; else return true;	
		
	}
	
	function systemPanelCancelEvent()
	{
		return false;
	}
	
	function systemPanelInitEvents()
	{
		document.body.onmousemove = systemPanelMoveDragableElement;
		document.body.onmouseup = systemPanelStop_dragDropElement;
		document.body.onselectstart = systemPanelCancelSelectionEvent;
		document.body.ondragstart = systemPanelCancelEvent;	
		
		systemPanelDocumentHeight = systemPanelPageHeight();	
		
	}
	
	function systemPanelClearCookiesForPanels()
	{
		var cookieValue = Get_Cookie(nameOfCookie);
		while(cookieValue && cookieValue!=''){
			Set_Cookie(nameOfCookie + cookieCounter,'',-500);
			cookieCounter++;
			var cookieValue = Get_Cookie(nameOfCookie + cookieCounter);
		}		
		
	}		
	
//	function disableBoxDrag(systemPanelBoxIndex)
//	{
			//document.getElementById('systemPanelHeader' + systemPanelBoxIndex).onmousedown = '';
			//document.getElementById('systemPanelHeader' + systemPanelBoxIndex).style.cursor = 'default';		
//	}
	
	function systemPanelInitsystemPanelsScript()
	{
		rectangleDiv = document.createElement('DIV');
		rectangleDiv.id='rectangleDiv';
		rectangleDiv.style.display='none';
		document.body.appendChild(rectangleDiv);
		systemPanelInitEvents();	// Always the third line of this function		
		systemPanelBuildPanels();	// Create default boxes.
	}


