// JavaScript Document

var browser_name = navigator.appName;
var browser_version = parseFloat(navigator.appVersion);
var folgeID = 0;
var folgeName = "";
var rubrikID = 0;
var abstFrage = "";
var abstAntwort1 = "";
var abstAntwort2 = "";
var abgestimmtFuer = 0;
var archivContent = 0; 
var userUploadTitel = "";
var uploading = false;
var addScale = 0;
var videoTeaserExists = false;
var adContentHtml = "";
if (typeof ads_gettag=="function") adContentHtml = ads_gettag("Contentad",300,250,100); 
var contentBox = true;
var kommentarBox = true;
var userID;
var firstStart = true;

var redaktionsTeaserIsSet = false;
var videoTeaserIsSet = false;

var rollover = true;

var bewertung = 0;

// BrowserÃ¼berprÃ¼fung
if (browser_name == "Netscape" && browser_version >= 3.0)
{
	rollover = 'true';
}
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 4.0)
{
	rollover = 'true';
}
else {
	rollover = 'false';
}

if (rollover == 'true')
{
	imgEmpfehlen     = new Image(); imgEmpfehlen.src     = "img/empfehlen_bt.gif";
	imgEmpfehlenOver = new Image(); imgEmpfehlenOver.src = "img/empfehlen_bt_over.gif";
	imgAbbrechen     = new Image(); imgAbbrechen.src     = "img/abbrechen_bt.gif";
	imgAbbrechenOver = new Image(); imgAbbrechenOver.src = "img/abbrechen_bt_over.gif";
	imgKommentar     = new Image(); imgKommentar.src     = "img/kommentar_bt.gif";
	imgKommentarOver = new Image(); imgKommentarOver.src = "img/kommentar_bt_over.gif";
}

function getAttribute (name){
if (this.attributes[name] != undefined){
return this.attributes[name];
}else{
return '';
}
}
// Rollover
function over (img, ref)
{
	if (rollover == 'true')
	{
		document.images[img].src = ref;
	}
}

// Rollout
function out (img, ref)
{
	if (rollover == 'true')
	{
		document.images[img].src = ref;
	}
}

