// Stylesheet-Weiche
   if  (( navigator.userAgent.indexOf("Mac") != -1 ) & ( navigator.appName.indexOf("Explorer") != -1 ))
	   // nur Mac und IE
   {document.write('<link rel="Stylesheet" media="all" type="text/css" href="/css/popup_mac.css" />');}
   else
	   // alle Systeme ausser Mac-IE
   {document.write('<link rel="Stylesheet" media="all" type="text/css" href="/css/popup_neu.css" />');}
		
var headerHeight = 114;  	// Hoehe des Headers
var footerHeight = 24;		// Hoehe des Footer

// Misst die Fenstergroeße und gibt Platz fuer Content zurueck
function measure()
{
	var Size = new Object();
	var x, y;
   
         //Gruesse des viewport
         if (self.innerHeight) // alle Browser ausser Explorer
         {
		 x = self.innerWidth;
		 y = self.innerHeight;
         }
         else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict
         {
		 x = document.documentElement.clientWidth;
		 y = document.documentElement.clientHeight;
         }
         else if (document.body) // andere Explorer
         {
		 x = document.body.clientWidth;
		 y = document.body.clientHeight;
         }
	 Size.x = x;
	 Size.y = y - headerHeight - footerHeight;
	 return Size;
}

// EventListener hinzufuegen
function Listen(elem, event, func)
{
	if (elem.addEventListener)
		elem.addEventListener(event,func,false);
	else
		elem.attachEvent('on'+event,func);
}

// Aendert Groesse eines Obejcts
function resizeObject() {
	var newX = measure('window').x;
	var newY = measure('window').y;
	
	// aendert die Hoehe (id="resizeHeight")
	if (document.getElementById('resizeHeight'))
		document.getElementById('resizeHeight').height = newY;
	
	// aendert die Hoehe und Weite (id="resizeHeightWidth")
	if (document.getElementById('resizeHeightWidth')) {
		document.getElementById('resizeHeightWidth').height = newY;
		document.getElementById('resizeHeightWidth').width = newX;
	}

	// aendert die Weite (id="resizeWidth")
	if (document.getElementById('resizeWidth'))
		document.getElementById('resizeWidth').width = newY;
	
}

// Event-Listener
Listen(window,'load',resizeObject);
Listen(window,'resize',resizeObject);

// Hilfesound
function PlaySound()
{
    if (document.all){
        document.all.play.src = "/mp3/beepbeep.mp3";
    }
}
// Hilfeflash ruft Funktion auf
function openWindow(pfad,fenstername,groesse)
	{
	var newfenster = window.open(pfad, fenstername, groesse);
	newfenster.focus();
	newfenster = window.open(pfad, fenstername);
	newfenster.focus();
	}

// Druckt den Inhalt des Popups
function PrintContent() {
	if (parent.frames['contentIframe']) {
		// Druckt den iframe falls vorhanden
		parent.frames['contentIframe'].focus(); 
		parent.frames['contentIframe'].print();
	
	}
	else
		// Druckt die komplette Seite
	  	window.print();
  }
  
// oeffent Tell_a_friend-Popup
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);
  }

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ab hier alte Funktionen:
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function previewPopup(swf,width,height){
	var options = "scrollbars=no,menubar=no,toolbar=no,location=no,status=no,resizable=yes";
	var name 		= "preview";
	var surl		=" /php/popuppreview/preview.php?film="+swf;
	var tiviPopWin = null;
	tiviPopWin = window.open( surl, name, "width=" + width + ",height=" + height + "," + options );
	tiviPopWin.focus();
	}
	
function insertValue(vHeight,vWidth){
	window.opener.document.getElementById("dheight").value = vHeight;
	window.opener.document.getElementById("dwidth").value = vWidth;
	}

function alertSize() {
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement &&
	      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }
	var msg = 'Folgende Werte werden in das Imperia Template übernommen \nHöhe   = ' + myHeight + ' \nBreite  = ' + myWidth;
	var Check = confirm(msg);
	if(Check == true) insertValue(myHeight,myWidth);
	}	

