function swapDivs(item1_name,item2_name) {
	// We need a clone of the node we want to swap

	var item1 = document.getElementById(item1_name);
	var item2 = document.getElementById(item2_name);	

	var itemtmp = item1.cloneNode(1);

	// We also need the parentNode of the items we are going to swap.
	var parent = item1.parentNode;

	// First replace the second node with the copy of the first node
	// which returns a the new node
	item2 = parent.replaceChild(itemtmp,item2);

	//Then we need to replace the first node with the new second node
	parent.replaceChild(item2,item1);

	// And finally replace the first item with it's copy so that we
	// still use the old nodes but in the new order. This is the reason
	// we don't need to update our Behaviours since we still have
	// the same nodes.
	parent.replaceChild(item1,itemtmp);

	// Free up some memory, we don't want unused nodes in our document.
	itemtmp = null;
}


function set_cookie ( name, value) {
  	var cookie_string = name + "=" + escape ( value );
  	document.cookie = cookie_string;
}


function get_cookie ( cookie_name ) {
  	var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  	if ( results )
  	  return ( unescape ( results[1] ) );
  	else
  	  return null;
}

function delete_cookie ( cookie_name ) {
  	var cookie_date = new Date ( );  // current date & time
  	cookie_date.setTime ( cookie_date.getTime() - 1 );
  	document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function popup(url) {
 	var window2 = window.open(url,'window2','height=420,width=768,scrollbars=no,locationbar=no,menubar=no,resizable=no,statusbar=no');
}

	function popupZoom(welches,titel,width,height) {

		winname=window.open(welches, "picture_zoom","width="+width+",height="+height+",toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,menubar=no,location=no,directories=no");
    	winname.moveTo((screen.width-width)/2,(screen.height-height)/2);
		winname.focus();
	}

	function popupPic(welches,titel,width,height) {

		scrollbars= "no";
		if ((width>1000) || (height>700))
			scrollbars= "yes";
		winname=window.open("", "picture_zoom","width="+width+",height="+height+",toolbar=no,status=no,menubar=no,scrollbars=" + scrollbars +",resizable=no,menubar=no,location=no,directories=no");
    		winname.moveTo((screen.width-width)/2,(screen.height-height)/2);
		with(winname.document) {
			open();
			write('<html><head><title>' + titel + '</title></head>');
			write('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><a href="javascript:window.close()"><img src="'+welches+'" border="0"></a>');
			write('</body></html>');
			close();
		}
		winname.focus();
	}

	function popupFlash(welches,titel,width,height) {
		winname=window.open("", "picture_zoom","width="+width+",height="+height+",toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,location=no,directories=no");
    	winname.moveTo((screen.width-width)/2,(screen.height-height)/2);

		with(winname.document)	{
			open();
			write('<html><head><title>' + titel + '</title></head>');
			write('<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
        	write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '">');
  			write('<param name="movie" value="' + welches + '">');
  			write('<param name="quality" value="high">');
			write('<embed src="' + welches + '" width="' + width + '" height="' + height + '" quality="high" type="application/x-shockwave-flash"></embed></object>');
			write('</body></html>');
			close();
		}
		winname.focus();
	}

	function popupAudio(welches,titel,width,height) {
		winname=window.open("", "audio_zoom","width="+width+",height="+height+",toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,location=no,directories=no");
		winname.moveTo((screen.width-width)/2,(screen.height-height)/2);

		with(winname.document)	{
			open();
			write('<html><head><title>' + titel + '</title></head>');
			write('<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
			write('<object id="prev" height="' + height + '" width="' + width + '">');
			write('<param name="controls" value="ControlPanel">');
			write('<param name="autostart" value="true">');
			write('<param name="type" value="audio/x-pn-realaudio-plugin">');
			write('<param name="src" value="' + welches + '">');
			write('<embed src="' + welches + '" type="audio/x-pn-realaudio-plugin" ');
			write('controls="ControlPanel" height="' + height + '" width="' + width + '" autostart="true">');
			write('</object>');
			write('</body></html>');
			close();
		}
		winname.focus();
	}
