document.observe('dom:loaded', function() {
	$$('div[id^="contact_"]').invoke('hide');
	
	// Searchwords for the title of the result site 
	if ($('searchword')) {
		var myUrl = window.location.search;
		var slicedUrl = myUrl.search(/\&q=/) != -1 ? myUrl.slice(myUrl.search(/\&q=/) + 3) : myUrl.slice(myUrl.search(/\?q=/) + 3);
		slicedUrl = slicedUrl.search(/\&/) != -1 ? slicedUrl.slice(0,slicedUrl.search(/\&/)) : slicedUrl;
		var searchWord = "";
		if (myUrl.search(/\&q=/) != -1 || myUrl.search(/\?q=/) != -1) {
			if (slicedUrl.search(/#/) != -1) 
				searchWord = decodeURI(slicedUrl.slice(0, slicedUrl.search(/#/)));
			else 
				searchWord = decodeURI(slicedUrl);
			
			if ($('searchword') && searchWord.length > 0) 
				$('searchword').innerHTML = $('searchword').innerHTML + ' f&uuml;r &lt;' + searchWord + '&gt;';
		}
	}
	
	// Searchwords for the subtitle of the link send after the result site 
	if ($('mailCommendPageURL') && $('linksendsearchword') ){
		var myUrl = $('mailCommendPageURL').value;
		var slicedUrl = myUrl.search(/\&q=/) != -1 ? myUrl.slice(myUrl.search(/\&q=/) + 3) : myUrl.slice(myUrl.search(/\?q=/) + 3);
		slicedUrl = slicedUrl.search(/\&/) != -1 ? slicedUrl.slice(0,slicedUrl.search(/\&/)) : slicedUrl;
		var searchWord = "";
		if (myUrl.search(/\&q=/) != -1 || myUrl.search(/\?q=/) != -1) {
			if (slicedUrl.search(/#/) != -1) {
				searchWord = decodeURI(slicedUrl.slice(0, slicedUrl.search(/#/)));
			}
			else 
				searchWord = decodeURI(slicedUrl);
			
			if ($('linksendsearchword') && searchWord.length > 0) 
				$('linksendsearchword').innerHTML = $('linksendsearchword').innerHTML + ' f&uuml;r &lt;' + searchWord + '&gt;';
		}
	}
	
	// fuer die sprachumschaltung muss, wenn vorhanden, die suchparameter hinzugefügt werden
	$$('.language_link').each(function(url) {
		
		if (url.href.search(/\&q=/) == -1 && url.href.search(/\?q=/) == -1) {
			
			var myUrl = window.location.search;
			if (myUrl.search(/\&q=/) != -1 || myUrl.search(/\?q=/) != -1) {
				var slicedUrl = myUrl.search(/\&q=/) != -1 ? myUrl.slice(myUrl.search(/\&q=/) ) : myUrl.slice(myUrl.search(/\?q=/) );
				
				url.href = url.href + slicedUrl;
			}
		}
	});
});

function hoverGoButton(obj) {
	$(obj).src = $(obj).src.replace('_normal','_hover');
}

function leaveGoButton(obj) {
	$(obj).src = $(obj).src.replace('_hover','_normal');
}


function changeDivHeight() {

	var t = $('content').scrollHeight;
	var b = document.body.clientHeight;
	if(t < b)
		$('content').setStyle({height: b + "px"});
}

function uniqueLinksHover(event) {
	var el = event.element().up();
	if(el.hasClassName('uniqueLinksHover')) {
		el.removeClassName('uniqueLinksHover');
	} else {
		
	}
	<!--[HOME_LINK]-->
}

function changebtn(id, btn) {
	$('btn'+id).setStyle({backgroundImage: 'url(' + themePath + '/pics/' + btn + '.gif)'});
}

function title_check() {
	if(document.title == 'MUSARTE. wege zur kunst - MUSARTE. wege zur kunst')
		document.title = 'MUSARTE. wege zur kunst';
}

function commendPage() {
	$('commendPageURL').value = location.href;
	$('commendPageForm').submit();
}

function bookMarkEscapeEvent (theEvent) {
	
	if (!theEvent)
		theEvent = window.event;
	if (theEvent.which && theEvent.which == 27) {
		bookMark.hide();
		delete document.onkeyup;
	} 
	else if (theEvent.keyCode && theEvent.keyCode == 27) {
		bookMark.hide();
		document.onkeyup = "";
	}
}

function setBookMarkEscapeEvent(){
	document.onkeyup = bookMarkEscapeEvent;
}


var customBookMark = 
		  '<tr><td><a href="http://del.icio.us/post?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/delicious.gif) no-repeat ;padding-left:25px;"> del.icio.us</div></a></td></tr>'
		+ '<tr><td><a href="#" onclick="bookMark.hide();bookMark.favbookmark()">'
			+ '<div style="background:url('+themePath+'/pics/favorites.gif) no-repeat ;padding-left:25px;"> Favorites</div></a></td></tr>'
		+ '<tr><td><a href="http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/google.gif) no-repeat ;padding-left:25px;"> Google</div></a></td></tr>'
		+ '<tr><td><a href="http://linkarena.com/bookmarks/addlink/?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/linkarena.gif) no-repeat ;padding-left:25px;"> LinkARENA</div></a></td></tr>'
		+ '<tr><td><a href="http://www.mister-wong.de/index.php?action=addurl&bm_url='+encodeURIComponent(location.href)+'&bm_description='+encodeURIComponent(document.title)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/mister-wong.gif) no-repeat ;padding-left:25px;"> Mr. Wong</div></a></td></tr>'
		+ '<tr><td><a href="http://www.webnews.de/einstellen?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/webnews.gif) no-repeat ;padding-left:25px;"> WebNews</div></a></td></tr>'
		+ '<tr><td><a href="http://yigg.de/neu?exturl='+encodeURIComponent(location.href)+'" onclick="bookMark.hide();" target="_blank">'
			+ '<div style="background:url('+themePath+'/pics/yigg.gif) no-repeat ;padding-left:25px;"> YIGG</div></a></td></tr>'
		+ '<tr><td style="text-align:right"><img class="bookmarkImageClose" src="'+themePath+'/pics/close_btn_normal.gif" alt="close" title="close" onmouseover="hoverGoButton(this)" onmouseout="leaveGoButton(this)" onclick="bookMark.hide();" /></td></tr>';
