function my_print_site(){
	window.focus();
	if (document.all && 4 == navigator.appVersion.substring(22,23)){
		var OLECMDID_PRINT = 6;
		var OLECMDEXECOPT_DONTPROMPTUSER = 2;
		var OLECMDEXECOPT_PROMPTUSER = 1;
		if (!WebBrowser1){
			var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
			document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
		}
		WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
		WebBrowser1.outerHTML = '';
	}else{
		window.print();
	}
}
function my_send_site(){
	window.open('send.php?url=' + escape(location.href.replace(/#$/, '')),'send','width=320,height=220').focus();
}
function my_get_lex(id){
	window.open('lexikon.php?id=' + id, 'lextext', 'width=400,height=420').focus();
}
function my_set_env(e){
	var m, h, elMin, elBottom, elPlayers, elLastFrame;
	elPlayers = document.getElementById('div-players');
	elLastFrame = document.getElementById('div-more-nav-iframe');
	if (!elFoot || !elPlayers){
		return;
	}
	if (1 == e){

		elMin = document.getElementById('div-min-height');
		elBottom = document.getElementById('div-check-bottom');

		if (elMin && elBottom){
			my_clear_class(elFoot, 'nodis');
			if (elLastFrame){
				m = Math.max(elFoot.offsetTop, Math.max(elLastFrame.offsetTop + elLastFrame.offsetHeight, elBottom.offsetTop - elFoot.offsetHeight));
			}else{
				m = Math.max(elMin.offsetTop, Math.max(elFoot.offsetTop, elBottom.offsetTop - elFoot.offsetHeight));
			}
			if (elHomeTeaser){
				if (elLastFrame){
					h = elLastFrame.offsetTop + elLastFrame.offsetHeight;
				}else if (elSubNav){
					h = elSubNav.offsetTop + elSubNav.offsetHeight;
				}else if (elMain){
					h = elMain.offsetTop + elMain.offsetHeight;
				}
				h += 10;
				elHomeTeaser.style.top = h + 'px';

				var d = m - h;
				if (d > oHomeParam['max-height']){
					elHomeTeaser.style.height = oHomeParam['max-height'] + 'px';
					elHomeTeaser.style.top = (m - elHomeTeaser.offsetHeight) + 'px';
				}else if (d < oHomeParam['min-height']){
					elHomeTeaser.style.height = oHomeParam['min-height'] + 'px';
					m += (oHomeParam['min-height'] - d);
				}else{
					elHomeTeaser.style.height = d + 'px';
				}

				oHomeParam['max'] = oHomeParam['max-height'] - elHomeTeaser.offsetHeight;
				oHomeParam['min'] = elHomeTeaser.offsetTop;
				oHomeParam['end-height'] = elHomeTeaser.offsetHeight;

				if (0 < oHomeParam['max'] && elHomeTeaserNav){
					elHomeTeaserNav.className = 'home-open';
					elHomeTeaserNav.onclick = show_home_toggle;
				}
			}
			elFoot.style.top = m + 'px';

			if (m > elMin.offsetTop + 100){
				my_clear_class(elPlayers, 'nodis');
				elPlayers.style.top = (m - elPlayers.offsetHeight) + 'px';
			}

		}
	}else{
		my_add_class(elFoot, 'nodis');
		setTimeout('my_set_env(1)', 100);
	}
}
function show_home_toggle(){
	if (elHomeTeaser.offsetHeight < oHomeParam['max-height']){
		my_add_class(elHomeTeaser, 'home-zindex');
		show_home_enlarge(oHomeParam['max']);
	}else if (elHomeTeaser.offsetTop < oHomeParam['min']){
		my_clear_class(elHomeTeaser, 'home-zindex');
		elHomeTeaser.style.height = oHomeParam['end-height'] + 'px';
		elHomeTeaser.style.top = oHomeParam['min'] + 'px';
		elHomeTeaserNav.className = 'home-open';
	}
}
function show_home_enlarge(m, h, c){
	h = !h ? Math.floor(m/4) : Math.max(2, h*0.7);

	var s = Math.ceil(elHomeTeaser.offsetHeight + h);
	elHomeTeaser.style.top = (elFoot.offsetTop - s) + 'px';
	elHomeTeaser.style.height = s + 'px';
	if (elHomeTeaser.offsetHeight > oHomeParam['max-height']){
		elHomeTeaserNav.className = 'home-close';
		elHomeTeaserNav.onclick = show_home_toggle;
		my_clear_timeout('media');
	}else{
		_RUN['media'] = setTimeout('show_home_enlarge(' + m + ',' + h + ')', 20);
	}
}
function my_append_child(t, p, oC){
	var i, c;
	c = document.createElement(t);
	if (oC){
		for (i in oC){
			c[i] = oC[i];
		}
	}
	return p.appendChild(c);
}
function my_clear_class(e, s){
	var aC = e.className.split(' ');
	var c = '';
	for (var i in aC){
		if (s != aC[i] && '' != aC[i]){
			c += ('' == c ? '' : ' ') + aC[i];
		}
	}
	e.className = c;
}
function my_add_class(e, s){
	if (false == my_find_class(e, s)){
		var aC = e.className.split(' ');
		aC.push(s);
		e.className = aC.join(' ');
	}
}
function my_find_class(el, s){
	return -1 == el.className.indexOf(s) ? false : true;
}
function my_clear_timeout(e){
	clearTimeout(_RUN[e]);
	_RUN[e] = 0;
}
function get_topic_name(e){
	return e.replace(/^[^-]+\-([^-]+).*$/, '$1');
}
function my_set_opacity(el, o){
	if (_ENV['ie']){
		el.style.filter = 'alpha(opacity=' + o + ')';
	}else{
		el.style.opacity = o/100;
	}
}

_RUN = { media:0, cal:0, calrun:0, calshow:0, 'mp3-machine':0 };
_ENV = { ie:(-1 != navigator.appVersion.indexOf('MSIE')) };