	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, January 2006
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Version:	1.0	: January 16th - 2006
				1.1 : January 31th - 2006 - Added cookie support - remember rss sources
				1.2 : July 13th - 2006 - Fixed a problem in the createRssBoxesFromCookie function
				
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/		
	
	/* USER VARIABLES */
	
	var pathPrefix = 'http://www.toenjes-portal.de/boxes/';		// Prefix der Pradangaben
	
	var numberOfColumns = 3;									// Anzahl an Spalten
	var columnParentBoxId = 'floatingBoxParentContainer';		// Id der Div-Box die die Feeds anzeigen soll
	var src_rightImage = pathPrefix + 'images/arrow_right.gif';
	var src_downImage = pathPrefix + 'images/arrow_down.gif';
	var src_bullet = pathPrefix + 'images/bullet.png';
	
	var src_refreshSource = 'images/refresh.gif';
	var src_smallRightArrow = 'images/small_arrow.gif';
	var src_wiki = 'images/wplogo.png';
	
	var transparencyWhenDragging = false;						// Festlegen, ob Boxen beim Verschieben transparent werden sollen
	var transparencyValue = 70;									// Transparenzwert in Prozent
	var txt_editLink = 'Bearbeiten';
	var txt_editLink_stop = 'Schlie&szlig;en';
	var autoScrollSpeed = 4;									// Autoscroll Geschwindigkeit	- Hoeher = schneller
	var dragObjectBorderWidth = 1;								// Randbreite der RSS-Boxen - Verwendet um die Breite des gepunkteten Rechteks zu bestimmen
	
	var useCookiesToRememberRSSSources = true;
	
	var nameOfCookie = 'toenjes-portal-boxes';					// Bezeichnung des Cookies
			
	var msgStatusLoad = "Lade Daten...";
	
	var msgFeedClose = "Entfernen";
	var msgFeedRefresh = "Aktualisieren";
	var msgFeedEditStart = "Feedeinstellungen bearbeiten";
	var msgFeedEditStop = "Bearbeiten beenden";
	
	// Anpassungen
	
	var showBoxStatusBar = false;								//Gibt an, ob die Statusleiste angezeigt wird
	
	var boxHeadHeightTemp = '10px';
	var boxHeadEditHeight = "200px";							//Hoehe der Bearbeiten-Box
	var boxHeadHeight = '20px';									//Hoehe der Kopfzeile
	var boxStatusHeight = '14px';
		
	var boxInfoHeight = 120;									//Mindesthoehe der Infobox
		
	var boxHeaderLength = 20;									//Laenge der Ueberschriften
				
	var classNameBoxColumn = 'dragableBoxesColumn';
	
	var classNameBox = 'box base-mini';
	
	var classNameBoxInner = 'dragableBoxInner';
	
	var classNameBoxHeader = 'head';
	
	var classNameBoxHeader_txt = 'dragableBoxHeader_txt';
	var classNameBoxExpand = 'dragableBoxExpand';
	
	var classNameBoxEdit = 'actions';
	var classNameBoxBack = 'actions';
	
	var classNameBoxEditLink = 'dragableBoxEditLink';
	var classNameBoxCloseLink = 'dragableBoxCloseLink';
	var classNameBoxRefreshSource = 'dragableBoxRefreshSource';
	
	var classNameBoxContent = 'content';
	
	var classNameBoxStatusBar = 'head 2';
	var classNameBoxFormButton = 'form-button-alt right';
	var classNameBoxFormInputBox = 'required-entry input-text';

	var listStyle = '';	//Style fuer Listen
	
	/* END USER VARIABLES */
	
	var columnParentBox;
	var dragableBoxesObj;
	
	var ajaxObjects = new Array();
	
	var boxIndex = 0;	
	var autoScrollActive = false;
	var dragableBoxesArray = new Array();
	
	var dragDropCounter = -1;
	var dragObject = false;
	var dragObjectNextSibling = false;
	var dragObjectParent = false;
	var destinationObj = false;
	
	var mouse_x;
	var mouse_y;
	
	var el_x;
	var el_y;	
	
	var rectangleDiv;
	var okToMove = true;

	var documentHeight = false;
	var documentScrollHeight = false;
	var dragableAreaWidth = false;
		
	var opera = navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false;
	var cookieCounter=0;
	var cookieRSSSources = new Array();
	
	var staticObjectArray = new Array();
	
	/*
	These cookie functions are downloaded from 
	http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
	*/	
	function Get_Cookie(name) { 
	   var start = document.cookie.indexOf(name+"="); 
	   var len = start+name.length+1; 
	   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
	   if (start == -1) return null; 
	   var end = document.cookie.indexOf(";",len); 
	   if (end == -1) end = document.cookie.length; 
	   return unescape(document.cookie.substring(len,end)); 
	} 
	// This function has been slightly modified
	function Set_Cookie(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	} 

	function autoScroll(direction,yPos){
		if(document.documentElement.scrollHeight>documentScrollHeight && direction>0)return;
		if(opera)return;
		window.scrollBy(0,direction);
		if(!dragObject)return;
		
		if(direction<0){
			if(document.documentElement.scrollTop>0){
				dragObject.style.top = (el_y - mouse_y + yPos + document.documentElement.scrollTop) + 'px';		
			}else{
				autoScrollActive = false;
			}
		}else{
			if(yPos>(documentHeight-50)){	
				dragObject.style.top = (el_y - mouse_y + yPos + document.documentElement.scrollTop) + 'px';			
			}else{
				autoScrollActive = false;
			}
		}
		if(autoScrollActive)setTimeout('autoScroll('+direction+',' + yPos + ')',5);
	}
		
	function initDragDropBox(e){
		
		
		dragDropCounter = 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;
		
	
		mouse_x = e.clientX;
		mouse_y = e.clientY;	
		var numericId = this.id.replace(/[^0-9]/g,'');
		el_x = getLeftPos(this.parentNode.parentNode)/1;
		el_y = getTopPos(this.parentNode.parentNode)/1 - document.documentElement.scrollTop;
			
		dragObject = this.parentNode.parentNode;
		
		documentScrollHeight = document.documentElement.scrollHeight + 100 + dragObject.offsetHeight;
		
		
		if(dragObject.nextSibling){
			dragObjectNextSibling = dragObject.nextSibling;
			if(dragObjectNextSibling.tagName!='DIV')dragObjectNextSibling = dragObjectNextSibling.nextSibling;
		}
		dragObjectParent = dragableBoxesArray[numericId]['parentObj'];
			
		dragDropCounter = 0;
		initDragDropBoxTimer();	
		
		return false;
	}
		
	function initDragDropBoxTimer(){
		if(dragDropCounter>=0 && dragDropCounter<10){
			dragDropCounter++;
			setTimeout('initDragDropBoxTimer()',10);
			return;
		}
		if(dragDropCounter==10){
			mouseoutBoxHeader(false,dragObject);
		}
		
	}

	function moveDragableElement(e){
		if(document.all)e = event;
		if(dragDropCounter<10)return;
		
		if(document.all && e.button!=1 && !opera){
			stop_dragDropElement();
			return;
		}
		
		if(document.body!=dragObject.parentNode){
			dragObject.style.width = (dragObject.offsetWidth - (dragObjectBorderWidth*2)) + 'px';
			dragObject.style.position = 'absolute';	
			dragObject.style.textAlign = 'left';
			if(transparencyWhenDragging){	
				dragObject.style.filter = 'alpha(opacity=' + transparencyValue + ')';
				dragObject.style.opacity =  (transparencyValue / 100);
			}	
			dragObject.parentNode.insertBefore(rectangleDiv,dragObject);
			rectangleDiv.style.display='block';
			document.body.appendChild(dragObject);

			rectangleDiv.style.width = dragObject.style.width;
			rectangleDiv.style.height = (dragObject.offsetHeight - (dragObjectBorderWidth*2)) + 'px'; 
			
		}
		
		if(e.clientY<50 || e.clientY>(documentHeight-50)){
			if(e.clientY<50 && !autoScrollActive){
				autoScrollActive = true;
				autoScroll((autoScrollSpeed*-1),e.clientY);
			}
			
			if(e.clientY>(documentHeight-50) && document.documentElement.scrollHeight<=documentScrollHeight && !autoScrollActive){
				autoScrollActive = true;
				autoScroll(autoScrollSpeed,e.clientY);
			}
		}else{
			autoScrollActive = false;
		}		

		
		var leftPos = e.clientX;
		var topPos = e.clientY + document.documentElement.scrollTop;
		
		dragObject.style.left = (e.clientX - mouse_x + el_x) + 'px';
		dragObject.style.top = (el_y - mouse_y + e.clientY + document.documentElement.scrollTop) + 'px';
								

		
		if(!okToMove)return;
		okToMove = false;

		destinationObj = false;	
		rectangleDiv.style.display = 'none'; 
		
		var objFound = false;
		var tmpParentArray = new Array();
		
		if(!objFound){
			for(var no=1;no<dragableBoxesArray.length;no++){
				if(dragableBoxesArray[no]['obj']==dragObject)continue;
				tmpParentArray[dragableBoxesArray[no]['obj'].parentNode.id] = true;
				if(!objFound){
					var tmpX = getLeftPos(dragableBoxesArray[no]['obj']);
					var tmpY = getTopPos(dragableBoxesArray[no]['obj']);

					if(leftPos>tmpX && leftPos<(tmpX + dragableBoxesArray[no]['obj'].offsetWidth) && topPos>(tmpY-20) && topPos<(tmpY + (dragableBoxesArray[no]['obj'].offsetHeight/2))){
						destinationObj = dragableBoxesArray[no]['obj'];
						destinationObj.parentNode.insertBefore(rectangleDiv,dragableBoxesArray[no]['obj']);
						rectangleDiv.style.display = 'block';
						objFound = true;
						break;
						
					}
					
					if(leftPos>tmpX && leftPos<(tmpX + dragableBoxesArray[no]['obj'].offsetWidth) && topPos>=(tmpY + (dragableBoxesArray[no]['obj'].offsetHeight/2)) && topPos<(tmpY + dragableBoxesArray[no]['obj'].offsetHeight)){
						objFound = true;
						if(dragableBoxesArray[no]['obj'].nextSibling){
							
							destinationObj = dragableBoxesArray[no]['obj'].nextSibling;
							if(!destinationObj.tagName)destinationObj = destinationObj.nextSibling;
							if(destinationObj!=rectangleDiv)destinationObj.parentNode.insertBefore(rectangleDiv,destinationObj);
						}else{
							destinationObj = dragableBoxesArray[no]['obj'].parentNode;
							dragableBoxesArray[no]['obj'].parentNode.appendChild(rectangleDiv);
						}
						rectangleDiv.style.display = 'block';
						break;					
					}
					
					
					if(!dragableBoxesArray[no]['obj'].nextSibling && leftPos>tmpX && leftPos<(tmpX + dragableBoxesArray[no]['obj'].offsetWidth)
					&& topPos>topPos>(tmpY + (dragableBoxesArray[no]['obj'].offsetHeight))){
						destinationObj = dragableBoxesArray[no]['obj'].parentNode;
						dragableBoxesArray[no]['obj'].parentNode.appendChild(rectangleDiv);	
						rectangleDiv.style.display = 'block';	
						objFound = true;				
						
					}
				}
				
			}
		
		}
		
		if(!objFound){
			
			for(var no=1;no<=numberOfColumns;no++){
				if(!objFound){
					var obj = document.getElementById(classNameBoxColumn + no);			
					
						var left = getLeftPos(obj)/1;						
					
						var width = obj.offsetWidth;
						if(leftPos>left && leftPos<(left+width)){
							destinationObj = obj;
							obj.appendChild(rectangleDiv);
							rectangleDiv.style.display='block';
							objFound=true;		
							
						}				
					
				}
			}		
			
		}
	

		setTimeout('okToMove=true',5);
		
	}
	
	function stop_dragDropElement(){
		
		if(dragDropCounter<10){
			dragDropCounter = -1
			return;
		}
		dragDropCounter = -1;
		if(transparencyWhenDragging){
			dragObject.style.filter = null;
			dragObject.style.opacity = null;
		}		
		dragObject.style.position = 'static';
		dragObject.style.width = null;
		var numericId = dragObject.id.replace(/[^0-9]/g,'');
		if(destinationObj && destinationObj.id!=dragObject.id){
			
			if(destinationObj.id.indexOf(classNameBoxColumn)>=0){
				destinationObj.appendChild(dragObject);
				dragableBoxesArray[numericId]['parentObj'] = destinationObj;
			}else{
				destinationObj.parentNode.insertBefore(dragObject,destinationObj);
				dragableBoxesArray[numericId]['parentObj'] = destinationObj.parentNode;
			}


							
		}else{
			if(dragObjectNextSibling){
				dragObjectParent.insertBefore(dragObject,dragObjectNextSibling);	
			}else{
				dragObjectParent.appendChild(dragObject);
			}				
			
			
		}
	

		
		autoScrollActive = false;
		rectangleDiv.style.display = 'none'; 
		dragObject = false;
		dragObjectNextSibling = false;
		destinationObj = false;
		
		if(useCookiesToRememberRSSSources)setTimeout('saveCookies()',100);

		documentHeight = document.documentElement.clientHeight;	
	}

	function saveCookies(){
		cookieCounter = 0;
		var tmpUrlArray = new Array();
		for(var no=1;no<=numberOfColumns;no++)
		{
			var parentObj = document.getElementById(classNameBoxColumn + no);
			
			var items = parentObj.getElementsByTagName('DIV');
			if(items.length==0)continue;
			
			var item = items[0];
			
			var tmpItemArray = new Array();
			while(item){
				var boxIndex = item.id.replace(/[^0-9]/g,'');
				if(item.id!='rectangleDiv'){
					tmpItemArray[tmpItemArray.length] = boxIndex;
				}	
				item = item.nextSibling;			
			}
			
			var columnIndex = no;
			
			for(var no2=tmpItemArray.length-1;no2>=0;no2--){
				var boxIndex = tmpItemArray[no2];
				var url = dragableBoxesArray[boxIndex]['rssUrl'];
				var heightOfBox = dragableBoxesArray[boxIndex]['heightOfBox'];
				var maxRssItems = dragableBoxesArray[boxIndex]['maxRssItems'];
				var minutesBeforeReload = dragableBoxesArray[boxIndex]['minutesBeforeReload'];
				var uniqueIdentifier = dragableBoxesArray[boxIndex]['uniqueIdentifier'];
				var state = dragableBoxesArray[boxIndex]['boxState'];
				if(!tmpUrlArray[url]){
					tmpUrlArray[url] = true;
					
					Set_Cookie(nameOfCookie + cookieCounter,url + '#;#' + columnIndex + '#;#' + maxRssItems + '#;#' + heightOfBox + '#;#' + minutesBeforeReload + '#;#' + uniqueIdentifier + '#;#' + state ,60000);
					cookieRSSSources[url] = cookieCounter;
					cookieCounter++;	
				
				}else{
					
					Set_Cookie(nameOfCookie + cookieCounter,'' + '#;#' + columnIndex + '#;#' + '' + '#;#' + heightOfBox + '#;#' + '' + '#;#' + uniqueIdentifier ,60000);
					cookieCounter++;
				}		
				
			}
		}
	}
	
	function getTopPos(inputObj){		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
	  }
	  return returnValue;
	}
	
	function getLeftPos(inputObj){
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null){
	  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
	  }
	  return returnValue;
	}
		
	function createColumns(){
		//Anlegen von Spalten
		if(!columnParentBoxId){
			alert('No parent box defined for your columns');
			return;
		}
		columnParentBox = document.getElementById(columnParentBoxId);
		var columnWidth = Math.floor(100/numberOfColumns);
		var sumWidth = 0;
		for(var no=0;no<numberOfColumns;no++){
			var div = document.createElement('DIV');
			
			if(no==(numberOfColumns-1))columnWidth = 100 - sumWidth;
			sumWidth = sumWidth + columnWidth;
			
			//jQuery("#" + columnParentBoxId).add("<div id=\"" + classNameBoxColumn + (no+1) + "\" class=\"column\" style=\"width:" + columnWidth + "%;\"><hr style=\"clear:both; visibility: hidden;\"/></div>");
			
			div.className = 'column';
			div.style.cssText = 'width:'+columnWidth+'%;';

			div.id = classNameBoxColumn + (no+1);
			columnParentBox.appendChild(div);
			
			var clearObj = document.createElement('HR');	
			clearObj.style.clear = 'both';
			clearObj.style.visibility = 'hidden';
			div.appendChild(clearObj);
		}
		
		
		
		var clearingDiv = document.createElement('DIV');
		columnParentBox.appendChild(clearingDiv);
		clearingDiv.style.clear='both';
		
	}
	
	function mouseoverBoxHeader(){
		//Steuerelemente einblenden
		if(dragDropCounter==10)return;
		var id = this.id.replace(/[^0-9]/g,'');
		
		jQuery("#" + classNameBoxExpand + id).css("visibility","visible");
		jQuery("#" + classNameBoxRefreshSource + id).css("visibility","visible");
		jQuery("#" + classNameBoxCloseLink + id).css("visibility","visible");
				
		jQuery("#" + classNameBoxEditLink + id).css("visibility","visible");
		
	}
	
	function mouseoutBoxHeader(e,obj){
		//Steuerelemente ausblenden
		
		if(!obj)obj=this;
		
		var id = obj.id.replace(/[^0-9]/g,'');
		jQuery("#" + classNameBoxExpand + id).css("visibility","hidden");
		jQuery("#" + classNameBoxRefreshSource + id).css("visibility","hidden");
		jQuery("#" + classNameBoxCloseLink + id).css("visibility","hidden");
		
		jQuery("#" + classNameBoxEditLink + id).css("visibility","hidden");
	}
	
	function refreshRSS(){
		
		reloadRssData(this.id.replace(/[^0-9]/g,''));
		setTimeout('dragDropCounter=-5',5);
	}
	
	function showHideBoxContent(e,inputObj){
		if(document.all)e = event;
		if(!inputObj)inputObj=this;
		
		var numericId = inputObj.id.replace(/[^0-9]/g,'');
		var obj = document.getElementById(classNameBoxContent + numericId);
		
		obj.style.display = inputObj.src.indexOf(src_rightImage)>=0?'none':'block';
		inputObj.src = inputObj.src.indexOf(src_rightImage)>=0?src_downImage:src_rightImage
		
		dragableBoxesArray[numericId]['boxState'] = obj.style.display=='block'?1:0;
		saveCookies();
		setTimeout('dragDropCounter=-5',5);
	}
	
	function mouseover_CloseButton(){
		this.className = 'closeButton_over';	
		setTimeout('dragDropCounter=-5',5);
	}
	
	function highlightCloseButton(){
		this.className = 'closeButton_over';	
	}
	
	function mouseout_CloseButton(){
		this.className = 'closeButton';	
	}
	
	function closeDragableBox(e,inputObj){
		if(!inputObj)inputObj = this;
		var numericId = inputObj.id.replace(/[^0-9]/g,'');
		document.getElementById(classNameBox + numericId).style.display='none';	
		
		Set_Cookie(nameOfCookie + cookieRSSSources[dragableBoxesArray[numericId]['rssUrl']],'none' ,60000);

		setTimeout('dragDropCounter=-5',5);
		
	}
	
	function editRSSContent(){
		var numericId = this.id.replace(/[^0-9]/g,'');
		var obj = document.getElementById(classNameBoxEdit + numericId);
		if(obj.style.display=='none'){
			//Bearbeiten
			obj.style.display='block';
			this.innerHTML = txt_editLink_stop;
			this.title = msgFeedEditStop;
			
			//boxHeadHeightTemp = document.getElementById(classNameBoxHeader + numericId).style.height;
			//document.getElementById(classNameBoxHeader + numericId).style.height = boxHeadHeight + document.getElementById(classNameBoxEdit + numericId).style.height + 3;
			boxHeadHeightTemp = jQuery(classNameBoxHeader + numericId).height();
			jQuery('#' + classNameBoxHeader + numericId).height(boxHeadHeight + jQuery('#' + classNameBoxEdit + numericId) +3);
		}else{
			//Nicht bearbeiten
			obj.style.display='none';
			this.innerHTML = txt_editLink;
			this.title = msgFeedEditStart;
			document.getElementById(classNameBoxHeader + numericId).style.height = boxHeadHeightTemp;
		}
		setTimeout('dragDropCounter=-5',5);
	}
	
	function showStatusBarMessage(numericId,message){
		if(showBoxStatusBar) document.getElementById(classNameBoxStatusBar + numericId).innerHTML = message;
	}
	
	function addBoxHeader(parentObj,externalUrl,notDrabable){
		//Ueberschrift

		//"<div id=\"" + classNameBoxHeader + boxIndex + "\"  class=\"" + classNameBoxHeader + "\">
		//  <span id=\"SPAN_" + classNameBoxExpand + boxIndex + "\" style=\"display: inline; float: left;\">
		//	  <img src=\"" + src_rightImage + "\" id=\"" + classNameBoxExpand + boxIndex + "\" style=\"visibility: hidden; cursor: pointer; display: inline; float: left;\">
		//  </span>
		//</div>"
		
		var div = document.createElement('DIV');
		div.className = classNameBoxHeader;
		div.id = classNameBoxHeader + boxIndex;
		
		div.onmouseover = mouseoverBoxHeader;
		div.onmouseout = mouseoutBoxHeader;
		
		if(!notDrabable){
			div.onmousedown = initDragDropBox;
			div.style.cursor = 'move';
		}
		
		var pImg = document.createElement('SPAN');
		pImg.id = 'SPAN_' + classNameBoxExpand + boxIndex;
		pImg.style.display = 'inline';
		pImg.style.cssFloat = 'left';
				
		div.appendChild(pImg);
		
		var image = document.createElement('IMG');
		image.id = classNameBoxExpand + boxIndex;
		image.src = src_rightImage;
		image.style.visibility = 'hidden';	
		image.style.cursor = 'pointer';
		
		image.style.display = 'inline';
		image.style.cssFloat = "left";
		
		image.onmousedown = showHideBoxContent;	
		pImg.appendChild(image);
				
		var textSpan = document.createElement('SPAN');
		textSpan.id = classNameBoxHeader_txt + boxIndex;
		
		textSpan.style.display = 'inline';
		textSpan.style.cssFloat = "left";

		div.appendChild(textSpan);
				
		parentObj.appendChild(div);	

		var closeLink = document.createElement('A');
		closeLink.style.cssText = 'float:right';
		closeLink.style.styleFloat = 'right';
		closeLink.id = classNameBoxCloseLink + boxIndex;
		closeLink.innerHTML = 'X';
		closeLink.title = msgFeedClose;
		closeLink.className = 'closeButton';
		closeLink.onmouseover = mouseover_CloseButton;
		closeLink.onmouseout = mouseout_CloseButton;
		closeLink.style.cursor = 'pointer';
		closeLink.style.visibility = 'hidden';
		closeLink.style.marginLeft = '3px';
		closeLink.onmousedown = closeDragableBox;
		div.appendChild(closeLink);

		/*
		var image = document.createElement('IMG');
		image.src = src_refreshSource;
		image.id = classNameBoxRefreshSource + boxIndex;
		image.style.cssText = 'float:right';
		image.style.styleFloat = 'right';
		image.style.visibility = 'hidden';
		image.onclick = refreshRSS;
		image.style.cursor = 'pointer';
		if(!externalUrl)image.style.display='none';
		div.appendChild(image);
		*/
		
		var refreshLink = document.createElement('A');
		refreshLink.style.cssText = 'float:right';
		refreshLink.style.styleFloat = 'right';
		refreshLink.id = classNameBoxRefreshSource + boxIndex;
		refreshLink.innerHTML = 'R';
		refreshLink.title = msgFeedRefresh;
		//refreshLink.className = 'closeButton';
		refreshLink.onclick = refreshRSS;

		refreshLink.style.cursor = 'pointer';
		refreshLink.style.visibility = 'hidden';
		refreshLink.style.marginLeft = '3px'
		//refreshLink.onmousedown = closeDragableBox;
		div.appendChild(refreshLink);
	
	}
	
	function saveFeed(boxIndex){
		var heightOfBox = dragableBoxesArray[boxIndex]['heightOfBox'] = document.getElementById('heightOfBox[' + boxIndex + ']').value;
		var intervalObj = dragableBoxesArray[boxIndex]['intervalObj'];
		if(intervalObj)clearInterval(intervalObj);
		
		if(heightOfBox && heightOfBox>40){
			var contentObj = document.getElementById(classNameBoxContent + boxIndex);
			contentObj.style.height = heightOfBox + 'px';
			contentObj.setAttribute('heightOfBox',heightOfBox);
			contentObj.heightOfBox = heightOfBox;	
			if(document.all)contentObj.style.overflowY = 'auto';else contentObj.style.overflow='-moz-scrollbars-vertical;';
			if(opera)contentObj.style.overflow='auto';			
			
		}
		
		dragableBoxesArray[boxIndex]['rssUrl'] = document.getElementById('rssUrl[' + boxIndex + ']').value;
		dragableBoxesArray[boxIndex]['heightOfBox'] = heightOfBox;
		dragableBoxesArray[boxIndex]['maxRssItems'] = document.getElementById('maxRssItems[' + boxIndex + ']').value;
		dragableBoxesArray[boxIndex]['heightOfBox'] = document.getElementById('heightOfBox[' + boxIndex + ']').value;
		dragableBoxesArray[boxIndex]['minutesBeforeReload'] = document.getElementById('minutesBeforeReload[' + boxIndex + ']').value;
		
		if(dragableBoxesArray[boxIndex]['minutesBeforeReload'] && dragableBoxesArray[boxIndex]['minutesBeforeReload']>5){
			var tmpInterval = setInterval("reloadRssData(" + boxIndex + ")",(dragableBoxesArray[boxIndex]['minutesBeforeReload']*1000*60));	
			dragableBoxesArray[boxIndex]['intervalObj'] = tmpInterval;
		}
		reloadRssData(boxIndex);
		
		if(useCookiesToRememberRSSSources)setTimeout('saveCookies()',100);
		
	}
	
	function addRSSEditContent(parentObj){

		var editLink = document.createElement('A');
		editLink.href = '#';
		editLink.onclick = cancelEvent;
		editLink.style.cssText = 'float:right';
		editLink.style.styleFloat = 'right';
		editLink.id = classNameBoxEditLink + boxIndex;
		editLink.innerHTML = txt_editLink;
		editLink.className = classNameBoxEditLink;
		editLink.style.cursor = 'pointer';
		editLink.style.visibility = 'hidden';
		editLink.onmousedown = editRSSContent;
		parentObj.appendChild(editLink);	
				
		var editBox = document.createElement('DIV');
		editBox.style.clear='both';
		editBox.id = classNameBoxEdit + boxIndex;
		editBox.style.display='none';
		
		var content = '<form><div style="text-align: left;">Feed-Adresse:&nbsp;<input type="text" class="' + classNameBoxFormInputBox + '" id="rssUrl[' + boxIndex + ']" value="' + dragableBoxesArray[boxIndex]['rssUrl'] + '" size="25" maxlength="255"><br>'
		+ 'Eintr&auml;ge:&nbsp;<input type="text" class="' + classNameBoxFormInputBox + '" id="maxRssItems[' + boxIndex + ']" onblur="this.value = this.value.replace(/[^0-9]/g,\'\');if(!this.value)this.value=' + dragableBoxesArray[boxIndex]['maxRssItems'] + '" value="' + dragableBoxesArray[boxIndex]['maxRssItems'] + '" size="2" maxlength="2"><br>Feste H&ouml;he:&nbsp;<input type="text" class="' + classNameBoxFormInputBox + '" id="heightOfBox[' + boxIndex + ']" onblur="this.value = this.value.replace(/[^0-9]/g,\'\');if(!this.value)this.value=' + dragableBoxesArray[boxIndex]['heightOfBox'] + '" value="' + dragableBoxesArray[boxIndex]['heightOfBox'] + '" size="2" maxlength="3"><br>'
		+'Aktualisierungsintervall:&nbsp;<input type="text" class="' + classNameBoxFormInputBox + '" id="minutesBeforeReload[' + boxIndex + ']" onblur="this.value = this.value.replace(/[^0-9]/g,\'\');if(!this.value || this.value/1<5)this.value=' + dragableBoxesArray[boxIndex]['minutesBeforeReload'] + '" value="' + dragableBoxesArray[boxIndex]['minutesBeforeReload'] + '" size="2" maxlength="3">&nbsp;Minuten<br></div>'
		+'<input type="button" class="' + classNameBoxFormButton + '" onclick="saveFeed(' + boxIndex + ')" value="Speichern"></form>';
		editBox.innerHTML = content;
		editBox.className = classNameBoxEdit;
		
		parentObj.appendChild(editBox);		
		
	}
	
	
	function addBoxContentContainer(parentObj,heightOfBox){
		var div = document.createElement('DIV');
		div.className = classNameBoxContent;
		
		//div.style.padding = "3px";
		div.style.clear = "both";
		
		if(opera)div.style.clear='none';
		div.id = classNameBoxContent + boxIndex;
		parentObj.appendChild(div);			
		if(heightOfBox && heightOfBox/1>40){
			div.style.height = heightOfBox + 'px';
			div.setAttribute('heightOfBox',heightOfBox);
			div.heightOfBox = heightOfBox;	
			if(document.all)div.style.overflowY = 'auto';else div.style.overflow='-moz-scrollbars-vertical;';
			if(opera)div.style.overflow='auto';
		}		
	}
	
	function addBoxStatusBar(parentObj){
		
		var div = document.createElement('DIV');
		div.className = classNameBoxStatusBar;
		div.style.borderTop = '0';
		div.id = classNameBoxStatusBar + boxIndex;

		div.style.height = boxStatusHeight;
			
		parentObj.appendChild(div);	
		
	}
	
	function createABox(columnIndex,heightOfBox,externalUrl,uniqueIdentifier,notDragable){
		boxIndex++;
		
		var maindiv = document.createElement('DIV');
		maindiv.className = classNameBox;
		maindiv.id = classNameBox + boxIndex;
		
		var div = document.createElement('DIV');
		div.className = classNameBoxInner;
		
		maindiv.appendChild(div);
				
		addBoxHeader(div,externalUrl,notDragable);
		addBoxContentContainer(div,heightOfBox);
		if (showBoxStatusBar) addBoxStatusBar(div);
		
		var obj = document.getElementById(classNameBoxColumn + columnIndex);		
		var subs = obj.getElementsByTagName('DIV');
		if(subs.length>0){
			obj.insertBefore(maindiv,subs[0]);
		}else{
			obj.appendChild(maindiv);
		}
		
		dragableBoxesArray[boxIndex] = new Array();
		dragableBoxesArray[boxIndex]['obj'] = maindiv;
		dragableBoxesArray[boxIndex]['parentObj'] = maindiv.parentNode;
		dragableBoxesArray[boxIndex]['uniqueIdentifier'] = uniqueIdentifier;
		dragableBoxesArray[boxIndex]['heightOfBox'] = heightOfBox;
		dragableBoxesArray[boxIndex]['boxState'] = 1;					// Expanded
		
		staticObjectArray[uniqueIdentifier] = boxIndex;
		
		return boxIndex;
		
	}
	
	function showRssData(ajaxIndex,boxIndex){
	
		var rssContent = ajaxObjects[ajaxIndex].response;
		tokens = rssContent.split(/\n\n/g);
				
		var headerTokens = tokens[0].split(/\n/g);
	
		if(headerTokens[0]=='0'){
			headerTokens[1] = '';
			headerTokens[0] = 'Invalid source';
			closeDragableBox(false,document.getElementById(classNameBoxHeader_txt + boxIndex));
			return;			
		}
		
		var boxHeaderText;
		
		if (headerTokens[0].length>=(boxHeaderLength-3)){
			boxHeaderText = headerTokens[0].substring(0, boxHeaderLength) + '...';
		}else{
			boxHeaderText = headerTokens[0];
		}
		
		document.getElementById(classNameBoxHeader_txt + boxIndex).innerHTML = '<h4 style="padding-left: 0px;">' + boxHeaderText + ' <span class="portalBoxHeadNumber">(' + headerTokens[1] + ')<\/span><\/h4>';	// Title
		
		var string = '<ul ' + listStyle + '>';
		// AUSGABE - Text und Inhalt + Bilder
		for(var no=1;no<tokens.length;no++){						// Looping through RSS items
			var itemTokens = tokens[no].split(/##/g);
			var nameString = 'boxNachricht_' + boxIndex + '_' + no;
			var liString = '<li>';
			var imageText = findImage(itemTokens[2]);
			if (imageText!='') imageText = '<div class="image">' + imageText + '</div>';
			if (no==tokens.length-1) liString = '<li class="noborder">';
			/* onmouseover="anzeigen(\'' + nameString + '\')"  */
			string = string + liString + '<a href="' + itemTokens[3] + '" class="tooltip" title="' + nameString + '" onclick="var w = window.open(this.href);return false" >' + imageText + itemTokens[0] + '<br><div id=' + nameString + ' style=\'display: none;\'>' + removeHtmlTags(itemTokens[2]) + '</div><div class="clear"></div><\/a><\/li>';		
		}
		string = string + '<\/ul>';
		document.getElementById(classNameBoxContent + boxIndex).innerHTML = string;
		showStatusBarMessage(boxIndex,'');
		ajaxObjects[ajaxIndex] = false;
		tooltip();
	}
	function findImage(simpleString) {
		//<img > im text ausfindig machen
		if (simpleString.match(/<img[^>]+>/i)) {
			var treffer = simpleString.match(/<img[^>]+>/i);
			//alert("Gefunden: " + treffer.length + " " + treffer);
			return treffer;			
		} else {
			return '';
		}
	}
	
	function reloadRssData(numericId){
	
		var ajaxIndex = ajaxObjects.length;
		ajaxObjects[ajaxIndex] = new sack();
		showStatusBarMessage(numericId,msgStatusLoad);
		ajaxObjects[ajaxIndex].requestFile = pathPrefix + 'readRSS.php?rssURL=' + escape(dragableBoxesArray[numericId]['rssUrl']) + '&maxRssItems=' + dragableBoxesArray[numericId]['maxRssItems'];			// Specifying which file to get
		ajaxObjects[ajaxIndex].onCompletion = function(){ showRssData(ajaxIndex,numericId); };	// Specify function that will be executed after file has been found
		ajaxObjects[ajaxIndex].runAJAX();						// Execute AJAX function

	}
		
	function createARssBox(url,columnIndex,heightOfBox,maxRssItems,minutesBeforeReload,uniqueIdentifier,state){

		//if(!heightOfBox)heightOfBox = '0';

		heightOfBox = '0';	//Hoehe auf 0 festsetzen um Fehler zu vermeiden
		
		if(!minutesBeforeReload)minutesBeforeReload = '0';

			
		var tmpIndex = createABox(columnIndex,heightOfBox,true);

		if(useCookiesToRememberRSSSources)
		{
			if(!cookieRSSSources[url]){
				cookieRSSSources[url] = cookieCounter;		
				Set_Cookie(nameOfCookie + cookieCounter,url + '#;#' + columnIndex + '#;#' + maxRssItems + '#;#' + heightOfBox + '#;#' + minutesBeforeReload + '#;#' + uniqueIdentifier + '#;#' + state  ,60000);
				cookieCounter++;
			}
		}		
		
		dragableBoxesArray[tmpIndex]['rssUrl'] = url;
		dragableBoxesArray[tmpIndex]['maxRssItems'] = maxRssItems?maxRssItems:100;
		dragableBoxesArray[tmpIndex]['minutesBeforeReload'] = minutesBeforeReload;
		dragableBoxesArray[tmpIndex]['heightOfBox'] = heightOfBox;
		dragableBoxesArray[tmpIndex]['uniqueIdentifier'] = uniqueIdentifier;
		dragableBoxesArray[tmpIndex]['state'] = state;

		if(state==0){
			showHideBoxContent(false,document.getElementById(classNameBoxExpand + tmpIndex));
		}
		
		staticObjectArray[uniqueIdentifier] = tmpIndex;
		
		var tmpInterval = false;
		if(minutesBeforeReload && minutesBeforeReload>0){
			var tmpInterval = setInterval("reloadRssData(" + tmpIndex + ")",(minutesBeforeReload*1000*60));
		}

		dragableBoxesArray[tmpIndex]['intervalObj'] = tmpInterval;
			
		addRSSEditContent(document.getElementById(classNameBoxHeader + tmpIndex))
			
		if(!document.getElementById(classNameBoxContent + tmpIndex).innerHTML)document.getElementById(classNameBoxContent + tmpIndex).innerHTML = "<div style=\"vertical-align: middle;\"><img src=\"" + pathPrefix + "../skin/frontend/toenjes/default/images/opc-ajax-loader.gif\" style=\"padding-right:16px;\">" + msgStatusLoad + ' (<a href=\'javascript:destroyErrorBox(' + tmpIndex + ')\' title=\'Box entfernen\'>Box entfernen</a>)</div>';

		if(url.length>0 && url!='undefined'){
			
			var ajaxIndex = ajaxObjects.length;
			ajaxObjects[ajaxIndex] = new sack();
			if(!maxRssItems)maxRssItems = 100;
			ajaxObjects[ajaxIndex].requestFile = pathPrefix + 'readRSS.php?rssURL=' + escape(url) + '&maxRssItems=' + maxRssItems;	// Specifying which file to get
			ajaxObjects[ajaxIndex].onCompletion = function(){ showRssData(ajaxIndex,tmpIndex); };	// Specify function that will be executed after file has been found
			ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function
		}else{
			hideHeaderOptionsForStaticBoxes(tmpIndex);
		}			
	}
	
	function createHelpObjects(){
		/* Creating rectangle div */
		rectangleDiv = document.createElement('DIV');
		rectangleDiv.id='rectangleDiv';
		rectangleDiv.style.display='none';
		
		rectangleDiv.style.border = "2px dotted red";
		rectangleDiv.className = classNameBoxBack;
		rectangleDiv.style.margin = "5px";
		
		document.body.appendChild(rectangleDiv);
	}
	
	function cancelSelectionEvent(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(dragDropCounter>=0)return false; else return true;	
		
	}
	
	function cancelEvent(){
		return false;
	}
	
	function initEvents(){
		document.body.onmousemove = moveDragableElement;
		document.body.onmouseup = stop_dragDropElement;
		document.body.onselectstart = cancelSelectionEvent;

		document.body.ondragstart = cancelEvent;	
		
		documentHeight = document.documentElement.clientHeight;	
	}
		
	function createFeed(formObj){
		
		var url = formObj.rssUrl.value;
		var items = formObj.items.value;
		var height = false;
		var reloadInterval = formObj.reloadInterval.value;
		if(isNaN(height) || height/1<40)height = false;	
		if(isNaN(reloadInterval) || reloadInterval/1<5)reloadInterval = false;
		createARssBox(url,1,height,items,reloadInterval);	
	}
	
	function createRssBoxesFromCookie(){ 
	
      var tmpArray = new Array(); 
      var cookieValue = Get_Cookie(nameOfCookie + '0'); 
      cookieCounter=0; 
      while(cookieValue && cookieValue!='') 
        { 
            var items = cookieValue.split('#;#'); 
         var index = items[0]; 
         if(!items[0])index = items[5]; 
         if(items.length>1 && !tmpArray[index]) 
            { 
                tmpArray[index] = true; 
            createARssBox(items[0],items[1],items[3],items[2],items[4],items[5],items[6]); 
            cookieRSSSources[items[0]]=cookieCounter-1; 
         } 
            else 
            { 
            cookieCounter++; 
         } 
         var cookieValue = Get_Cookie(nameOfCookie + cookieCounter); 
      } 
   }
	
	function clearCookiesForDragableBoxes(){	/* Clear cookies */
		var cookieValue = Get_Cookie(nameOfCookie);
		while(cookieValue && cookieValue!=''){
			Set_Cookie(nameOfCookie + cookieCounter,'',-500);
			cookieCounter++;
			var cookieValue = Get_Cookie(nameOfCookie + cookieCounter);
		}		
	}
		
	function deleteAllDragableBoxes(){			/* Delete all boxes */
		var divs = document.getElementsByTagName('DIV');
		for(var no=0;no<divs.length;no++){
			if(divs[no].className==classNameBox)closeDragableBox(false,divs[no]);	
		}
	}
	
	function resetDragableBoxes(){				/* Reset back to default settings */
		cookieCounter = 0;
		clearCookiesForDragableBoxes();
		
		deleteAllDragableBoxes();
		cookieCounter = 0;
		cookieRSSSources = new Array();
		createDefaultBoxes();
	}
	
	function hideHeaderOptionsForStaticBoxes(boxIndex){
		if(document.getElementById(classNameBoxRefreshSource + boxIndex))document.getElementById(classNameBoxRefreshSource + boxIndex).style.display='none';
		if(document.getElementById(classNameBoxCloseLink + boxIndex))document.getElementById(classNameBoxCloseLink + boxIndex).style.display='none';		
		if(document.getElementById(classNameBoxEditLink + boxIndex))document.getElementById(classNameBoxEditLink + boxIndex).style.display='none';		
	}
	
	function createAStaticBox(htmlContentOfNewBox, titleOfNewBox, column, name, height, enableclose){

		if(!staticObjectArray[name]){
			// The box is not stored in cookie - we need to create it.
			var newIndex = createABox(column,height,false,name);
			
			document.getElementById(classNameBoxContent + newIndex).innerHTML = htmlContentOfNewBox;		
			addBoxHeader(document.getElementById(classNameBoxHeader_txt + newIndex),"",false);
			//document.getElementById(classNameBoxHeader_txt + newIndex).innerHTML = '<h4 style="padding-left: 0px;">' + titleOfNewBox + '</h4>';		
		}else{	
			// Box is stored in cookie - all we have to do is to move content into it.
			document.getElementById(classNameBoxContent + staticObjectArray[name]).innerHTML = htmlContentOfNewBox;	
			document.getElementById(classNameBoxHeader_txt + staticObjectArray[name]).innerHTML = '<h4 style="padding-left: 0px;">' + titleOfNewBox + '</h4>';	
			
		}
		
		if (!enableclose) {
			//alert(name);
			hideHeaderOptionsForStaticBoxes(staticObjectArray[name]);
		}
	}
	
	
	function createAnAjaxBox(url, titleOfNewBox, column, name, height, enableclose){
	//function loadAjaxData(url){
	
		var ajaxIndex = ajaxObjects.length;
		ajaxObjects[ajaxIndex] = new sack();
		ajaxObjects[ajaxIndex].requestFile = url;													// Datei festlegen
		//ajaxObjects[ajaxIndex].onCompletion = function(){ createAStaticBox(ajaxObjects[ajaxIndex].response, titleOfNewBox, column, name, height); };	// Funktion festlegen die nach dem Aufruf ausgef�hrt wird
		//ajaxObjects[ajaxIndex].onCompletion = function(){ alert(ajaxObjects[ajaxIndex].response); };	// Funktion festlegen die nach dem Aufruf ausgefuehrt wird
		ajaxObjects[ajaxIndex].onCompletion = function(){ fillAnAjaxBox(ajaxIndex, titleOfNewBox, column, name, height, enableclose); };	// Funktion festlegen die nach dem Aufruf ausgefuehrt wird
		ajaxObjects[ajaxIndex].runAJAX();						// AJAX-Funktion ausfuehren

	}
	
	function fillAnAjaxBox(ajaxIndex, titleOfNewBox, column, name, height, enableclose){
		
		var text = ajaxObjects[ajaxIndex].response;
		
		//alert(enableclose);
			
		createAStaticBox(text, titleOfNewBox, column, name, height, enableclose);
	}
	
	function createNeededBoxes(){
		
		//Eigener RSS-Feed
		createAStaticBox('<DIV style="height: 90px;"><form method=\"post\" action=\"#\"><table style="margin-bottom: 5px;"><tr><td style="vertical-align: middle;">Feed-Adresse:</td><td><input type=\"text\" class="' + classNameBoxFormInputBox + '" name=\"rssUrl\" value=\"\" maxlength=\"255\"></td></tr><tr><td style="vertical-align: middle;">Eintr&auml;ge:</td><td><input type=\"text\" class="' + classNameBoxFormInputBox + '" name=\"items\" value=\"10\" size=\"2\" maxlength=\"2\"></td></tr><tr><td style="vertical-align: middle;">Aktualisierungsintervall:</td><td><input type=\"text\" class="' + classNameBoxFormInputBox + '" name=\"reloadInterval\" value=\"10\" size=\"2\" maxlength=\"2\">&nbsp;Minuten</td></tr></table><input type=\"button\" class="' + classNameBoxFormButton + '" onclick=\"createFeed(this.form)\" value=\"Erstellen\"></form></div>','Eigener RSS-Feed',3,'staticObject2',90,false);
		
		//Info-Box
		//createAStaticBox('<div id="swmsRssContentBox" style="overflow: hidden; height: ' + boxInfoHeight + 'px; min-height: ' + boxInfoHeight + 'px;"></div>','Info-Box',3,'staticObject3',150, false);
		
	}
	
	function createDefaultBoxes(){				/* You customize this function */
			
		if(cookieCounter==0){
			
			//createARssBox(url,columnIndex,heightOfBox,maxRssItems,minutesBeforeReload,uniqueIdentifier,state)
			createARssBox('http://ww2.autoscout24.de/magazine_rss.xml',2,false,8,10);
			createARssBox('http://rss.focus.de/fol/XML/topic/rss/auto.xml',1,false,10,10);
			createARssBox('http://rss.sueddeutsche.de/rss/Auto%20&%20Mobil',1,false,1,10);
			
		
		}
		
		/* Statische Boxen */
		var feeds = '<li><a href=\'#\' onclick=\"createARssBox(\'http://www.aol.de/_tools/rss.jsp?sg=RSSSL2\',1,0,3,10)\">AOL.de - Auto</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://www.autohaus.de/feeds/nachrichten.xml\',1,0,10,10)\">Autohaus.de</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://ww2.autoscout24.de/magazine_rss.xml\',1,0,10,10)\">Autoscout24.de</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://rss.focus.de/fol/XML/topic/rss/auto.xml\',1,0,10,10)\">Focus - Auto & Motor</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://auto.de.msn.com/rss_autonews.aspx\',1,0,10,10)\">MSN Auto - News</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://auto.de.msn.com/rss_autotestberichte.aspx\',1,0,10,10)\">MSN Auto - Testberichte</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://www.spiegel.de/auto/index.rss\',1,0,10,10)\">Spiegel Online - Auto</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://rss.sueddeutsche.de/rss/Auto%20&%20Mobil\',1,0,10,10)\">sueddeutsche.de - Auto & Mobil</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://rss1.t-online.de/c/11/66/66/32/11666632.xml\',1,0,10,10)\">t-online.de - Auto</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://de.cars.yahoo.com/autos-bildernachrichten.html.xml\',1,0,10,10)\">Yahoo! Autos : Auto Foto-News</a></li>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://www.bmw-tv.de/rss.xml\',1,0,10,10)\">BMW Aktuell</a></li>' +
					'<hr>' +
					'<li><a href=\'#\' onclick=\"createARssBox(\'http://feeds2.feedburner.com/wettercom/rss\',1,0,10,10)\">Wetter</a></li>';
		

		//Seitenauswahl
		createAStaticBox('<DIV class="noborder nogrey"><ul ' + listStyle + '>' + feeds + '</ul></div>','Seitenauswahl',3,'staticObject1',180, false);
		
		createBoxYoutube();
		createBoxWikipedia();

		setTimeout('saveCookies()',1000);
		
	}	
	

	
	function disableBoxDrag(boxIndex){			/* Disable drag for a box */
			document.getElementById(classNameBoxHeader + boxIndex).onmousedown = '';
			document.getElementById(classNameBoxHeader + boxIndex).style.cursor = 'default';		
	}

	function initDragableBoxesScript(){			/* Script Initialisieren */
		
		createColumns();												// Always the first line of this function
		createHelpObjects();											// Always the second line of this function
		initEvents();													// Always the third line of this function
		
		if(useCookiesToRememberRSSSources)createRssBoxesFromCookie();	// Create RSS boxes from cookies
		
		createNeededBoxes();											// Create needed Boxes.
		//createDefaultBoxes();											// Create default boxes.
	}
		
	function anzeigen(das){
		document.getElementById('swmsRssContentBox').innerHTML = document.getElementById(das).innerHTML;

//			alert(document.getElementById(das).style.height);
		
//		if (document.getElementById(das).style.height > boxInfoHeight) {
			document.getElementById('swmsRssContentBox').style.height = document.getElementById(das).style.height;
//		}
//		else {
//			document.getElementById('swmsRssContentBox').style.height = boxInfoHeight;
//		}
  	}
	
	function removeHtmlTags(stringHtml){
		var output = "";

		output = stringHtml.replace(/<\/?(?!(img|b|i|u)\W)[^>]+>/g, "");	//HTML-Tags entfernen
	
		return output;
	}
	
	function destroyErrorBox(boxIndex){
		closeDragableBox(false,document.getElementById(classNameBoxHeader_txt + boxIndex));
	}
	
	function InitializePortal(){
		initDragableBoxesScript();
		createDefaultBoxes();
		tooltip();
	}
	
	function createBoxClock(){
		//Uhr
		createAnAjaxBox(pathPrefix + '../ajax/uhr.html','Uhr',2,'staticObject5',150,true);
	}
	
	function createBoxWikipedia() {
		//Wikipedia
		createAStaticBox('<form target="_blank" name="searchform" action="http://de.wikipedia.org/wiki/Special:Search" id="searchform"><table style="width: 100%;"><tbody><tr><td width="100%"><span id="txtSearch">Suche in der Wikipedia (de)</span><input id="searchInput" style="width: 175px;" name="search" accesskey="f" value="" type="text"><br><input name="go" id="btnGo" value="Artikel" type="submit"  class="form-button" style="margin: 4px; margin-left: 0px;"><input name="fulltext" id="btnFulltext" value="Volltext" type="submit" class="form-button" style="margin: 4px; margin-left: 0px;"></td><td style="padding-bottom: 4px;"><a target="_parent" href="http://de.wikipedia.org/wiki/"><img src="' + pathPrefix + src_wiki + '" border="0"></a></td></tr></tbody></table></form>','Wikipedia, die freie Enzyklop&auml;die',3,'staticObjectWiki',100,true);
	}
		
	function createBoxYoutube() {
		//Youtube Video
		var video = '<center><object width=\"100%\" height=\"200\"><param name=\"movie\" value=\"http://www.youtube.com/v/kfQBkCJPkYM&hl=de&fs=1&\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"wmode\" value=\"opaque\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/kfQBkCJPkYM&hl=de&fs=1&\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" wmode=\"opaque\" allowfullscreen=\"true\" width=\"100%\" height=\"200\"></embed></object></center>';
		createAStaticBox(video,'Video-Player',2,'staticObjectVideo',200,false);
	}
	
	window.onload = InitializePortal;	//Initialisierung aufrufen
