/////////////////////////////////////////////        TMENU funktionen       ////////////////////////////////////////////////////////////

var cr_counter2 = 1;
var cr_checker2 = 0;
var top1_count = 0;

var cr_counter3 = 1;
var cr_checker3 = 0;
var top2_count = 0;

var top3_count = 0;

function cr_top2_stay(cur,nosub){
	cr_checker2 = 1;
	cr_showHideLayers('topmenu2','','show')
	if (nosub=='nosub'){
		cr_showHideLayers('topmenu2','','hide')
	}
	
	for (var cr_i = 1; cr_i < top1_count; cr_i++) {
		var obj = MM_findObj('uid_1_'+cr_i);
		if (cr_i==cur){	
			obj.style.backgroundColor = '#C4C5B5';
		}else{
			obj.style.backgroundColor = '#DCDBC9';
		}
	}
}
function cr_top3_stay(cur,nosub){
	cr_checker3 = 1;
	if (nosub!='nosub'){
		cr_checker2 = 1;
		cr_showHideLayers('topmenu3','','show')
	}else{
		cr_checker2 = 0;
		cr_showHideLayers('topmenu3','','hide')
	}
	for (var cr_ii = 1; cr_ii < top2_count; cr_ii++) {
		var obj = MM_findObj('uid_2_'+cr_ii);
		if (cr_ii==cur){	
			obj.style.backgroundColor = '#D5D5CD';
		}else{
			obj.style.backgroundColor = '#EDEDE3';
		}
	}
}
function cr_top4_stay(cur,nosub){
	cr_checker4 = 1;
	cr_checker3 = 1;
	cr_checker2 = 1;
	cr_showHideLayers('topmenu3','','show')

	for (var cr_ii = 1; cr_ii < top3_count; cr_ii++) {
		var obj = MM_findObj('uid_3_'+cr_ii);
		if (cr_ii==cur){	
			obj.style.backgroundColor = '#D5D5CD';
		}else{
			obj.style.backgroundColor = '#EDEDE3';
		}
	}
}
function cr_top3_stay1(){
	cr_checker2 = 1;
}
function cr_top4_stay1(){
	cr_checker2 = 1;
	cr_checker3 = 1;
}

function cr_top2_hide(){
	cr_counter2 = 1;
	cr_checker2 = 0;
	zaehler2()
}
function cr_top3_hide(){
	cr_counter3 = 1;
	cr_checker3 = 0;
	zaehler3()
}
function cr_top4_hide(){
	cr_counter4 = 1;
	cr_checker4 = 0;
	zaehler4()
}

function zaehler2() {
	if (cr_counter2 > 0) {
	cr_counter2 --;
	setTimeout("zaehler2()",200);
	} else {
		if (cr_checker2 < 1) {
			cr_showHideLayers('topmenu2','','hide')
			for (var cr_ii = 1; cr_ii < top1_count; cr_ii++) {
				var obj = MM_findObj('uid_1_'+cr_ii);
				obj.style.backgroundColor = '#DCDBC9';
			}
		}
	}
}
function zaehler3() {
	if (cr_counter3 > 0) {
	cr_counter3 --;
	setTimeout("zaehler3()",200);
	} else {
		if (cr_checker3 < 1) {
			cr_showHideLayers('topmenu3','','hide')
			for (var cr_ii = 1; cr_ii < top2_count; cr_ii++) {
				var obj = MM_findObj('uid_2_'+cr_ii);
				obj.style.backgroundColor = '#EDEDE3';
			}
		}
	}
}
function zaehler4() {
	if (cr_counter4 > 0) {
	cr_counter4 --;
	setTimeout("zaehler4()",200);
	} else {
		if (cr_checker4 < 1) {
			for (var cr_ii = 1; cr_ii < top3_count; cr_ii++) {
				var obj = MM_findObj('uid_3_'+cr_ii);
				obj.style.backgroundColor = '#EDEDE3';
			}
		}
	}
}

