function decode_utf8(utftext) {
     var plaintext = ""; var i=0; var c=c1=c2=0;
     // while-Schleife, weil einige Zeichen uebersprungen werden
     while(i<utftext.length)
         {
         c = utftext.charCodeAt(i);
         if (c<128) {
             plaintext += String.fromCharCode(c);
             i++;}
         else if((c>191) && (c<224)) {
             c2 = utftext.charCodeAt(i+1);
             plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
             i+=2;}
         else {
             c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
             plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
             i+=3;}
         }
     return plaintext;
 }





// makes external links out of anchors with a rel="external" attribute (beacause target is not xhtml compatible
function relTags() {
	// popup
	var popup_options = 'scrollbars=yes,resizable=yes,width=700,wheight=700';
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName( "a" );
			for (var i = 0; i < anchors.length; i++) {
				var anchor = anchors[i];
				if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
					anchor.target = "_blank";
				}
				if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popop") {
					var href = anchor.getAttribute("href");
					anchor.onclick = function(){
									  window.open(href,'popup',popup_options);return false;
					};
				}
		}
	}
}


function printpage() {
	if (window.print())
		return;
		//document.location.reload();
}



function checkSearchInput(inputfield)
{
	searchfield = document.getElementById(inputfield);

	if(searchfield.value != '')
	{
		return true;
	}
	else
	{
		searchfield.className = 'error';
		return false;
	}
}


function setMetaColor(color)
{
//	document.getElementById('meta-navigation').style.backgroundColor=color;

	var ar_links = document.getElementById('meta-navigation').getElementsByTagName('a');
	for(item in ar_links)
	{
		if(ar_links[item])
		{
			ar_links[item].style.color=color;
		}

	}

}


function getMetaColor()
{
	return '#FFFFFF';
}

function getQueryParams()
{
	var arr_return = new Object();
	var str_href = window.location.href;
	if ( str_href.indexOf("?") > -1 )
	{
		var str_query_string = str_href.substr(str_href.indexOf("?") + 1);
		var arr_params = str_query_string.split("&");
		for ( var i = 0; i < arr_params.length; i++ )
		{
			var arr_param = arr_params[i].split("=");
			arr_return[arr_param[0]] = unescape(arr_param[1]);
		}
	}
return arr_return;
}










