var nIE4Win;
var nCanPrint;
var printed; 
function init() {
	printed = "no";
	if (window.print) {
		nCanPrint = "yes";
	} else {
		nCanPrint = "no";
	}
    var agt=navigator.userAgent.toLowerCase();
    nVersion = parseInt(navigator.appVersion);
    nIE  = (agt.indexOf("msie") != -1);
    nWin   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
	nMac = (agt.indexOf("mac") != -1);
	nIE4Win  = (nIE && (nVersion == 4) && nWin);
	doPrint();
}
function doPrint() {
if (nCanPrint == "yes") {
	printed="yes";
		window.print();

	} else if (nIE4Win) {
	printed="yes";
		IEPrint();
	}
	else
	{
 alert("Bitte benutzen Sie die Druckfunktion in Ihrer Navigationsleiste!");		
	}
}

//Netscape Flash-Abfrage
var ver = 0;
var flashOK = false;

if (navigator.plugins && navigator.plugins['Shockwave Flash']) {
  var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  for (var a = 0; a < words.length; ++a) {
	  if (isNaN(parseInt(words[a]))) continue;
		ver = parseInt(words[a]);
  }
} 

//Internet Explorer FlashAbfrage
if (document.all) {
  document.write(''+
  '<s'+'cript language="VBScript">\nOn error resume next\n'+
  'ver=0\n'+
  'For i=7 to 3 step -1\n'+
  'Set x = CreateObject("ShockwaveFlash.ShockwaveFlash." & i)\n'+
  'v = IsObject(x)\n'+
  'if v then \n'+
  'ver=i\n'+
  'Exit For\n'+
  'End If\n'+
  'next\n'+
  '</scrip'+'t>')
}

//hier wird die Version angegeben
flashOK = (ver >= 6)? true : false;


//Popupfunktion
function openWin(url, winName, pWidth, pHeight, scrollbars, status) {
  var paramStr, xPos, yPos;
  xPos = (screen.width - pWidth) / 2;
  yPos = (screen.height - pHeight) / 2;
  paramStr = "location=no,menubar=no,toolbar=no,resizable=yes,width="+pWidth+",height="+pHeight+",top="+yPos+",left="+xPos+",scrollbars="+scrollbars+",status="+status;
  win = window.open(url, winName, paramStr);
}

//FAQ 
function toggleFAQ(faq) {
	var faqlayer = document.getElementById(faq);
	if (faqlayer.style.display == '') //test in ie, if not set -> set it!
		faqlayer.style.display = "none";
	if (faqlayer.style.display == "none") 
		faqlayer.style.display = "block";
	else 
		faqlayer.style.display = "none";
	return false;
}

//Videochoice 
function hideVideoLayer(id) {
	document.getElementById("videoChoice_"+id+"_Player").style.display = "none";
	document.getElementById("videoChoice_"+id+"_Player_Cont").innerHTML = "";
	document.getElementById("videoChoice_"+id+"_Select").style.display = "block";
}


function showVideo(node,id) {
	video 		= node.videoChoiceSelect[node.videoChoiceSelect.selectedIndex].value;
	file_ext 	= "";
	
	if(video != "none" && video != "") {
		ext_end 	= (video.indexOf("?") != -1) ? video.indexOf("?") : video.length;
		file_ext 	= video.substring(video.lastIndexOf(".")+1,ext_end);
		src 		= video.substring(0,video.indexOf("?"));
		width 		= 320;
		height 		= 240;
		
		//Get width and height values from string
		if(video.indexOf("?") != -1) {
			temp = video.split("?");
			temp = temp[1].split("&");
			for(i=0;i<temp.length;i++) {
				keyval = temp[i].split("=");
				if(keyval[0] != "" && keyval[1] != "") eval(keyval[0] + "=" + keyval[1]);
			}
		}
		
    if(file_ext == "zip") {
      window.location.href = video;
      return false;
    }
    
		player_cont = '<div class="videoChoiceContPlayer" align="center">';
		
		if(file_ext == "wmv") {
			player_cont += 	'<OBJECT ID="test" name="test" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" HEIGHT="'+height+'" WIDTH="'+width+'">'+
							'	<PARAM NAME="showControls" VALUE="true">'+
							'	<PARAM NAME="autostart" VALUE="true">'+
							'	<PARAM NAME="src" VALUE="'+src+'">'+
							'	<EMBED SRC="'+src+'" autoplay="true" controller="true" enablejavascript="true" HEIGHT="'+height+'" WIDTH="'+width+'" AUTOSTART="true"></embed>'+
							'</OBJECT>';
		} else if(file_ext == "rm") {
			player_cont += 	'<OBJECT ID="id" name="id" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="'+height+'" WIDTH="'+width+'">'+
 							'	<PARAM NAME="controls" VALUE="ImageWindow">'+
							'	<PARAM NAME="console" VALUE="video_'+id+'">'+
							'	<PARAM NAME="autostart" VALUE="false">'+
							'	<PARAM NAME="src" VALUE="'+src+'">'+
							'	<EMBED SRC="'+src+'" type="audio/x-pn-realaudio-plugin" CONSOLE="video_'+id+'" CONTROLS="ImageWindow" HEIGHT="'+height+'" WIDTH="'+width+'" AUTOSTART="false"></embed>'+
							'</OBJECT>'+
							'<OBJECT ID="" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="30" width="'+width+'">'+
							'	<PARAM NAME="controls" VALUE="ControlPanel">'+
							'	<PARAM NAME="console" VALUE="video_'+id+'">'+
							'	<PARAM NAME="autostart" VALUE="true">'+
							'	<EMBED type="audio/x-pn-realaudio-plugin" CONSOLE="video_'+id+'" CONTROLS="ControlPanel" HEIGHT="30" width="'+width+'" AUTOSTART="true"></embed>'+
							'</OBJECT>';
		} else if(file_ext == "mov") {
			player_cont += 	'<OBJECT ID="x" name="x" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" HEIGHT="'+height+'" WIDTH="'+width+'">'+
							'	<PARAM NAME="controller" VALUE="true">'+
							'	<param name="type" value="video/quicktime">'+
							'	<PARAM NAME="autostart" VALUE="true">'+
							'	<PARAM NAME="src" VALUE="'+src+'">'+
							'	<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/">'+
							'	<EMBED SRC="'+src+'" type="video/quicktime" autoplay="false" controller="true" enablejavascript="true" HEIGHT="'+height+'" WIDTH="'+width+'" AUTOSTART="true" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></embed>'+
							'</OBJECT>';
		} else {
			document.location = video;
		}
		
		player_cont += 	'</div>';
						
		document.getElementById("videoChoice_"+id+"_Player_Cont").innerHTML = player_cont;
		document.getElementById("videoChoice_"+id+"_Select").style.display = "none";
		document.getElementById("videoChoice_"+id+"_Player").style.display = "block";
	}
	
	return false;
}
