	var field_active = '#777777';

	function enable_publishes () {
		document.contentform.publish_start_day.disabled = false;
		document.contentform.publish_start_month.disabled = false;
		document.contentform.publish_start_year.disabled = false;		

		document.contentform.publish_end_day.disabled = false;
		document.contentform.publish_end_month.disabled = false;
		document.contentform.publish_end_year.disabled = false;		
	}

	function disable_publishes () {
		document.contentform.publish_start_day.disabled = true;
		document.contentform.publish_start_month.disabled = true;
		document.contentform.publish_start_year.disabled = true;		

		document.contentform.publish_end_day.disabled = true;
		document.contentform.publish_end_month.disabled = true;
		document.contentform.publish_end_year.disabled = true;		
	}
	
	
	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 displayWindow(url, width, height) {
		var winname, date, time;
		var startx = Math.round((screen.width-width)/2);
		var starty = Math.round((screen.height-height)/2) - 20;

		date = new Date;
	  	time = date.getTime();
	  			
		winname = window.open(url,"Window" + time,"width=" + width + ",height=" + height + ",status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,screenX=" + startx + ",left=" + startx + ",screenY=" + starty + ",top=" + starty + " "); 
		if (! winname)
			alert('Ein neues Fenster konnte nicht geöffnet werden. Bitte deaktiviere deinen PopUp-Blocker!');
	}    



	function displayWindowScrollbar(url, width, height) {
		var winname;
		var startx = Math.round((screen.width-width)/2);
		var starty = Math.round((screen.height-height)/2);

		d = new Date;
	  	t = d.getTime();

		winname = window.open(url,"Window" + t,"width=" + width + ",height=" + height + ",status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,screenX=" + startx + ",left=" + startx + ",screenY=" + starty + ",top=" + starty + " "); 
		if (! winname)
			alert('Ein neues Fenster konnte nicht geöffnet werden. Bitte deaktiviere deinen PopUp-Blocker!');
	}
	

	function reSizeToHeight(){
		var cur_width, cur_height, height;



		// Hoehe des Inhalts berechnen
		height = document.getElementById("heightdiv").offsetHeight;
		if (height == 0)
			height = document.getElementById("heightdiv").clientHeight;

		// wir wollen noch etwas mehr Platz unten - kann man anpassen
		height = height + 5;


		// wenn Fenster hoeher als 600, dann auf 600 setzen, sonst scrollbars ausschalten
		if (height > 600) {
			height = 600;
		} else {
			document.body.scroll = 'no';
			document.body.style.overflowY = 'hidden';
		}


		// alle außer Explorer
		if (self.innerHeight) {
			cur_width = self.innerWidth;
			cur_height = self.innerHeight;
		}

		// Explorer 6 Strict Mode
		else if (document.documentElement && document.documentElement.clientHeight) {
		
			cur_width = document.documentElement.clientWidth;
			cur_height = document.documentElement.clientHeight;
		}

		// andere Explorer Versionen
		else if (document.body) {
			cur_width = document.body.clientWidth;
			cur_height = document.body.clientHeight;
		}


 		window.moveTo((screen.width-cur_width)/2,((screen.height-30-height)/2) - 35)
//		window.moveBy(0, (((height - cur_height) / 2))* -1);

		if (! window.resizeBy(0, (height - cur_height)))
			window.innerHeight = height;

	}

	function DivSetOverSelect(state,divname) {
		var DivRef = document.getElementById(divname);
		var IfrRef = document.getElementById(divname + '_iframe');
		if(state) {
			DivRef.style.display = "block";
			IfrRef.style.width = DivRef.offsetWidth;
			IfrRef.style.height = DivRef.offsetHeight;
			IfrRef.style.top = DivRef.style.top;
			IfrRef.style.left = DivRef.style.left;
			IfrRef.style.zIndex = DivRef.style.zIndex - 1;
			IfrRef.style.display = "block";
		}
		else {
			DivRef.style.display = "none";
			IfrRef.style.display = "none";
		}
	}
	
	function makeHTTPRequest(url) {

		var http_request = false;

		if (! http_request) {
			if (window.XMLHttpRequest) { // Mozilla, Safari,...
				http_request = new XMLHttpRequest();
				if (http_request.overrideMimeType) {
					http_request.overrideMimeType('text/xml');
				}
			} else if (window.ActiveXObject) { // IE
				try {
					http_request = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {}
				}
			}
		}

		if (!http_request) {
			return false;
		}
		
		http_request.open('GET', url, false);
		http_request.send(null);
	}
	

	function confirmQuestion(question, url) {  
		var box=window.confirm(question);
		
		if (box==true) {
			makeHTTPRequest(url);
			window.location.reload();
		}
	
	} 
	
	function executeRequest(url) {  
		makeHTTPRequest(url);
		window.location.reload();
	} 	
	
	function add_clone(name1, name2) {
		ref = document.getElementById(name2).cloneNode(true);
		document.getElementById(name1).appendChild(ref);
	}
	
	
	function remove_clone(name1) {
	
		var test = document.getElementById(name1);
		var counter = 0;
	
		for (var i=0; i<test.childNodes.length; i++) {
			if(test.childNodes[i].nodeName=='#text') continue;
			counter++;
		}
	
		if (counter > 1)
			document.getElementById(name1).removeChild(document.getElementById(name1).lastChild);
	}

	function remove_child(name1, this_id) {
		document.getElementById(name1).removeChild(this_id);
	}	
	
	
	