function fpOpen(type, url, params)
{
	if(type=='popup'){
		var win=open(url,'',params);
		win.focus();
	}else{
		document.location.href = url;
	}
}


function checkIt()
	{
	if (navigator.appVersion.indexOf("(X11") != -1 || navigator.appVersion.indexOf("(Mac") != -1) return 1
	else return 0
	}

function openWindow(pfad,fenstername,groesse)
	{
	var newfenster = window.open(pfad, fenstername, groesse);
	newfenster.focus();
	if (checkIt() == 1 )
		{
		newfenster = window.open(pfad, fenstername);
		newfenster.focus();
		}
	}

function seturl(referrer_url)
	{
	popupurl = referrer_url + '?' + document.URL + location.search;
	}
	
var dom = 0;
if(document.getElementById) dom = 1;
var pic = new Array();
for (i=1; i<=10; i++)
	{
	pic[i] = new Image();
	}
// Umfrage-Haken
function radioselect(nummer)
	{
	for (i=0; i<=radiobuttons; i++)
		{
		var ziel = bildname + i;
                if  (document.images[ziel])
                        {
		        document.images[ziel].src = "/img/" + farbschema + "/" + dateiname + "i.gif";
		        document.forms[formname][radiobuttonsname].value = 0;
                        }
		}
	if (unselect != nummer)
		{
		var ziel = bildname + nummer;
		document.images[ziel].src = "/img/" + farbschema + "/" + dateiname + "a.gif";
		unselect = nummer;
		document.forms[formname][radiobuttonsname].value = nummer;
		}
	else unselect = -1;
	}
	
// Flashaufruf
function checkplugin()
	{
	var MM_contentVersion = 6;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) 
		{
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
			{
			if (isNaN(parseInt(words[i])))
			continue;
			var MM_PluginVersion = words[i];
			}
		MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
		}
	}
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1))
	{
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
	}

function flash (id, swf, mp3, bild, b, h, farbe)
	{
	checkplugin();

		switch (farbe) {
 case 'blau1':
   farbe = '6ba0cd';
    break;
 case 'blau2':
   farbe = '8ea5bc';
    break;
  case 'gruen':
   farbe = '65a82c';
    break;
  case 'gelb':
   farbe = 'FFD748';
    break;
  case 'orange':
   farbe = 'ff9f2e';
    break;
  case 'rot':
   farbe = '990000';
    break;
  case 'hp':
   farbe = 'ffee63';
    break;
  case 'com':
   farbe = '65a82c';
    break;
  default:
    farbe = farbe;
    break;
}

	if (mp3=='') var mp3datei = '';
	else var mp3datei = '?soundfile=' + mp3;

	if ( MM_FlashCanPlay )
		{
		var flashlilm = '<object'
			+ ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ ' codebase="http://download.macromedia.com/pub/shockwave'
				+ '/cabs/flash/swflash.cab#version=6,0,0,0"'
			+ ' id="' + id + '"'
			+ ' width="' + b + '"'
			+ ' height="' + h + '">'
			+ '<param name="movie" value="' + swf + mp3datei + '">'
			+ '<param name="play" value="true">'
			+ '<param name="menu" value="false">'
			+ '<param name="quality" value="high">'
			+ '<param name="wmode" value="transparent">'
			+ '<param name="bgcolor" value="#' + farbe + '">'
			+ '<embed src="' + swf + mp3datei + '"'
			+ ' quality="high" bgcolor="#' + farbe + '"'
			+ ' width="' + b + '" height="' + h + '"'
			+ ' id="' + id + '" name="' + id + '"'
			+ ' type="application/x-shockwave-flash"'
			+ ' pluginspace="http://www.macromedia.com/go/getflashplayer">'
			+ '</embed></object>';
		}
	else 
		var flashlilm = '<img src="' + bild + '" width="' + b + '" height="' + h + '" alt="" border="0">';
	
	return flashlilm;
	}