function cr_showHideLayers() {
  var i,p,v,z,obj,args=cr_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; z=(v=='visible')?'99999999':(v=='hidden')?'-3':z;}
    obj.visibility=v; obj.zIndex=z; }//alert(args[i]+' '+z);
}

function str_replace (search, replace, subject)
{
  var result = "";
  var  oldi = 0;
  for (cr_i = subject.indexOf (search)
     ; cr_i > -1
     ; cr_i = subject.indexOf (search, cr_i))
  {
    result += subject.substring (oldi, cr_i);
    result += replace;
    cr_i += search.length;
    oldi = cr_i;
  }
  return result + subject.substring (oldi, subject.length);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function popupOpen(pid,type,width,height) {
  	window.open('index.'+pid+'.'+type+'.html','','width='+width+',height='+height+',scrollbars=1');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function popupImage(url,width,height) {
  	window.open(url,'Popup','width='+width+',height='+height+',scrollbars=0');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if(obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function MM_findObj(n, d) { //v4.01
  	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() {
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* infolox */
function getObjectByID (oDocument, sID) {
	if (oDocument.all) {
		return oDocument.all[sID];
	}
	else if (oDocument.getElementById) {
		return oDocument.getElementById(sID);
	}
	else if (oDocument.layers) {
		return oDocument.layers[sID];
	}
}
function gotoPageID(sPageID_) {
	var els = [];
	var uri_els = document.location.href.split("?");
	if (uri_els[1]){
		uri_els = uri_els[1].split("&");
		for( var i in uri_els ){
			var var_els = uri_els[i].split("=");
			if( typeof var_els[1] != "undefined" ){
				els[els.length] = {
					"key"   : var_els[0],
					"value" : var_els[1]
				};
			}
		}
	}
	var bFoundPageID = false;
	for( var i in els ){
		if (els[i]['key'] == 'id') {
			els[i]['value'] = sPageID_;
			bFoundPageID = true;
		}
	}
	if (!bFoundPageID) {
		els[els.length] = {
			"key"   : 'id',
			"value" : sPageID_
		};
	}
	var uri = document.location.href.split("?")[0]+"?";
	for( var i in els ){
		uri+= els[i]['key']+"="+els[i]['value']+"&";
	}
	uri = uri.substr( 0, uri.length-1 );
	document.location.href = uri;
}
function getCookie(oDocument_, sCookie_) {
	var iStart = oDocument_.cookie.indexOf(sCookie_+"=");
	var iLen = iStart+sCookie_.length+1;
	if ((!iStart) && (sCookie_ != oDocument_.cookie.substring(0,sCookie_.length))) return null;
	if (iStart == -1) return null;
	var iEnd = oDocument_.cookie.indexOf(";",iLen);
	if (iEnd == -1) iEnd = oDocument_.cookie.length;
	return unescape(oDocument_.cookie.substring(iLen,iEnd));
}
function getDKEntryCount(oDocument_) {
	var sDKEntryCount = getCookie(oDocument_, 'roefix_dk_entries');
	if (sDKEntryCount) {
		oDocument_.write("["+sDKEntryCount+"]");
	}
}
function saveDK(oDocument_, sFormName_) {
	var oSF;
	if (sFormName_) {
		oSF = oDocument_.forms[sFormName_];
	}
	else {
		oSF = oDocument_.forms['save'];
	}
	if (oSF) {
		oSF.submit();
	}
	else {
	}
}
function addToDK(sHref_, sDocument_, sReference_) {
	DK_add(sHref_, sDocument_, sReference_);
}
function aDK(sHref_, sDocument_, sReference_) {
	DK_add(sHref_, sDocument_, sReference_);
}
function __invAction(oDocument_, sActionName_) {
	var oSF = oDocument_.forms['save'];
	if (oSF) {
		var oFormAction = getObjectByID(oDocument_, 'action');
		if (oFormAction) {
			oFormAction.value = sActionName_;
			oSF.action.value = sActionName_;
			oSF.submit();
		}
	}
}
function clearDK(oDocument_) {
	__invAction(oDocument_, 'clearDK');
}
function getDKZIP(oDocument_) {
	__invAction(oDocument_, 'getDKZIP');
}

function DKManager(obj_name){
	this.objName = obj_name;
	this.is_ie = navigator.userAgent.indexOf("MSIE")!=-1;
	
	this.DKFile = "/downloads/downloads.php";
	
	this.addItem = function(sHref_, sDocument_, sReference_) {
		this.__addItem(sHref_, sDocument_, sReference_);
	}; 
	
	this.request;
	this.__initRequest = function(){
		try {
			this.request.abort();
		}
		catch(e) {}
		
		try {
			this.request = new XMLHttpRequest();
		}
		catch(e) {
			try {
				this.request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e) {
				try {
					this.request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e) {
					alert("ActiveX muss aktiviert sein.");
					return false;
				}
			}
		}
		return true;
	};
	
	this.__addItem = function(sHref_, sDocument_, sReference_) {
		var sPageID = "";
		var els = [];
		var uri_els = document.location.href.split("?");
		if (uri_els[1]){
			uri_els = uri_els[1].split("&");
			for( var i in uri_els ){
				var var_els = uri_els[i].split("=");
				if( typeof var_els[1] != "undefined" ){
					els[els.length] = {
						"key"   : var_els[0],
						"value" : var_els[1]
					};
				}
			}
		}
		var bFoundPageID = false;
		for( var i in els ){
			if (els[i]['key'] == 'id') {
				sPageID = els[i]['value'];
				bFoundPageID = true;
			}
		}
		if (!this.__initRequest()) {
			return false;
		}
		this.request.onreadystatechange = new Function( this.objName+".__addItemOnReadyHandler()" );
		var sRequest ="&href=" + sHref_ + "&document=" + sDocument_ + "&reference=" + sReference_;
		
		if (bFoundPageID) {
			sRequest += "&pid=" + sPageID;
		}
		this.request.open("GET", this.DKFile+"?a=addItemJS"+sRequest);
		this.request.send(null);
	};
	
	this.__addItemOnReadyHandler = function(){
		if (this.request.readyState == 4) {
			if (this.request.status == 200) {
				if( this.request.responseText != "success" ){
					alert("Fehler:\n"+this.request.responseText);
				}
				else {
					var oDKQnt = getObjectByID(document, "dk");
					if (oDKQnt) {
						var sDKEntryCount = getCookie(document, 'roefix_dk_entries');
						if (sDKEntryCount) {
							oDKQnt.innerHTML = "["+sDKEntryCount+"]";
						}
					}
				}
			}
			else {
				alert("Der Server ist nicht erreichbar.");
			}
		}
		else {
			//alert("readyState: " + String(this.request.readyState));
		}
	};
};

var __DKManager = new DKManager("__DKManager");
function DK_add(sHref_, sDocument_, sReference_) {
	__DKManager.addItem(sHref_, sDocument_, sReference_);
}

function italia(){
	if (navigator.appName == 'Netscape')
	var language = navigator.language;
	else
	var language = navigator.browserLanguage;
	
	if (language.indexOf('de') > -1){
		window.location.href = 'index.1.10.html';
	}else{
		window.location.href = 'index.1.5.html';		
	}
}

function cr_cinema(flv,new_width,new_height){
	// Layer
	document.getElementById('cinema_layer').style.display = '';
	//margin-left:-360px; width:720px;
	document.getElementById('cinema_layer').style.width = new_width+'px';
	document.getElementById('cinema_layer').style.marginLeft = -(new_width/2)+'px';
	
	//black
	window.scrollTo(0, 0);
	Effect.Appear("black_layer", {duration: 0.5, from: 0.0, to:0.8});
	
	//SWF
	var flashvars = {
	  src: flv,
	  width: new_width,
	  height: new_height
	};
	var params = {
	  menu: "false",
	  wmode: "transparent",
	  allowScriptAccess: "sameDomain",
	  quality: "high",
	  allowfullscreen: true
	};
	var attributes = {
	  id: "flv_cinema",
	  name: "flv_cinema"
	};
	new_height1 = parseInt(new_height)+31;	
	//alert("swf:"+new_width+"x"+new_height1);
	//alert("flv:"+new_width+"x"+new_height);
	swfobject.embedSWF("fileadmin/swf/videoplayer.swf?src=/"+flv+"&new_width="+new_width+"&new_height="+new_height, "flashcontainer", new_width, new_height1, "9.0.0","fileadmin/swf/expressInstall.swf", flashvars, params, attributes);

}
function cr_cinema_baba(){
	document.getElementById('black_layer').style.display = "none";
	document.getElementById('cinema_layer').style.display = "none";
	swfobject.removeSWF("flv_cinema");
	document.getElementById('restorecontainer').innerHTML = '<div id="flashcontainer"></div>';
}

//-----------------------------------------------------------------------------------------------------------------------------

function urlencode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: travc
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Lars Fischer
    // +      input by: Ratheous
    // %          note 1: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'
    // *     example 2: urlencode('http://kevin.vanzonneveld.net/');
    // *     returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
    // *     example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
    // *     returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
                             
    var hash_map = {}, unicodeStr='', hexEscStr='';
    var ret = (str+'').toString();
    
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    
    // The hash_map is identical to the one in urldecode.
    hash_map["'"]   = '%27';
    hash_map['(']   = '%28';
    hash_map[')']   = '%29';
    hash_map['*']   = '%2A';
    hash_map['~']   = '%7E';
    hash_map['!']   = '%21';
    hash_map['%20'] = '+';
    hash_map['\u00DC'] = '%DC';
    hash_map['\u00FC'] = '%FC';
    hash_map['\u00C4'] = '%D4';
    hash_map['\u00E4'] = '%E4';
    hash_map['\u00D6'] = '%D6';
    hash_map['\u00F6'] = '%F6';
    hash_map['\u00DF'] = '%DF';
    hash_map['\u20AC'] = '%80';
    hash_map['\u0081'] = '%81';
    hash_map['\u201A'] = '%82';
    hash_map['\u0192'] = '%83';
    hash_map['\u201E'] = '%84';
    hash_map['\u2026'] = '%85';
    hash_map['\u2020'] = '%86';
    hash_map['\u2021'] = '%87';
    hash_map['\u02C6'] = '%88';
    hash_map['\u2030'] = '%89';
    hash_map['\u0160'] = '%8A';
    hash_map['\u2039'] = '%8B';
    hash_map['\u0152'] = '%8C';
    hash_map['\u008D'] = '%8D';
    hash_map['\u017D'] = '%8E';
    hash_map['\u008F'] = '%8F';
    hash_map['\u0090'] = '%90';
    hash_map['\u2018'] = '%91';
    hash_map['\u2019'] = '%92';
    hash_map['\u201C'] = '%93';
    hash_map['\u201D'] = '%94';
    hash_map['\u2022'] = '%95';
    hash_map['\u2013'] = '%96';
    hash_map['\u2014'] = '%97';
    hash_map['\u02DC'] = '%98';
    hash_map['\u2122'] = '%99';
    hash_map['\u0161'] = '%9A';
    hash_map['\u203A'] = '%9B';
    hash_map['\u0153'] = '%9C';
    hash_map['\u009D'] = '%9D';
    hash_map['\u017E'] = '%9E';
    hash_map['\u0178'] = '%9F';
    
    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);
 
    for (unicodeStr in hash_map) {
        hexEscStr = hash_map[unicodeStr];
        ret = replacer(unicodeStr, hexEscStr, ret); // Custom replace. No regexing
    }
    
    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
}