function addslashes (str)
{
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}
function stripslashes (str)
{
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

function setAddScale ()
{
	addScale = 25;
	scaleFlashHeight(487);
}

// Flash-Skalierung
function scaleFlashHeight (height)
{
	document.getElementById("maedchen").height = height + addScale;
}

String.prototype.trim = function() {

 // skip leading and trailing whitespace
 // and return everything in between
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}

// Content (Video/Playlist)
function setContent (name, beschreibung, hasSponsor, sponsorName, sponsorText, sponsorBild, sponsorLinkUrl, sponsorLinkText, sponsorTrackingpixel)
{
	redaktionsTeaserIsSet = false;
	videoTeaserIsSet = false;
	if (!contentBox) setContentBox ();
	$("#content_name").html(stripslashes(name));
	$("#content_beschreibung").html(stripslashes(beschreibung));
	
	if (hasSponsor == 'true') 
	{		
		sponsorHTML = '\n';
		sponsorHTML += '			            <table width="100%" cellpadding="0" cellspacing="0" border="0">\n';
		sponsorHTML += '                        <tr>\n';
		sponsorHTML += '                          <td width="10" height="16" class="sponsorBoxLinksOben"><img src="img/pix.gif" width="10" height="16" border="0"></td>\n';
		sponsorHTML += '                          <td width="10" bgcolor="#ffffff"><img src="img/pix.gif" border="0"></td>\n';
		sponsorHTML += '                          <td width="10" height="16" class="sponsorBoxRechtsOben"><img src="img/pix.gif" width="10" height="16" border="0"></td>\n';
		sponsorHTML += '                        </tr>\n';
		sponsorHTML += '                        <tr>\n';
		sponsorHTML += '                          <td width="10" bgcolor="#ffffff"><img src="img/pix.gif" border="0"><img name="trackingpixel" src="img/pix.gif" width="1" height="1"></td>\n';
		sponsorHTML += '                          <td width="100%" align="left" valign="middle" bgcolor="#ffffff">\n';
		sponsorHTML += '                            <table cellpadding="0" cellspacing="0">\n';
		sponsorHTML += '                            <tr>\n';
		if (sponsorBild.length > 0)
		{
			sponsorHTML += '                              <td valign="middle">\n';
			if (sponsorLinkUrl.length > 0) sponsorHTML += '                              <a href="javascript:trackUserClick(\''+sponsorTrackingpixel+'\', \''+sponsorLinkUrl+'\' )">\n';
            sponsorHTML += '                                <img id="sponsor_bild" src="'+stripslashes(sponsorBild)+'?'+String(Math.round(Math.random()*9999999))+'">\n';
			if (sponsorLinkUrl.length > 0) sponsorHTML += '                              </a>\n';
			sponsorHTML += '                              </td>\n';
		}
		else sponsorHTML += '                              <td valign="middle"><img id="sponsor_bild" src="img/pix.gif"></td>\n';
		sponsorHTML += '                              <td width="16"><img src="img/pix.gif" width="20" border="0"></td>\n';
		sponsorHTML += '                              <td id="sponsor_infos" align="left" valign="middle" class="sponsorBox">\n';
		if (sponsorName.length > 0)
			sponsorHTML += '                                <span class="sponsorTitel">'+stripslashes(sponsorName)+'</span><br>\n';
		if (sponsorText.length > 0)
			sponsorHTML += '                                '+stripslashes(sponsorText)+'<br>\n';
		if (sponsorLinkUrl.length > 0 && sponsorLinkText.length > 0)
			sponsorHTML += '                                <a href="javascript:trackUserClick(\''+sponsorTrackingpixel+'\', \''+sponsorLinkUrl+'\' )" class="sponsorLink">'+stripslashes(sponsorLinkText)+'</a>\n';
		if (sponsorName.length == 0 && sponsorText.length == 0 && sponsorLinkUrl.length == 0 && sponsorLinkText.length == 0)
			sponsorHTML += '                                <img src="img/pix.gif" border="0">';
		sponsorHTML += '                              </td>\n';
		sponsorHTML += '                            </tr>\n';
		sponsorHTML += '                            </table>\n';									
		sponsorHTML += '                          </td>\n';
		sponsorHTML += '                          <td width="10" bgcolor="#ffffff"><img src="img/pix.gif" height="100%" border="0"></td>\n';
		sponsorHTML += '                        </tr>\n';
		sponsorHTML += '                        <tr\n>';
		sponsorHTML += '                          <td width="10" height="16" class="sponsorBoxLinksUnten"><img src="img/pix.gif" width="10" height="16" border="0"></td>\n';
		sponsorHTML += '                          <td width="10" bgcolor="#ffffff"><img src="img/pix.gif" border="0"></td>\n';
		sponsorHTML += '                          <td width="10" height="16" class="sponsorBoxRechtsUnten"><img src="img/pix.gif" width="10" height="16" border="0"></td>\n';
		sponsorHTML += '                        </tr>\n';
		sponsorHTML += '                        </table>\n';
		sponsorHTML += '\n'; 

		document.getElementById("content_sponsor").innerHTML = sponsorHTML;		
	}
	else
	{
		document.getElementById("content_sponsor").innerHTML = "";		
	}
}

function setContentBox ()
{
	contentBox = true;
	
	var contentBoxHTML = '	            <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">\n';
	contentBoxHTML += '	                <tr>\n<td width="100%" height="9" align="left"><table cellpadding="0" cellspacing="0" border="0"><tr><td width="9" height="9" class="contentBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td><td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td><td width="9" height="9" class="contentBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td></tr></table></td>\n';
	contentBoxHTML += '                </tr>\n';
	contentBoxHTML += '                <tr>\n';
	contentBoxHTML += '\n';               
	contentBoxHTML += '                  <!-- Titel, Beschreibung, evtl. Sponsor -->\n';
	contentBoxHTML += '                  <td width="100%" class="contentBox" align="left">\n';
	contentBoxHTML += '                    <table cellpadding="0" cellspacing="0" border="0">\n';
	contentBoxHTML += '                    <tr>\n';
	contentBoxHTML += '                      <td rowspan="3" width="25" class="contentBox"><img src="img/pix.gif" width="25" border="0"></td>\n';
	contentBoxHTML += '\n';                    
	contentBoxHTML += '                      <!-- Titel -->\n';
	contentBoxHTML += '                      <td height="30" valign="middle" id="content_name" class="titel">Video-Informationen werden geladen ...</td>\n';
	contentBoxHTML += '                      <!-- Ende Titel -->\n';
	contentBoxHTML += '\n';                      
	contentBoxHTML += '                      <td rowspan="3" width="25" class="contentBox"><img src="img/pix.gif" width="10" border="0"></td>\n';
	contentBoxHTML += '                    </tr>\n';
	contentBoxHTML += '                    <tr>\n';
	contentBoxHTML += '\n';
	contentBoxHTML += '					  <!-- Sponsor -->\n';
	contentBoxHTML += '                      <td id="content_sponsor" class="contentBox">&nbsp;</td>\n';
	contentBoxHTML += '                      <!-- Ende Sponsor -->\n';
	contentBoxHTML += '\n';                   
	contentBoxHTML += '                    </tr>\n';
	contentBoxHTML += '                    <tr>\n';
	contentBoxHTML += '\n';                    
	contentBoxHTML += '                      <!-- Beschreibung -->\n';
	contentBoxHTML += '                      <td height="100%" valign="middle" class="contentBox">\n';
	contentBoxHTML += '                        <br><p id="content_beschreibung">&nbsp;</p>\n';
	contentBoxHTML += '                      </td>\n';
	contentBoxHTML += '                      <!-- Ende Beschreibung -->\n';
	contentBoxHTML += '\n';                      
	contentBoxHTML += '                    </tr>\n';
	contentBoxHTML += '                    </table>\n';
	contentBoxHTML += '                  </td>\n';
	contentBoxHTML += '                  <!-- Ende Titel, Beschreibung, evtl. Sponsor -->\n';
	contentBoxHTML += '\n';				
	contentBoxHTML += '                </tr>\n';

	contentBoxHTML += '		            <tr>';
	contentBoxHTML += '	            	<td id="embeddedCodeContainer" align="center" class="bewertungBox">';		
	contentBoxHTML += '					</td>';
	contentBoxHTML += '				</tr>';
	contentBoxHTML += '				<tr>';
	contentBoxHTML += '				  <!-- Umfrage -->';
	contentBoxHTML += '                  <td id="abstimmung" width="100%" height="0" valign="middle" class="bewertungBox">';
	contentBoxHTML += '                    <center><span class="abstimmung"></span></center>                  ';
	contentBoxHTML += '                  </td>';
	contentBoxHTML += '				</tr>';

	contentBoxHTML += '                <tr>\n';
	contentBoxHTML += '\n';                
	contentBoxHTML += '                  <!-- Bewertung -->\n';
	contentBoxHTML += '                  <td id="bewertung" width="100%" height="40" valign="middle" class="bewertungBox">\n';
	contentBoxHTML += '                    <center><span class="bewertung">Bewertung wird geladen...</span></center> \n';                 
	contentBoxHTML += '                  </td>\n';
	contentBoxHTML += '                  <!-- Ende Bewertung -->\n';
	contentBoxHTML += '\n';                  
	contentBoxHTML += '                </tr>\n';
	contentBoxHTML += '				   <tr>\n';
	contentBoxHTML += '				   <!-- Weiterempfehlung -->\n';
	contentBoxHTML += '                  <td id="weiterempfehlung" height="1" class="empfehlenBox"><img src="img/pix.gif" height="1" border="0"></td>\n';
	contentBoxHTML += '                </tr>\n';
	contentBoxHTML += '				   <tr>\n';	
	contentBoxHTML += '                  <td height="30">\n';
	contentBoxHTML += '                  	<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>\n';
	contentBoxHTML += '                    <td width="9" height="30" class="empfehlenBoxLinks"><img src="img/pix.gif" width="9" height="30" border="0"></td>\n';
	contentBoxHTML += '				  	<td width="30" height="30" align="left" valign="middle" class="empfehlenBox" id="abbrechenBild"><img src="img/pix.gif" width="30" height="30" border="0"></td>\n';
	contentBoxHTML += '				  	<td width="50%" height="30" align="left" valign="middle" class="empfehlenBox" id="abbrechenText"><img src="img/pix.gif" height="30" border="0"></td>\n';
	contentBoxHTML += '                  	<td width="50%" height="30" align="right" valign="middle" class="empfehlenBox"><a id="weiterempfehlenLinkText" href="javascript:setWeiterempfehlenForm ()" class="whiteLink">Weiterempfehlen</a>&nbsp;</td>\n';
	contentBoxHTML += '                  	<td height="30" align="left" valign="middle" class="empfehlenBox">\n';
   	contentBoxHTML += '<a id="weiterempfehlenLinkBild" href="javascript:setWeiterempfehlenForm ()" onMouseOver="over(\'weiterempfehlen\', imgEmpfehlenOver.src);"\n';
	contentBoxHTML += '                      		onMouseOut="out(\'weiterempfehlen\', imgEmpfehlen.src);"><img src="img/empfehlen_bt.gif" width="28" height="28" border="0" name="weiterempfehlen"></a>\n';
	contentBoxHTML += '                  	</td>\n';
	contentBoxHTML += '               	   <td width="9" height="30" class="empfehlenBoxRechts"><img src="img/pix.gif" width="9" height="30" border="0"></td>\n';
	contentBoxHTML += '               	   </tr></table>\n';                 
	contentBoxHTML += '                  <!-- Ende Weiterempfehlung -->\n';
	contentBoxHTML += '\n';                  
	contentBoxHTML += '                </tr>\n';
	contentBoxHTML += '                <tr>\n';
	contentBoxHTML += '                  <td height="10"><img src="img/pix.gif" height="10" border="0"></td>\n';
	contentBoxHTML += '                </tr>\n';
	contentBoxHTML += '                </table>\n';
	
	$("#player_content").html(contentBoxHTML);
}

function removeContentBox ()
{
	contentBox = false;	
	$("#player_content").html('<img src="img/pix.gif" border="0">');
}

function trackUserClick(trackingPixel, url) {
	document.getElementById("trackingpixelMTV").setAttribute("src", randomVariable (trackingPixel));
	if (url.length > 0) window.open(url);	
	xajax_getVerpixelung("sponsorbeitrag");
}

function trackingClick(trackingPixel, url) {
	if (trackingPixel.length > 0) document.getElementById("trackingpixelMTV").setAttribute("src", randomVariable (trackingPixel));
	if (url.length > 0) window.open (url);
}
	
function verpixelung (url)
{
	document.getElementById("verpixelungMTV").setAttribute("src", randomVariable (url));
}

function trackingpixel (url)
{
	document.getElementById("trackingpixelMTV").setAttribute("src", randomVariable (url));
}

function randomVariable (url)
{
	var strUrl;
	var rand = Math.round (Math.random () * 999999999);
	if (url.indexOf ("?") == -1)
	{
		strUrl = url + "?" + String (rand);
	}
	else
	{
		strUrl = url + "&" + String (rand);
	}
	return strUrl;
}

function setWeiterempfehlenForm ()
{
	//alert ("Rubrik-ID: "+rubrikID+"\nFolge-ID: "+folgeID+"\nFolge-Name: "+folgeName);
	
	var dif = 0;
	if (browser_name == "Microsoft Internet Explorer") dif = 10;
	
	empfehlenFormHTML = '<div id="empfehlenFormular">\n';
	empfehlenFormHTML += '			              <form name="weiterempfehlung">\n';
	empfehlenFormHTML += '			              <table width="100%" cellpadding="2" cellspacing="2" border="0">\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">&nbsp;Dein Name:&nbsp;<input type="text" name="absender_name"></td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">&nbsp;Dein E-Mail:&nbsp;<input type="text" name="absender_email" size="'+String(40-dif)+'"></td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">&nbsp;Deine Nachricht:<br>&nbsp;<textarea id="weiterempfehlungsnachricht" name="nachricht" cols="'+String(66-dif)+'" rows="4"></textarea></td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td height="10"><img src="img/pix.gif" height="10" border="0"></td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">\n';
	empfehlenFormHTML += '                            &nbsp;Name:&nbsp;<input type="name" name="name1" size="12">\n';
	empfehlenFormHTML += '                            &nbsp;E-Mail:&nbsp;<input type="name" name="email1" size="'+String(36-dif)+'">\n';
	empfehlenFormHTML += '                          </td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">\n';
	empfehlenFormHTML += '                            &nbsp;Name:&nbsp;<input type="name" name="name2" size="12">\n';
	empfehlenFormHTML += '                            &nbsp;E-Mail:&nbsp;<input type="name" name="email2" size="'+String(36-dif)+'">\n';
	empfehlenFormHTML += '                          </td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">\n';
	empfehlenFormHTML += '                            &nbsp;Name:&nbsp;<input type="name" name="name3" size="12">\n';
	empfehlenFormHTML += '                            &nbsp;E-Mail:&nbsp;<input type="name" name="email3" size="'+String(36-dif)+'">\n';
	empfehlenFormHTML += '                          </td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">\n';
	empfehlenFormHTML += '                            &nbsp;Name:&nbsp;<input type="name" name="name4" size="12">\n';
	empfehlenFormHTML += '                            &nbsp;E-Mail:&nbsp;<input type="name" name="email4" size="'+String(36-dif)+'">\n';
	empfehlenFormHTML += '                          </td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td class="empfehlenFormBox" align="left">\n';
	empfehlenFormHTML += '                            &nbsp;Name:&nbsp;<input type="name" name="name5" size="12">\n';
	empfehlenFormHTML += '                            &nbsp;E-Mail:&nbsp;<input type="name" name="email5" size="'+String(36-dif)+'">\n';
	empfehlenFormHTML += '                          </td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        <tr>\n';
	empfehlenFormHTML += '                          <td id="weiterempfehlung_error" height="1" class="empfehlenFormBox"><img src="img/pix.gif" height="1" border="0"></td>\n';
	empfehlenFormHTML += '                        </tr>\n';
	empfehlenFormHTML += '                        </table>\n';
	empfehlenFormHTML += '                        </form>\n';
	empfehlenFormHTML += '</div>\n';
	
	
	$("#abbrechenBild").html('<a href="javascript:cancelWeiterempfehlenForm ()" onMouseOver="over(\'abbrechen\', imgAbbrechenOver.src);" onMouseOut="out(\'abbrechen\', imgAbbrechen.src);"><img src="img/abbrechen_bt.gif" width="28" height="28" border="0" name="abbrechen"></a>');
	$("#abbrechenText").html('&nbsp;<a href="javascript:cancelWeiterempfehlenForm ()" class="whiteLink">abbrechen</a>');
	
	$('#weiterempfehlung').html(empfehlenFormHTML);
	$('#empfehlenFormular').slideDown();
	/*
	 * Bei Klick auf den Weiterempfehlen bzw. das icon wird das Formular weiterempfehlung mittels der Funktion
	 * submitWeiterempfehlenForm auf geprüft und dann verschickt. 
	 */
	$('#weiterempfehlenLinkText').attr("href", "javascript:submitWeiterempfehlenForm ()");
	$('#weiterempfehlenLinkBild').attr("href", "javascript:submitWeiterempfehlenForm ()");
}

function cancelWeiterempfehlenForm ()
{
	$('#empfehlenFormular').slideUp();
	
	$("#abbrechenBild").html('<img src="img/pix.gif" width="30" height="30" border="0">');
	$("#abbrechenText").html('<img src="img/pix.gif" height="30" border="0">');
	
	$("#weiterempfehlenLinkText").attr("href", "javascript:setWeiterempfehlenForm ()");
	$("#weiterempfehlenLinkText").attr("onClick", "xajax_getVerpixelung(\'weiterempfehlen\')");
	$("#weiterempfehlenLinkBild").attr("href", "javascript:setWeiterempfehlenForm ()");
	$("#weiterempfehlenLinkBild").attr("onClick", "xajax_getVerpixelung(\'weiterempfehlen\')");
	xajax_getVerpixelung("weiterempfehlenabbrechen");	
	
}

function emailPruefen(email) {
	// Gibt true zurueck wenn E-Mail OK ist
	if (email.length > 0)
	{
		var split = email.split("@");
		if (split.length > 1)
		{
			if (split[1].length > 0)
			{
				var split2 = split[1].split(".");
				if (split2.length > 1)
				{
					var lastStr = split2[split2.length-1];
					return !(email.indexOf ("@") == -1 || split.length != 2 || split[1].indexOf (".") == -1 || lastStr.length == 0);
				}
				else return false;
			}
			else return false;
		}
		else return false;
	}
	else return false;
}

function submitWeiterempfehlenForm ()
{	
	var absender_name = document.weiterempfehlung.absender_name.value;
	var absender_email = document.weiterempfehlung.absender_email.value;
	
	var name1 = document.weiterempfehlung.name1.value;
	var email1 = document.weiterempfehlung.email1.value;
	var name2 = document.weiterempfehlung.name2.value;
	var email2 = document.weiterempfehlung.email2.value;
	var name3 = document.weiterempfehlung.name3.value;
	var email3 = document.weiterempfehlung.email3.value;
	var name4 = document.weiterempfehlung.name4.value;
	var email4 = document.weiterempfehlung.email4.value;
	var name5 = document.weiterempfehlung.name5.value;
	var email5 = document.weiterempfehlung.email5.value;
	
	var error = "";
	var nachricht = $("#weiterempfehlungsnachricht").val();
	var anzahlEmpfaenger = 0;
	
	if (!emailPruefen(absender_email))
	{
		error += "Die Absender-E-Mail ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	
	if (absender_name.length == 0)
	{
		error += "Der Absender-Name ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	
	if (name1.length > 0 && !emailPruefen(email1))
	{
		error += "Die E-Mail von Empf&auml;nger 1 ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name1.length == 0 && emailPruefen(email1))
	{
		error += "Der Name von Empf&auml;nger 1 ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name1.length > 0 && emailPruefen(email1)) anzahlEmpfaenger ++;
	
	if (name2.length > 0 && !emailPruefen(email2))
	{
		error += "Die E-Mail von Empf&auml;nger 2 ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name2.length == 0 && emailPruefen(email2))
	{
		error += "Der Name von Empf&auml;nger 2 ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name2.length > 0 && emailPruefen(email2)) anzahlEmpfaenger ++;
	
	if (name3.length > 0 && !emailPruefen(email3))
	{
		error += "Die E-Mail von Empf&auml;nger 2 ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name3.length == 0 && emailPruefen(email3))
	{
		error += "Der Name von Empf&auml;nger 3 ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name3.length > 0 && emailPruefen(email3)) anzahlEmpfaenger ++;
	
	if (name4.length > 0 && !emailPruefen(email4))
	{
		error += "Die E-Mail von Empf&auml;nger 4 ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name4.length == 0 && emailPruefen(email4))
	{
		error += "Der Name von Empf&auml;nger 4 ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name4.length > 0 && emailPruefen(email4)) anzahlEmpfaenger ++;
	
	if (name5.length > 0 && !emailPruefen(email5))
	{
		error += "Die E-Mail von Empf&auml;nger 5 ist ung&uuml;ltig!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name5.length == 0 && emailPruefen(email5))
	{
		error += "Der Name von Empf&auml;nger 5 ist nicht ausgef&uuml;llt!<br>";
		anzahlEmpfaenger ++;
	}
	else if (name5.length > 0 && emailPruefen(email5)) anzahlEmpfaenger ++;
	
	if (anzahlEmpfaenger == 0) error += "Es sind keine Empf&auml;nger angegeben!<br>";
	
	if (error.length == 0)
	{
		xajax_empfehlen (absender_name, absender_email, name1, email1, name2, email2, name3, email3, name4, email4, name5, email5, nachricht, rubrikID, folgeID, folgeName, parseInt(archivContent));
		
		cancelWeiterempfehlenForm ();
		$("#weiterempfehlung").html('&nbsp;&nbsp;<span class="empfehlenFormBox">Die Weiterempfehlung wurde verschickt!</span>');
	}
	else
	{
		document.getElementById("weiterempfehlung_error").innerHTML = error;
	}
	
	xajax_getVerpixelung("weiterempfehlenabschicken");
}


// alle Teaser entfernen
function removeAllTeaser ()
{
	node = document.getElementById("space_teaser_redaktion");
	if (node != null)
	{
		document.getElementById("space_teaser_redaktion").parentNode.removeChild(node);
	}
	
	node = document.getElementById("teaser_redaktion");
	if (node != null)
	{
		document.getElementById("teaser_redaktion").parentNode.removeChild(node);
	}
	
	node = document.getElementById("contentad");
	if (node != null)
	{
		document.getElementById("videoteaser_adcontent").removeChild(node)
	}
	
	node = document.getElementById("space_videoteaser_adcontent");
	if (node != null)
	{
		document.getElementById("videoteaser_adcontent").removeChild(node)
	}
	
	document.getElementById("teaser_video").innerHTML = '<img src="img/pix.gif" width="1" height="1" border="0">';
	document.getElementById("teaser_video").setAttribute("width", "1");
	document.getElementById("teaser_video").setAttribute("height", "1");
	document.getElementById("space_oben").setAttribute("height", "5");
	document.getElementById("space_unten").setAttribute("height", "5");
}

// redaktioneller Teaser
function setRedaktionTeaser (teaserName, beschreibung, bild, url, pixel)
{
	
	if (document.getElementById("teaser_redaktion") == null)
	{
		spaceTD = document.createElement("td");
		spaceTD.setAttribute("id", "space_teaser_redaktion");
		spaceTD.innerHTML = '<img src="img/pix.gif" width="26" border="0">';
		document.getElementById("player_content").parentNode.appendChild(spaceTD);
		
		teaserHTML  = '                <table id="teaserContentTable" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">\n';
		teaserHTML += '                <tr>\n';
		teaserHTML += '                  <td width="239" height="12" class="teaserBoxOben"><img src="img/pix.gif" width="239" height="12" border="0"></td>\n';
		teaserHTML += '                </tr>\n';
		teaserHTML += '                <tr>\n';
		teaserHTML += '                  <td align="center" valign="middle" class="teaserBox" style="padding-right: 10px;">\n';
		teaserHTML += '                    <table width="190" cellpadding="0" cellspacing="0" border="0">\n';
		teaserHTML += '                    <tr>';
		teaserHTML += '\n';  
		teaserHTML += '                      <!-- Teaser-Titel -->\n';
		teaserHTML += '                      <td align="left"><span id="teaser_name" class="titel">'+stripslashes(teaserName)+'</span></td>\n';
		teaserHTML += '                      <!-- Ende Teaser-Titel -->\n';
		teaserHTML += '\n';
		teaserHTML += '                    </tr>';
		teaserHTML += '                    <tr>';
		teaserHTML += '\n';  
		teaserHTML += '                      <!-- Teaser-Bild -->\n';
		teaserHTML += '                      <td align="center"><br><img src="'+bild+'" border="0" width="190"><br>&nbsp;</td>\n';
		teaserHTML += '                      <!-- Ende Teaser-Bild -->\n';
		teaserHTML += '\n'; 
		teaserHTML += '                    </tr>';
		teaserHTML += '                    <tr>';
		teaserHTML += '\n';  
		teaserHTML += '                      <!-- Teaser-Beschreibung -->\n';
		teaserHTML += '                      <td align="left"><font id="teaser_beschreibung" class="teaserBoxText">'+stripslashes(beschreibung)+'</font></td>\n';
		teaserHTML += '                      <!-- Ende Teaser-Beschreibung -->\n';
		teaserHTML += '\n'; 
		teaserHTML += '                    </tr>';
		
		if (url.length > 0 && url != 'null')
		{
			teaserHTML += '                    <tr>';
			teaserHTML += '\n';  
			teaserHTML += '                      <!-- Teaser-Link -->\n';
			teaserHTML += '                      <td align="right"><a href="javascript:trackingClick(\''+pixel+'\',\''+url+'\')" class="pinkLink" onClick="xajax_getVerpixelung(\'redaktionteaserlink\')">mehr...</a></td>\n';
			teaserHTML += '                      <!-- Ende Teaser-Link -->\n';
			teaserHTML += '\n';
			teaserHTML += '                    </tr>';
		}
		
		teaserHTML += '                    </table>';
		teaserHTML += '                  </td>\n';
		teaserHTML += '                </tr>\n';
		teaserHTML += '                <tr>\n';
		teaserHTML += '                  <td width="239" height="20" class="teaserBoxUnten"><img src="img/pix.gif" width="239" height="20" border="0"></td>\n';
		teaserHTML += '                </tr>\n';
		teaserHTML += '                </table>\n';
		
		teaserTD = document.createElement("td");
		teaserTD.setAttribute("id", "teaser_redaktion");
		teaserTD.setAttribute("align", "center");
		teaserTD.setAttribute("width", "239");
		teaserTD.setAttribute("height", "100%");
		teaserTD.innerHTML = teaserHTML;
	
		document.getElementById("player_content").parentNode.appendChild(teaserTD);
		document.getElementById("player_content").setAttribute("height", document.getElementById("player_content").getAttribute("height"));
		document.getElementById("scale_td").setAttribute("width", "100%");
	}
}

// Video-Teaser
function setVideoTeaser (name, beschreibung, flv, url, pixel)
{
    teaserHTML  = '     <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">\n';
	teaserHTML += '	    <tr>\n<td width="100%" height="9" align="left">\n<table cellpadding="0" cellspacing="0" border="0">\n<tr>\n';
	teaserHTML += '	      <td width="9" height="9" class="contentBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
	teaserHTML += '	      <td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
	teaserHTML += '	      <td width="9" height="9" class="contentBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n</tr>\n</table>\n</td>\n';                 
	teaserHTML += '	    </tr>\n';
	teaserHTML += '	    <tr>\n';
	
	if (adContentHtml.length > 0)
	{	
		teaserHTML += '	      <td colspan="3" id="videoteaser" align="center" valign="middle" class="contentBox"></td>\n';	
	}
	else
	{
		teaserHTML += '	      <td colspan="3" align="center" valign="middle" class="contentBox">\n';
		teaserHTML += '         <table cellspacing="0" cellpadding="0" border="0">\n';
		teaserHTML += '         <tr>\n';
		teaserHTML += '	          <td id="videoteaser" align="center" valign="middle" class="contentBox"></td>\n';
		teaserHTML += '	          <td width="26" class="contentBox"><img src="img/pix.gif" width="26" border="0"></td>\n';
		teaserHTML += '           <td class="contentBox" align="center" valign="middle">\n';
		teaserHTML += '             <table width="284" cellspacing="0" cellpadding="0" border="0">\n';
		teaserHTML += '             <tr>\n';
		teaserHTML += '               <td align="left" valign="middle" class="contentBox">\n';
		teaserHTML += '                 <span class="teaserBoxTitel">'+stripslashes(name)+' - </span>'+stripslashes(beschreibung)+'<br><br>\n';
		teaserHTML += '               </td>\n';
		teaserHTML += '             </tr>\n';
		
		if (url.length > 0 && url != 'null')
		{
			teaserHTML += '              <tr>\n';
			teaserHTML += '               <td height="20" align="left" valign="bottom" class="contentBox">\n';
			teaserHTML += '                 <a href="javascript:trackingClick(\''+pixel+'\', \''+url+'\')" class="pinkLink" onClick="xajax_getVerpixelung(\'videoteaserlink\')">mehr...</a>\n';
			teaserHTML += '               </td>\n';
			teaserHTML += '             </tr>\n';
		}
		
		teaserHTML += '             </table>\n';
		teaserHTML += '           </td>\n';
		teaserHTML += '         </tr>\n';
		teaserHTML += '         </table>\n';
		teaserHTML += '       </td>\n';
	}
	
	teaserHTML += '	    </tr>\n';
	
	if (adContentHtml.length > 0)
	{	
		teaserHTML += '     <tr>\n';
		teaserHTML += '      <td colspan="3" class="contentBox" align="center">\n';
		teaserHTML += '        <p><table width="284" cellspacing="0" cellpadding="0" border="0">\n';
		teaserHTML += '        <tr>\n';
		teaserHTML += '          <td align="left" valign="middle" class="contentBox">\n';
		teaserHTML += '            <span class="teaserBoxTitel">'+stripslashes(name)+' - </span>'+stripslashes(beschreibung)+'\n';
		teaserHTML += '          </td>\n';
		teaserHTML += '        </tr>\n';
		teaserHTML += '         <tr>\n';
		teaserHTML += '          <td height="20" align="right" valign="bottom" class="contentBox">\n';
		teaserHTML += '            <a href="'+url+'" class="pinkLink" target="_blank" onClick="xajax_getVerpixelung(\'videoteaserlink\')">mehr...</a>\n';
		teaserHTML += '          </td>\n';
		teaserHTML += '        </tr>\n';
		teaserHTML += '        </table></p>\n';
		teaserHTML += '      </td>\n';
		teaserHTML += '     </tr>\n';
	}
	
	
	teaserHTML += '	    <tr>\n<td width="100%" height="9" align="left">\n<table cellpadding="0" cellspacing="0" border="0">\n<tr>\n';
	teaserHTML += '	      <td width="9" height="9" class="contentBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
	teaserHTML += '	      <td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
	teaserHTML += '	      <td width="9" height="9" class="contentBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n</tr>\n</table>\n</td>\n';                 
	teaserHTML += '	    </tr>\n';
	teaserHTML += '	    </table>\n';
	
	document.getElementById("teaser_video").innerHTML = teaserHTML;
	document.getElementById("teaser_video").setAttribute("width", "100%");
	
	document.getElementById("space_unten").setAttribute("height", "10");
	document.getElementById("space_unten").innerHTML = '<img src="img/pix.gif" height="10" border="0">';
	
	var so2 = new SWFObject("swf/teaser_player_v00_01.swf", "teaser", "282" , "252", "8", "#FFFFFF", "HIGH", "", "upgrade_flash.html");
	so2.addParam("classid", "teaser");
    so2.addParam("name", "teaser");
	so2.addVariable("flv", flv) ;
	so2.useExpressInstall('swfobject/expressinstall.swf');
	so2.write("videoteaser");
}

function setKommentarBox ()
{
	
	kommentarBox = true;
		
	var kommentarBoxHTML = '		    <form name="kommentierenForm">\n';
	kommentarBoxHTML += '            <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">\n';
	kommentarBoxHTML += '            <tr>\n';
	kommentarBoxHTML += '              <td width="9" height="9" class="contentBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
	kommentarBoxHTML += '              <td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
	kommentarBoxHTML += '              <td width="9" height="9" class="contentBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td> \n';                 
	kommentarBoxHTML += '            </tr>\n';
	kommentarBoxHTML += '            <tr>\n';
	kommentarBoxHTML += '            	<td width="9" class="contentBox"><img src="img/pix.gif" width="9" border="0"></td>\n';
	kommentarBoxHTML += '              		<td class="contentBox" align="center">\n';
	kommentarBoxHTML += '                		<table width="96%" cellpadding="0" cellspacing="0" border="0">\n';
	kommentarBoxHTML += '                			<tr>\n';
	kommentarBoxHTML += '                  				<td height="30" valign="top"><font class="titel">Kommentare</font></td>\n';
	kommentarBoxHTML += '                			</tr>\n';
	kommentarBoxHTML += '                			<tr>\n';
	kommentarBoxHTML += '                  				<td id="kommentare" valign="top"><font class="kommentarTitel">... werden geladen!</font></td>\n';
	kommentarBoxHTML += '                			</tr>\n';
	kommentarBoxHTML += '                			<tr>\n';
	kommentarBoxHTML += '                  				<td height="10"><img src="img/pix.gif" height="10" border="0"></td>\n';
	kommentarBoxHTML += '                			</tr>\n';
	kommentarBoxHTML += '                		</table>\n';
	kommentarBoxHTML += '              		</td>\n';
	kommentarBoxHTML += '              	<td width="9" class="contentBox"><img src="img/pix.gif" width="9" border="0"></td>\n';
	kommentarBoxHTML += '			</tr>\n';
	kommentarBoxHTML += '			   <!-- Kommentar - Meldungen -->\n';
	kommentarBoxHTML += '           <tr>\n';	
	kommentarBoxHTML += '			  	<td id="kommentarMeldung" height="1" colspan="3" class="empfehlenBox"><img src="img/pix.gif" height="1" border="0"></td>\n';
	kommentarBoxHTML += '			</tr>\n';
	kommentarBoxHTML += '           <tr>\n';
	kommentarBoxHTML += '           	<td width="9" height="83" class="kommentarBoxLinks"><img src="img/pix.gif" width="9" height="83" border="0"></td>\n';
	
	if (userID != -1)
	{
		kommentarBoxHTML += '              <!-- Kommentar-Formular -->\n';
		kommentarBoxHTML += '              <td width="100%" height="83" class="kommentarBox" align="center" valign="middle">\n';
		kommentarBoxHTML += '                <table width="96%" cellpadding="0" cellspacing="0" border="0">\n';
		kommentarBoxHTML += '                <tr>\n';
		kommentarBoxHTML += '                  <td colspan="2" height="15" align="left"><font class="kommentarForm">Dein Kommentar</font></td>\n';
		kommentarBoxHTML += '                </tr>\n';
		kommentarBoxHTML += '                <tr>\n';
		kommentarBoxHTML += '                  <td align="left"><textarea name="kommentar" cols="85" rows="3"></textarea></td>\n';
		kommentarBoxHTML += '                  <td align="right" valign="bottom">\n';
		kommentarBoxHTML += '                    <table width="100%" height="28" cellpadding="0" cellspacing="0">\n';
		kommentarBoxHTML += '                    <tr>\n';
		kommentarBoxHTML += '                      <td align="right" valign="middle"><a id="kommentarLinkText" href="" class="whiteLink" onClick="xajax_getVerpixelung(\'kommentieren\')">Abschicken</a>&nbsp;</td>\n';
		kommentarBoxHTML += '                      <td width="28" align="left" valign="middle">\n';
		kommentarBoxHTML += '                        <a id="kommentarLinkImg" href="" onMouseOver="over(\'kommentieren\', imgKommentarOver.src);"\n';
		kommentarBoxHTML += '                         onMouseOut="out(\'kommentieren\', imgKommentar.src);" onClick="xajax_getVerpixelung(\'kommentieren\')"><img src="img/kommentar_bt.gif" width="28" height="28" border="0" name="kommentieren"></a>\n';
		kommentarBoxHTML += '                      </td>\n';
		kommentarBoxHTML += '                    </tr>\n';
		kommentarBoxHTML += '                    </table>\n';
		kommentarBoxHTML += '                  </td>\n';
		kommentarBoxHTML += '                </tr>\n';
		kommentarBoxHTML += '                </table>\n';
		kommentarBoxHTML += '              </td>\n';
		kommentarBoxHTML += '              <!-- Ende Kommentar-Formular --> \n';
	}
	else
	{
		kommentarBoxHTML += '              <!-- kein Kommentar -->\n';
		kommentarBoxHTML += '              <td width="100%" height="83" class="kommentarBox" align="center" valign="middle">\n';
		kommentarBoxHTML += '                <table width="96%" cellpadding="0" cellspacing="0" border="0">\n';
		kommentarBoxHTML += '                <tr>\n';
		kommentarBoxHTML += '                  <td colspan="2" height="15" align="left"><font class="kommentarForm">Logg dich oben auf der Seite ein, um Deinen Kommentar abzugeben.</font></td>\n';
		kommentarBoxHTML += '                </tr>\n';
		kommentarBoxHTML += '                </table>\n';
		kommentarBoxHTML += '              </td>\n';
		kommentarBoxHTML += '              <!-- Ende Kommentar-Formular -->\n';
	}
	
	kommentarBoxHTML += '              <td width="9" height="83" class="kommentarBoxRechts"><img src="img/pix.gif" width="9" height="83" border="0"></td> \n';                 
	kommentarBoxHTML += '            </tr>\n';
	kommentarBoxHTML += '          </table>\n';
	kommentarBoxHTML += '          </form>\n';
	kommentarBoxHTML += '          </td>\n';
	kommentarBoxHTML += '          <!-- Ende unterer Teil des HTML-Content-Bereich - Kommentare -->\n';

	document.getElementById("kommentarContent").innerHTML = kommentarBoxHTML;
}

function removeKommentarBox (userId)
{
	kommentarBox = false;
	$("#kommentarContent").html('<img src="img/pix.gif" border="0">');
}

// lÃ¶scht alle Kommentare
function clearKommentare ()
{
	if (!kommentarBox) setKommentarBox ();
	$("#kommentare").html("");
	$("#kommentarMeldung").html('<img src="img/pix.gif" height="1" border="0">');
}

function kommentierenForm (userId, folgeId)
{
	if (userId == -1) return;
	hrefText = "javascript:kommentieren ('"+userId+"', '"+folgeId+"')";
	$("#kommentarLinkText").attr("href", hrefText);
	$("#kommentarLinkImg").attr("href", hrefText);
}

function kommentieren (userId, folgeId)
{
	kommentar = document.kommentierenForm.kommentar.value;
	if (kommentar.length == 0) 
		document.getElementById("kommentarMeldung").innerHTML = '&nbsp;&nbsp;<span class="empfehlenFormBox">Bitte gib einen Text ein!</span>';
	else
	{
		xajax_kommentieren (userId, folgeId, addslashes(kommentar));
		document.kommentierenForm.kommentar.value = "";
		document.getElementById("kommentarMeldung").innerHTML = '<span class="empfehlenFormBox">&nbsp;&nbsp;Dein Kommentar wurde gespeichert! Bevor er angezeigt wird, mu&szlig; er zun&auml;chst kontrolliert und<br>&nbsp;&nbsp;dann von der Redaktion freigegeben werden! Wir bitten um Verst&auml;ndnis!</span>';
	}
}

function stopPlayer (playerId)
{
	console.log("stop Player: playerId: "+playerId);
	if (document[playerId] != null)
		document[playerId].SetVariable("stopPlayer", 1);
}

function setBewertung (punkte, stimmen, userId, contentId)
{
	var stern1Img = getSternImage (1, punkte);
	var stern2Img = getSternImage (2, punkte);
	var stern3Img = getSternImage (3, punkte);
	var stern4Img = getSternImage (4, punkte);
	var stern5Img = getSternImage (5, punkte);
	
	var stimmenStr = String(stimmen);
	
	if (stimmen != 1) stimmenStr += " Stimmen";
	else if (stimmen == 1) stimmenStr += " Stimme";
	
	bewertungHTML  = '                    <table height="100%" cellpadding="0" cellspacing="0">\n';
	bewertungHTML += '                    <tr>\n';
	bewertungHTML += '                      <td width="25" class="bewertungBox"><img src="img/pix.gif" width="25" border="0"></td>\n';
	bewertungHTML += '                      <td valign="middle" class="bewertungBox"><span class="bewertung">Bewertung</span></td>\n';
	bewertungHTML += '                      <td width="120" align="center" valign="middle" class="bewertungBox">\n';
	bewertungHTML += '                        <img src="'+stern1Img+'" width="19" height="19" border="0">\n';
	bewertungHTML += '                        <img src="'+stern2Img+'" width="19" height="19" border="0">\n';
	bewertungHTML += '                        <img src="'+stern3Img+'" width="19" height="19" border="0">\n';
	bewertungHTML += '                        <img src="'+stern4Img+'" width="19" height="19" border="0">\n';
	bewertungHTML += '                        <img src="'+stern5Img+'" width="19" height="19" border="0">\n';
	bewertungHTML += '                      </td>\n';
	bewertungHTML += '                      <td align="left" valign="middle" class="bewertungBox">('+stimmenStr+')&nbsp;';
	if (userId != -1) {	
			bewertungHTML += '<a href="javascript:checkBewertung ('+userId+', '+contentId+')" class="grayLink">Bewerte selbst...</a>';
	} else {
			bewertungHTML += '<i>Logg dich oben ein, um deine Bewertung abzugeben.</i>';
	}
	bewertungHTML += '                    </td>\n</tr>\n';
	bewertungHTML += '                    </table>\n';
	
	$("#bewertung").hide().html(bewertungHTML).show();
	
	$("#embeddedCodeContainer").html('<table width="335" cellspacing="0" cellpadding="0" border="0"><tr><td width="9" height="9" class="uploadBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td><td width="100%" height="9" class="empfehlenBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td><td width="9" height="9" class="uploadBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td></tr><tr><td width="9" class="empfehlenBox"><img src="img/pix.gif" width="9" border="0"></td><td id="embeddedCode" class="embeddedCodeContainer" align="center"></td><td width="9" class="empfehlenBox"><img src="img/pix.gif" width="9" border="0"></td></tr><tr><td width="9" height="9" class="uploadBoxLinksUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td><td width="100%" height="9" class="empfehlenBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td><td width="9" height="9" class="uploadBoxRechtsUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td></tr></table>').show();
	$("#embeddedCode").html('<p class="embeddedCodeHeading">Video Embed Code</p><textarea id="embeddedCodeGoesHere" rows="4"></textarea><p class="embeddedCodeNormal">Kopiere den embed code und füge ihn auf deiner eigenen Webseite ein.</p>');
	$("#embeddedCodeGoesHere").val(getEmbeddedPlayerCode("http://www.maedchen.de/tv", contentId ,''))
	/* Select everything when you click on the embedded code: */ 
	$("#embeddedCodeGoesHere").click(function (){ this.select() });
}

function getEmbeddedPlayerCode (mtvUrl, id, adserverUrl, titel)
{
	var code = '<script type="text/javascript" src="' + mtvUrl + '/js/swfobject2_1.js"></script>\n' +
			'<abbr title="titel"><div id="embedded_player'+id+'"><!-- player-content --></div></abbr>\n' +
			'<script type="text/javascript">\n// <!--\n' +
			'var flashvars = {"id": "' + String (id) + '","url": "' + mtvUrl + '/"};';
	if (adserverUrl.length > 0) 
	{
		code += '  flashvars.adserver_url = adserverUrl;\n';
	}
	code += 'var params = {};';
	code += 'swfobject.embedSWF("' + mtvUrl + '/swf/embedded_player_v00_07.swf", "embedded_player'+id+'", "480", "394", "8.0.0", "' + mtvUrl + '/swf/expressInstall.swf", flashvars, params);';
	code += '// -->\n';
	code += '</script>';
	
	return code;
}

function setAbstimmung (userId, frage, antwort1, antwort2, abgestimmt1, abgestimmt2)
{	
	abstFrage = frage;
	abstAntwort1 = antwort1;
	abstAntwort2 = antwort2;
	
	abstimmung ( userId, abgestimmt1, abgestimmt2 );
}


function abstimmung (userId, abgestimmt1, abgestimmt2)
{
	var prozentStr1 = "Keine Stimmen";
	var prozentStr2 = "Keine Stimmen";
	if (abgestimmt1 > 0 || abgestimmt2 > 0)
	{
		var prozent1 = Math.round (abgestimmt1 / (abgestimmt1 + abgestimmt2) * 100);
		var prozent2 = 100 - prozent1;
		prozentStr1 = abgestimmt1 + " Stimmen";
		prozentStr2 = abgestimmt2 + " Stimmen";
	}

	abstimmungHTML  = '                    <table width="100%" cellpadding="0" cellspacing="5">\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                      <td valign="middle" class="bewertungBox" align="left">&nbsp;&nbsp;<span class="bewertung"><b>'+stripslashes(abstFrage)+'</b></span></td>\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                      <td align="left" valign="middle" class="bewertungBox">&nbsp;&nbsp;'+stripslashes(abstAntwort1)+'&nbsp;('+prozentStr1+')</td>\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                      <td align="left" valign="middle" class="bewertungBox">&nbsp;&nbsp;'+stripslashes(abstAntwort2)+'&nbsp;('+prozentStr2+')</td>\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                      <td align="right" valign="middle" class="bewertungBox">\n';
	if (userId != -1) {	
			abstimmungHTML += '<a href="javascript:checkAbstimmung ('+userId+', '+folgeID+')" class="grayLink">Gib deine Stimme ab...</a>';
	} else {
			abstimmungHTML += '<i>Logg dich oben ein, um deine Stimme abzugeben.</i>';
	}
	abstimmungHTML += '                    </td>\n</tr>\n';
	abstimmungHTML += '                    </table>\n';
	
	$("#abstimmung").hide().html(abstimmungHTML).show();
	$("#abstimmung").attr("width", "100%");
}

function checkBewertung (userId, contentId)
{
	xajax_bewertungForm (userId, contentId);
}

function checkAbstimmung (userId, contentId)
{
	xajax_abstimmungForm (userId, contentId);
}

function setBewertungForm (userId, contentId, schonBewertet, punkte) {
	bewertung = punkte;
	
	var bewertenStr = "Bewertung abgeben";
	if (schonBewertet) bewertenStr = "Bewertung &auml;ndern";
	
	var stern1Img = getSternImage (1, punkte);
	var stern2Img = getSternImage (2, punkte);
	var stern3Img = getSternImage (3, punkte);
	var stern4Img = getSternImage (4, punkte);
	var stern5Img = getSternImage (5, punkte);
	
	bewertungHTML  = '                    <table height="100%" cellpadding="0" cellspacing="0">\n';
	bewertungHTML += '                    <tr>\n';
	bewertungHTML += '                      <td width="25" class="bewertungBox"><img src="img/pix.gif" width="25" border="0"></td>\n';
	bewertungHTML += '                      <td valign="middle" class="bewertungBox"><font class="bewertung">\n';
	bewertungHTML += '						Bewerten\n';
	bewertungHTML += '						</font></td>\n';
	bewertungHTML += '                      <td width="130" align="center" valign="middle" class="bewertungBox">\n';
	bewertungHTML += '                        <img id="stern1" src="'+stern1Img+'" width="19" height="19" border="0" onClick="sternSetzen (1)">\n';
	bewertungHTML += '                        <img id="stern2" src="'+stern2Img+'" width="19" height="19" border="0" onClick="sternSetzen (2)">\n';
	bewertungHTML += '                        <img id="stern3" src="'+stern3Img+'" width="19" height="19" border="0" onClick="sternSetzen (3)">\n';
	bewertungHTML += '                        <img id="stern4" src="'+stern4Img+'" width="19" height="19" border="0" onClick="sternSetzen (4)">\n';
	bewertungHTML += '                        <img id="stern5" src="'+stern5Img+'" width="19" height="19" border="0" onClick="sternSetzen (5)">\n';
	bewertungHTML += '                      </td>\n';
	bewertungHTML += '                      <td align="left" valign="middle" class="bewertungBox"><a href="javascript:bewerten ('+userId+', '+contentId+')" class="grayLink">'+bewertenStr+'</a></td>\n';
	bewertungHTML += '                    </tr>\n';
	bewertungHTML += '                    </table>\n';
	
	$("#bewertung").html(bewertungHTML);
	
	xajax_getVerpixelung("bewerteselbst");	
}

function setAbstimmungForm (userId, contentId, schonAbgestimmt, abgestimmt)
{
	var abstGestimmtFuer = abgestimmt;
	var checked1 = "";
	var checked2 = "";
	if (abgestimmt == 1) checked1 = " checked";
	else if (abgestimmt == 2) checked2 = " checked";
	
	//alert ("abgestimmt fÃ¼r: "+abgestimmt+"; schon abgestimmt: "+schonAbgestimmt);
	
	var linkStr = "Gib deine Stimme ab";
	if (schonAbgestimmt) linkStr = "Abstimmung &auml;ndern";
	
	abstimmungHTML  = '                    <table width="100%" cellpadding="0" cellspacing="5">\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                      <td valign="middle" class="bewertungBox" align="left" colspan="2">&nbsp;&nbsp;<span class="bewertung"><b>'+stripslashes(abstFrage)+'</b></span></td>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                    <tr>\n';
	abstimmungHTML += '                      <td align="left" valign="middle" class="bewertungBox">&nbsp;&nbsp;<input type="radio" name="abstimmung" onClick="stimmeFuer(1)"'+checked1+'></td>\n';
	abstimmungHTML += '                      <td align="left" valign="left" class="bewertungBox" width="100%">&nbsp;'+stripslashes(abstAntwort1)+'</td>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                    <tr>\n';	
	abstimmungHTML += '                      <td align="left" valign="middle" class="bewertungBox">&nbsp;&nbsp;<input type="radio" name="abstimmung" onClick="stimmeFuer(2)"'+checked2+'></td>\n';
	abstimmungHTML += '                      <td align="left" valign="left" class="bewertungBox" width="100%">&nbsp;'+stripslashes(abstAntwort2)+'</td>\n';
	abstimmungHTML += '                    </tr>\n';
	abstimmungHTML += '                    <tr>\n';	
	abstimmungHTML += '                      <td align="right" valign="middle" class="bewertungBox" colspan="2">\n';
	abstimmungHTML += '						  <a href="javascript:abstimmen ('+userId+', '+contentId+')" class="grayLink">'+linkStr+'...</a>';
	abstimmungHTML += '                    </td>\n</tr>\n';
	abstimmungHTML += '                    </table>\n';
	
	$("#abstimmung").hide().html(abstimmungHTML).show();
	
	xajax_getVerpixelung("abstimmen");
}

function stimmeFuer (nr)
{
	abgestimmtFuer = nr;
}

function bewerten (userId, contentId)
{
	xajax_bewerten (userId, contentId, bewertung);
	xajax_getVerpixelung("bewerteabgeben");
}

function abstimmen (userId, contentId)
{
	xajax_abstimmen (userId, contentId, abgestimmtFuer);
	xajax_getVerpixelung("stimmeabgeben");
	abgestimmtFuer = 0;
}

function utf8_encode ( str_data ) {
    str_data = str_data.replace(/\r\n/g,"\n");
    var tmp_arr = [], ac = 0;
 
    for (var n = 0; n < str_data.length; n++) {
        var c = str_data.charCodeAt(n);
        if (c < 128) {
            tmp_arr[ac++] = String.fromCharCode(c);
        } else if((c > 127) && (c < 2048)) {
            tmp_arr[ac++] = String.fromCharCode((c >> 6) | 192);
            tmp_arr[ac++] = String.fromCharCode((c & 63) | 128);
        } else {
            tmp_arr[ac++] = String.fromCharCode((c >> 12) | 224);
            tmp_arr[ac++] = String.fromCharCode(((c >> 6) & 63) | 128);
            tmp_arr[ac++] = String.fromCharCode((c & 63) | 128);
        }
    }
    
    return tmp_arr.join('');
}				   

function sternSetzen (punkte)
{
	for (var i=1; i<=5; i++) $("#stern"+i).attr("src", getSternImage (i, punkte));
	bewertung = punkte
}

function getSternImage (sternNr, punkte)
{
	var roundedPunkte = Math.round(punkte*2)/2;
	var image = "";
	if (roundedPunkte <= sternNr-1) image = "img/stern_leer.gif";
	else if (roundedPunkte > sternNr-1 && roundedPunkte < sternNr) image = "img/stern_halb.gif";
	else image = "img/stern_voll.gif";
	
	return image;
}

function setUploading (isUploading)
{
	uploading = isUploading;
}

function setUserUpload (userId, rubrikId, userUploadTitel)
{
	// alert ("setUserUpload: "+userUploadTitel);
	if (!uploading)
	{
		//<td id="'.$strId.'" height="3">
		var userUploadTD = document.createElement("td");
		
		if (userUploadTitel == 'null')
		{		
			userUploadTD.setAttribute("height", "3");
			userUploadTD.innerHTML = '<img src="img/pix.gif" height=3" border="0">';
		}
		else
		{
			var userUploadHTML = '            <table width="100%" cellspacing="0" cellpadding="0" border="0">\n';
			userUploadHTML += '            <tr>\n';
			userUploadHTML += '              <td width="9" height="9" class="uploadBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			userUploadHTML += '              <td width="100%" height="9" class="empfehlenBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
			userUploadHTML += '              <td width="9" height="9" class="uploadBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			userUploadHTML += '            </tr>\n';
			userUploadHTML += '            <tr>\n';			
			userUploadHTML += '              <td width="9" class="empfehlenBox"><img src="img/pix.gif" width="9" border="0"></td>\n';
			userUploadHTML += '              <td id="upload_form" class="empfehlenBox" align="center"></td>\n';
			userUploadHTML += '              <td width="9" class="empfehlenBox"><img src="img/pix.gif" width="9" border="0"></td>\n';
			userUploadHTML += '            </tr>\n';
			userUploadHTML += '            <tr>\n';
			userUploadHTML += '              <td width="9" height="9" class="uploadBoxLinksUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			userUploadHTML += '              <td width="100%" height="9" class="empfehlenBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
			userUploadHTML += '              <td width="9" height="9" class="uploadBoxRechtsUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			userUploadHTML += '            </tr>\n';
			
			if (adContentHtml != null)
			{
				if (adContentHtml.length > 0 || videoTeaserExists)
				{
					userUploadHTML += '            <tr>\n';
					userUploadHTML += '              <td height="10" colspan=3"><img src="img/pix.gif" height="10" border="0"></td>\n';
					userUploadHTML += '            </tr>\n';
				}
			}
			
			userUploadHTML += '            </table>\n';
			userUploadTD.innerHTML = userUploadHTML;
		}
		document.getElementById("user_upload").removeChild(document.getElementById("space_oben"));
		userUploadTD.setAttribute("id", "space_oben");
		document.getElementById("user_upload").appendChild(userUploadTD);
		
		
		if (userUploadTitel != 'null' && userId != -1)
		{
			var so3 = new SWFObject("swf/userupload_v00_04.swf", "userupload", "660" , "230", "8", "#EC7FC9", "HIGH", "", "upgrade_flash.html");
			so3.addVariable("upload_titel", userUploadTitel) ;
			so3.addVariable("userId", userId);
			so3.addVariable("rubrikId", rubrikId) ;
			so3.useExpressInstall('swfobject/expressinstall.swf');
			so3.write("upload_form");
		}
		else if (document.getElementById("upload_form") != null)
		{
			var textHTML = '<span class="kommentarForm">';
			if (folgeID == -1) textHTML += 'Momentan gibt es hier noch keinen Inhalt f&uuml;r diese Rubrik.<br>\n';
			textHTML += 'Wenn du dich oben auf der Seite einloggst,<br>kannst du hier dein eigenes Video hochladen!</span>\n';
			$("#upload_form").html(textHTML);
		}
		
	}
}

function setAdContent ()
{
	if (adContentHtml != null)
	{
		if (adContentHtml.length > 0 && document.getElementById("contentad") == null)
		{
			if (videoTeaserExists)
			{
				var spaceTD = document.createElement("td");			
				spaceTD.setAttribute("id", "space_videoteaser_adcontent");
				spaceTD.setAttribute("width", "12");
				spaceTD.innerHTML = '<img src="img/pix.gif" width="12" border="0">';			
				document.getElementById("videoteaser_adcontent").appendChild(spaceTD);
			}
			var contentHTML  = '     <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">\n';
			contentHTML += '	    <tr>\n';
			contentHTML += '	      <td width="9" height="9" class="contentBoxLinksOben"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			contentHTML += '	      <td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
			contentHTML += '	      <td width="9" height="9" class="contentBoxRechtsOben"><img src="img/pix.gif" width="9" height="9" border="0"></td> \n';                 
			contentHTML += '	    </tr>\n';
			contentHTML += '	    <tr>\n';
			contentHTML += '	      <td width="9" height="9" class="contentBox"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			contentHTML += '          <td width="100%" height="100%" align="center" valign="middle" class="contentBox">\n';
			contentHTML += '	        <table cellspacing="0" cellpadding="0" border="0">\n';
			contentHTML += '			<tr><td height="16" align="left" valign="middle" class="adContentTitel">&nbsp;Anzeige</td></tr>\n';
			contentHTML += '			<tr><td>'+adContentHtml+'</td></tr></table>\n'; 
			contentHTML += '	      <td width="9" height="9" class="contentBox"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			contentHTML += '	    </tr>\n';
			contentHTML += '	    <tr>\n';
			contentHTML += '	      <td width="9" height="9" class="contentBoxLinksUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td>\n';
			contentHTML += '	      <td width="100%" height="9" class="contentBox"><img src="img/pix.gif" width="100%" height="9" border="0"></td>\n';
			contentHTML += '	      <td width="9" height="9" class="contentBoxRechtsUnten"><img src="img/pix.gif" width="9" height="9" border="0"></td> \n';                 
			contentHTML += '	    </tr>\n';
			contentHTML += '	    <tr>\n';
			
			var contentadTD = document.createElement("td");
			contentadTD.setAttribute("id", "contentad");
			contentadTD.setAttribute("align", "center");
			contentadTD.setAttribute("valign", "top");
			contentadTD.innerHTML = contentHTML;
			$("#videoteaser_adcontent").add(contentadTD);
			$("#space_oben").attr("height", "10");
			$("#space_unten").attr("height", "10");
		}
	}
}

/**
* Setzt die globalen Javascript Variablen, die für die DOM-Manipulation an mehreren Stellen benötigt werden.   
* Diese Funktion wird beim Wechsel einer Folge immer zuerst aufgerufen. Aus diesem Grund werden hier auch 
* alle Content-Bereiche die mit Informationen des letzten Videos befüllt waren wieder geleert. 
* Alle guten Namen sind schon vergeben, also setzte ich hier vor die Parameter ein "param", 
* damit mir der JavaScript-Namespace hier nicht um die Ohren fliegt.
* Nicht gerade "best practice" :-(
*/
function setGlobalsJSInfos(paramUserId,paramFolgeId,paramRubrikId,paramFolgenName,paramArchivContent,paramTrackingPixel)
{
	rubrikID = paramRubrikId;
	folgeID = paramFolgeId;
	archivContent = paramArchivContent;
	folgeName = paramFolgenName;
	userID = paramUserId;
	
	clearKommentare();
	kommentierenForm (userID, folgeID);
	
	cancelWeiterempfehlenForm ();
	$("#weiterempfehlung").html('<img src="img/pix.gif" height="1" border="0">');

	xajax_setKommentare (folgeID);
	
	if (folgeID == -1)
	{
		removeContentBox ();
		removeKommentarBox ();
	}
	
	setAdContent();
	
	if (paramTrackingPixel != 'null') {
		trackingpixel (pixel);
	}
}

function clearAbstimmung ()
{
	$("#abstimmung").hide().html('').show();
}

/*
function setHTMLContent (name, beschreibung, sponsorExists, sponsorName, sponsorText, sponsorBild, sponsorLinkUrl, sponsorLinkText, sponsorTrackingpixel, archiv, pixel, userId, folgeId, abstimmung,
redaktionTeaserName, redaktionTeaserBeschreibung, redaktionTeaserBild, redaktionTeaserLink, redaktionTeaserPixel, videoTeaserName, videoTeaserBeschreibung,
videoTeaserVideo, videoTeaserLink, videoTeaserPixel, rubrikId, redaktionTeaser, videoTeaser, setTeaser, uploadTitel)
{
		
	rubrikID = rubrikId;
	folgeID = folgeId;
	archivContent = archiv;
	folgeName = name;
	userID = userId;
	
	//alert ("Stimmen: " + stimmen);
	
	//alert ("Rubrik:"+rubrikId+"; uploadTitel: "+uploadTitel);


	if (folgeId != -1) 
	{
		clearKommentare ();
		setContent (name, beschreibung, sponsorExists, sponsorName, sponsorText, sponsorBild, sponsorLinkUrl, sponsorLinkText, sponsorTrackingpixel);
		kommentierenForm (userId, folgeId);
		xajax_setKommentare (folgeId);
	}
	else 
	{
		removeContentBox ();
		removeKommentarBox ();
	}

	
	if (uploadTitel == null || String(uploadTitel) == "undefined") uploadTitel = "";
	userUploadTitel = uploadTitel;
	
	//alert ("Abstimmung: " + String (abstimmung) + "\nfrage: " + frage + "\nantwort1: " + antwort1 + "\nantwort2: " + antwort2);
	
	//	if (!abstimmung) $("#abstimmung").hide().html('').show();
	
	if (setTeaser)
	{
		removeAllTeaser ();
		if (redaktionTeaser) setRedaktionTeaser (redaktionTeaserName, redaktionTeaserBeschreibung, redaktionTeaserBild, redaktionTeaserLink, redaktionTeaserPixel);
		if (videoTeaser)
		{
			setVideoTeaser (videoTeaserName, videoTeaserBeschreibung, videoTeaserVideo, videoTeaserLink, videoTeaserPixel);
			videoTeaserExists = true;
		}
		else videoTeaserExists = false;
	}
	
	
	
	if (document.getElementById("kommentarMeldung") != null) document.getElementById("kommentarMeldung").innerHTML = '<img src="img/pix.gif" height="1" border="0">';
	
	setUserUpload (userId, rubrikId);

	
}
*/

function hauptsponsor ()
{
	xajax_hauptsponsor ();
}

function setHauptsponsor (bildUrl, linkUrl, pixel)
{
	var sponsorDIV = document.createElement("div");
	sponsorDIV.setAttribute ("id", "hauptsponsor");
	
	var sponsorHTML = '<img src="'+bildUrl+'?'+String(Math.round(Math.random () * 9999999))+'" border="0">';
	if (linkUrl.length > 0) sponsorHTML = '<a href="javascript:sponsorLink (\''+linkUrl+'\', \''+pixel+'\')">'+sponsorHTML+'</a>';
	
	sponsorDIV.innerHTML = sponsorHTML;
	
	document.getElementById("top").appendChild(sponsorDIV);
}

function sponsorLink (linkUrl, pixel)
{
	if (pixel.length > 0) trackingpixel (pixel);
	window.open (linkUrl);
}