// Flash-Rundung in der Navigation
browserName = navigator.appName.substring(0,8);
if (browserName == "Microsof") browser = 'IE';
else browser = 'XX';
var MM_contentVersion = 3;
var MM_FlashCanPlay = false;
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1))
	{
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
	}

function flashrundung(datei,farbschema)
	{
	if ( MM_FlashCanPlay && browser=='IE')
		{
		var rundung = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
		rundung = rundung+ ' ID="navrundung" width="21" height="42">';
		rundung = rundung+ '<param name="movie" value="/flash/' + datei +'.swf">';
		rundung = rundung+ '<param name="play" value="false">';
		rundung = rundung+ '<param name="loop" value="false">';
		rundung = rundung+ '<param name="menu" value="false">';
		rundung = rundung+ '<param name="quality" value="high">';
		rundung = rundung+ '<param name="wmode" value="transparent">';
		rundung = rundung+ '</object>';
		}
	else var rundung = '<img src="/img/' + farbschema + '/' + datei + '.gif" width="21" height="42" alt="" border="0">';

	return rundung;
	}
	
// bilderwechsel on mouseover/out (orig. mm dreamweaver mx 2004)
function MM_swapImgRestore() { //v3.0
  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_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_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];}
}

function goTo(popThrough) {
if (!window.opener){
self.open(popThrough)
} else if (window.opener.closed){
window.open(popThrough);
window.close();
} else if (!window.opener.parent){
window.opener.location.href = popThrough;
window.close();
}
else {
window.opener.parent.location.href = popThrough;
window.close();
}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function PrintContent(frame)
  {
    parent.frames[frame].focus();
    parent.frames[frame].print();

  }
  
function IsLoggedIn() { 
    var search = "TIVI_ID="; 
    if (document.cookie.length > 0) { // if there are any cookies 
      offset = document.cookie.indexOf(search); 
      if (offset != -1) { // if cookie exists 
         offset += search.length; 
         // set index of beginning of value 
         end = document.cookie.indexOf(";", offset); 
         // set index of end of cookie value 
         if (end == -1) 
            end = document.cookie.length; 
         return unescape(document.cookie.substring(offset, end)); 
      } 
    } 
    return false; 
  } 

function tell_a_friend() 
  {
    var winopts="height=485,width=628,scrollbars=no,resizable=0,status=0,location=0,toolbar=0";
    Win = window.open("/tivi-treff/weitersagen/?url="+escape(location.href), "tell_a_friend", winopts);
  }

function tell_a_friend_url(url) 
  {
    var winopts="height=485,width=628,scrollbars=no,resizable=0,status=0,location=0,toolbar=0";
    Win = window.open("/tivi-treff/weitersagen/?url="+escape(url), "tell_a_friend", winopts);
  }
/*
   idList is an Array object holding all ids of
   enclosing layers plus the id/name of an inner
   img tag.
   Order of elements is from outside in:
   ['most_outer_div_id', 'next_div_id', 'img_id].
   The ids of enclosing divs are only needed for NS4.
   The img tag must have id *and* name attribute
   if this is to work with NS4.
*/
function setSource(path, idList)
{
	var imgId = idList[idList.length - 1];
	var img;
	
	if (document.getElementById) {
		img = document.getElementById(imgId)
	}
	else if (document.all) {
		img = document.all[imgId];
	}
	else if (document.layers) {
		img = document[idList[0]];
		for (var i = 1; i < idList.length; i++) {
			if (!img) return;
			img = img.document[idList[i]];
		}
	}
	else {
		return;
	}
	
	if (!(img && img.src)) return;
	img.src = path;
}

function openChat(chatid)
{
  var width=780;
  var height=485;
  var url="/tivi-treff/chat/start.php?chatid="+chatid;
  var winopts="height="+height+",width="+width+",scrollbars=no,resizable=1,status=0,location=0,toolbar=0";
  
  win=window.open(url, 'tivi_chat', winopts); }

function openChatPopup(chatid, width, height)
{
  var url="/tivi-treff/chat/start.php?chatid="+chatid;
  var winopts="height="+height+",width="+width+",scrollbars=no,resizable=1,status=0,location=0,toolbar=0";
  
  win=window.open(url, 'tivi_chat', winopts); }

 
function openChatProtokoll(chatid)
{
  var width=642;
  var height=484;
  var url=" /tivi-treff/chat/protokoll.php?chatid="+chatid;
  var winopts="height="+height+",width="+width+",scrollbars=yes,resizable=1,status=0,location=0,toolbar=0";

  win = window.open(url, 'tivi_chat', winopts); }

function PlaySound()
{
    if (document.all){
        document.all.play.src = "/mp3/beepbeep.mp3";
    }
}

// Allegemeiner Flashquelltext
// eingesetzt in Funktion: popFlash() ;  helpFlash ();
//

function flashSource(id,swf,breite,hoehe,farbe,align,varName,varFile){
	
		if (!varName || varName == '') var variable = '' ;
		if (!varFile || varFile == '') var variable = '' ;
		else	var variable = '?' + varName + '=' + varFile;
		
			var flashCode = '<object'
			+ ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'
			+ ' id="' + id + '"'
			+ ' width="' + breite + '"'
			+ ' height="' + hoehe + '"'
			+ ' align="' + align + '">'
			+ '<param name="movie" value="' + swf + variable +'">'
			+ '<param name="play" value="true">'
			+ '<param name="menu" value="false">'
			+ '<param name="quality" value="high">'
			+ '<param name="scale" value="default">'
			+ '<param name="bgcolor" value="' + farbe + '">'
			+ '<embed src="' + swf + variable +'"'
			+ ' quality="high" bgcolor="' + farbe + '"'
			+ ' width="' + breite + '" height="' + hoehe + '"'
			+ ' id="' + id + '" name="' + id + '"'
			+ ' type="application/x-shockwave-flash"'
			+ ' pluginspace="http://www.macromedia.com/go/getflashplayer">'
			+ '</embed></object>';
	return flashCode;
	//alert (flashCode);
	}




// Flash Aufruf V2
// eingesetzt in: Flash Popup

function popFlash (swf,breite,hoehe,farbe,varName,varFile){
	checkplugin();
	var id			= "tiviFlash";
	var align 		= "center";
	var noFlashColor 	= "#FFB710";
	var ersatzbild 	= "/img/flash/noFlash.gif";
	
	if (!swf) return(false);
	
	if (!breite) breite = "100%";
	if (!hoehe)  hoehe 	= "100%";
	if (!farbe)  farbe 	= "#EAAE01";
	

	if ( MM_FlashCanPlay )
		{
		var flashfilm = flashSource(id,swf,breite,hoehe,farbe,align,varName,varFile);

		}else{ 
			var flashfilm = '<table id="' + id + '"'
			+ ' bgcolor="' + noFlashColor + '"'
			+ ' width="' + breite + '"'
			+ ' height="' + hoehe + '">'
			+ ' <tr><td align="center">'
			+ ' <img src="' + ersatzbild + '"'
			+ ' width="200"'
			+ ' height = "200"'
			+ ' align="center"'
			+ ' alt=""'
			+ ' border="0">'
			+ ' </td></tr></table>';
		 }
	return flashfilm;
	}
	

// Flash Aufruf für Hilfe Button
// eingesetzt in: Flash Popup	

function helpFlash (swf){
		checkplugin();
	var bild 	= "/img/leer.gif";
	var breite	= "30";
	var hoehe	= "30";
	var align 	= "center";
	var helpUrl  = "http://www.google.de";
	var farbe	= "#FFFFFF";
	var id 	= "flashhilfe";
	var varName = "";
	var varFile = "";
	
	if ( MM_FlashCanPlay ){	
		var flashhelp = flashSource(id,swf,breite,hoehe,farbe,align,varName,varFile);
	}else{ 
			var flashhelp = '<a href = "' + helpUrl + '"><img src="' + bild + '" id = "' + id + '" width="30" height="30" alt="" border="0"></a>';
	 }
	return flashhelp;
}

// Positionierung des Content Layers in Popups
// eingesetzt in: Flash Popup	

function posLayer(b,h){
   var fContHeight,fContWidth,dContHeight,dContWidth,dContTop;
   var dCont = document.getElementById("cont");
   var fCont = document.getElementById("tiviFlash");
   var dContTop = "114px";
   if (b && h){
   	fContHeight = parseInt(h);
   	fContWidth  = parseInt(b);
   	dContHeight = "auto";
   	dContWidth  = "auto";
   	}
  if (!b && !h){
   if (window.innerHeight){// Netscape-Mode / Opera Mode
	fContHeight = window.innerHeight;
	fContWidth  = window.innerWidth;
   	dContHeight = window.innerHeight -138;
   	dContWidth  = window.innerWidth; 
   	}
   else if (document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
	fContHeight = document.documentElement.clientHeight;
	fContWidth 	= document.documentElement.clientWidth;
	dContHeight = "auto"; 
   	dContWidth  = "auto";
	  }

   else if (document.body.offsetHeight){// Other-Explorers-Mode
   	fContHeight = document.body.offsetHeight;
   	fContWidth  = document.body.offsetWidth;
   	dContHeight = "auto"; 
   	dContWidth  = "auto";
   	}
   else return false;
  }
    fCont.style.height 		= fContHeight  - 142;
   	fCont.style.width  		= fContWidth;
   	dCont.style.height 		= dContHeight;
   	dCont.style.width  		= dContWidth;
   	dCont.style.top 		= dContTop;
}


function promorundung(datei,farbschema)
{
    if ( MM_FlashCanPlay && browser=='IE')
            {
            var rundung = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
            rundung = rundung+ ' ID="navrundung" width="33" height="33">';
            rundung = rundung+ '<param name="movie" value="/flash/' + datei +'.swf">';
            rundung = rundung+ '<param name="play" value="false">';
            rundung = rundung+ '<param name="loop" value="false">';
            rundung = rundung+ '<param name="menu" value="false">';
            rundung = rundung+ '<param name="quality" value="high">';
            rundung = rundung+ '<param name="wmode" value="transparent">';
            rundung = rundung+ '</object>';
            }
    else var rundung = '<img src="/img/' + farbschema + '/' + datei + '.gif" width="33" height="33" alt="" border="0">';
    
    return rundung;
}

function gotoStartseite(location)
{
	window.open(location);
	self.close();
}


function login_promo (data, xmlpathfile, filepathfile)
	{
            var promo = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
            promo+= 'ID="login_promo" width="160" height="344">';
            promo+= '<param name="movie" value="' + data + '?xmlpath=' + xmlpathfile + '&filepath' + filepathfile + '">';
            promo+= '<param name="loop" value="false">';
            promo+= '<param name="menu" value="false">';
            promo+= '<param name="quality" value="high">';
            promo+= '</object>';
//alert (promo)
	document.write(promo);
	}

//Flexxe in Templates minimieren
function mini(targetID) {
      obj = document.getElementById(targetID);
      //obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
	obj.style.display = 'none';
}

//Flexxe in Templates maximieren
function maxi(targetID) {
      obj = document.getElementById(targetID);
      obj.style.display = 'block';
}

function showFixedDate() {
		document.write("&#169; ZDF 2012");
}

function openTiviVideothek(vturl){
	//if (vturl == '') return false;
	var tiviVideothek = window.open(vturl, "tiviVideothek", "width=1014,height=698,left=100,top=200,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
  tiviVideothek.focus();
  //return false;
}

function tiviVT_open(vturl){
	openTiviVideothek(vturl);
}
