
function seite_abdunkeln(clickactive){	
	if(clickactive==null){clickactive=true;}
	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				if(clickactive){$("#TB_overlay").click(hide_window);}
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'>&nbsp;</div><div id='TB_window'></div>");
				if(clickactive){$("#TB_overlay").click(hide_window);}
			}
		}
		//if(clickactive){$("#TB_window").click(seite_normal);}
		//$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+width+"px;height:"+height+"px;border:0px solid red;'></div>");	

		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
	}catch(e) {
		//nothing here
	}
	
}

function seite_normal() {		
	$('#TB_window,#TB_overlay,#TB_HideSelect').unbind().remove();	
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	return;
}

function show_window(width,height,inhalt){
	seite_abdunkeln();	
	$("#TB_window").css({width:width+'px',height:height+'px'});
	tb_position(width,height);
	$("#TB_window").fadeIn("slow",function(){fill_window(inhalt);});
}

function hide_window(){
	document.getElementById('TB_window').innerHTML = '';
	$("#TB_window").fadeOut("slow",function(){seite_normal();});
}

function fill_window(inhalt){
    //inhalt = 'stefaaaaaaaaaaan<br>was geht?????';
	//inhalt = flv_video('extensions/flvplayer/video.flv',640,480,'true','bottom');
	document.getElementById('TB_window').innerHTML = inhalt;
}


// helper

function tb_position(TB_WIDTH,TB_HEIGHT) {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}


