// JavaScript Document

function getEl(s){
	return (document.getElementById)?document.getElementById(s):document.all[s];
}	
            
function show(name) {
	getEl(name).style.display = "block";
}

function hide(name) {
	getEl(name).style.display = "none";
}

function getFlash(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
	
  var objAttrs = ret.objAttrs;
  var params = ret.params;
  var embedAttrs = ret.embedAttrs;
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  return str;
}

function flash(w, h, name) {	
	var location = "media/" + name;
	var elid = "fe" + Math.round(Math.random() * 1000000000);

	var fla = "<script language=\"javascript\" type=\"text/javascript\">\n";
	fla += "	AC_FL_RunContent(\n";
	fla += "		'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',\n";
	fla += "		'width', '" + w + "',\n";
	fla += "		'height', '" + h + "',\n";
	fla += "		'src', '" + location + "',\n";
	fla += "		'quality', 'best',\n";
	fla += "		'pluginspage', 'https://www.macromedia.com/go/getflashplayer',\n";
	fla += "		'align', 'middle',\n";
	fla += "		'play', 'true',\n";
	fla += "		'loop', 'false',\n";
	fla += "		'scale', 'showall',\n";
	fla += "		'wmode', 'transparent',\n";
	fla += "		'devicefont', 'false',\n";
	fla += "		'id', '" + elid + "',\n";
	fla += "		'bgcolor', '#ffffff',\n";
	fla += "		'name', '" + elid + "',\n";
	fla += "		'menu', 'true',\n";
	fla += "		'allowFullScreen', 'false',\n";
	fla += "		'allowScriptAccess','sameDomain',\n";
	fla += "		'movie', '" + location + "',\n";
	fla += "		'salign', ''\n";
	fla += "		);\n";
	fla += "</script>\n";
	document.write(fla);
}

function showVid(elem, w, h, name) {
	var location = "media/" + name;
	var elid = "fe" + Math.round(Math.random() * 1000000000);

	show(elem);
	var flash = getFlash (
		'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', w,
		'height', h,
		'src', location,
		'quality', 'best',
		'pluginspage', 'https://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'false',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', elid,
		'bgcolor', '#ffffff',
		'name', elid,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', location,
		'salign', '');
	getEl(elem).innerHTML = flash;
}

function hideVid(elem) {
	getEl(elem).innerHTML = '';
	hide(elem);
}

function showTv(no) {
	var w = 320;
	var h = 240;
	var location = "media/video?datei=video" + no + ".flv";
	var elid = "fe" + Math.round(Math.random() * 1000000000);

	getEl('tvscreen').innerHTML = getFlash (
		'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', w,
		'height', h,
		'src', location,
		'quality', 'best',
		'pluginspage', 'https://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'false',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', elid,
		'bgcolor', '#ffffff',
		'name', elid,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', location,
		'salign', '');
}

function hideTv() {
	getEl('tvscreen').innerHTML = '';
}

function overTv(no, pos) {
	/* showTv(no); */
	showVid("altvid", "320", "240", "video?datei=video" + no + ".flv");
	if (pos == "l") {
		getEl('altvid').style.left = '300px';	
	} else {
		getEl('altvid').style.left = '-200px';
	}
}

function clickTv(no, pos) {
	/* showTv(no); */
}

function outTv(no, pos) {
	/* hideTv(); */
	getEl('altvid').innerHTML = '';
	hide('altvid');
}

var sound = true;
function swapSound() {
	if (sound) {
		sound = false;	
		swapSoundImage("images/soundon.png");
		hideVid('radio');
	} else {
		sound = true;
		swapSoundImage("images/soundoff.png");
		showVid('radio', 10, 10, 'sound');
	}
}

function swapSoundImage(swapTo) {
	getEl('muteimg').src = swapTo;
	//cnodes = aelem.childNodes;
	//cnodes[0].src = swapTo;
}

function youTube(id) {
	var cnt = "<object width=\"480\" height=\"385\">";
	cnt += "<param name=\"movie\" value=\"http://www.youtube.com/p/" + id + "&amp;hl=de&amp;fs=1\"></param>";
	cnt += "<param name=\"allowFullScreen\" value=\"true\"></param>";
	cnt += "<param name=\"allowscriptaccess\" value=\"always\"></param>";
	cnt += "<embed src=\"http://www.youtube.com/p/" + id + "&amp;hl=de&amp;fs=1\" type=\"application/x-shockwave-flash\" ";
	cnt += "width=\"480\" height=\"385\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object>";	
	document.write(cnt);
}

function em() {
	document.write('<a href="mail');
	document.write('to:');
	emm();
	document.write('">');
	emm()
	document.write('</a>');
}

function emm() {
	document.write('info');
	document.write('@');	
	document.write('praxisblume');
	document.write('.');
	document.write('de');	
}

function updateNavi() {
	var url = document.URL;
	var navi = getEl('navi');
	var cnodes = navi.childNodes;
	for (i = 0; i < cnodes.length; i++) {
		if (cnodes[i].nodeName.toLowerCase() == "li") {
			var anodes = cnodes[i].childNodes;
			var label = anodes[0].innerHTML;
			if (label == "Praxis") {
				label = "index";	
			}
			var page = label.toLowerCase() + ".html";
			if (url.indexOf(page) > 0) {
				anodes[0].style.border = '1px solid white';
				anodes[0].style.borderWidth = '1px 0 1px 0';
			}
		}
	}
}
