/*SVN Add-ins

$Rev::            $: Revision of last commit
$Author::         $: Author of last commit
$Date::  1#$: Date of last commit

Authors: JDE
Copyright (c) A&B FACE2NET GmbH
*/
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/*
    behaviour.js
    28.10.2010  JDE CGL
    
*/
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */

;(function($) {

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/**
* browser detection
*/
var agt = navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var is_ie6 = false; var is_ie7 = false; var is_ie8 = false; 
var i = 0;

var clickOnRecommendLink = 0;

if(ie){
  var IEcomp = null;
  if (document.documentMode) {
    IEcomp = document.documentMode;
  }else {
    IEcomp = 5;
    if (document.compatMode) {
      IEcomp = 6;
      if( agt.indexOf("msie 7.")!= -1) IEcomp = 7;
      
    }
  }
  if(null != IEcomp){
    is_ie6 = (agt.indexOf("msie 6.")!= -1); /* ie6 */
    is_ie7 = (agt.indexOf("msie 7.")!= -1); /* ie7 */
    is_ie8 = (IEcomp==8); /* ie8 */
    is_ie8k7 = (!is_ie7) && (IEcomp == 7); /* ie8 im 7er Kompatibilitaetsmodus */
  }
}


var check = function(){ alert("JS + jQuery eingebunden"); }


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/**
* executes functions when the page loads.
* @param func_name name of function
*/
var addLoadEvent = function(func_name){
  var lastonload = window.onload;

  if (typeof window.onload != 'function') {
    window.onload = func_name;
  } else {
    window.onload = function() {
      lastonload(); func_name();
    }
  }
}


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* TipAFriend */

var registerOnClickTipAFriendLink = function(){	
	var html;
	//die javascript von capcha muss hier geladen werden, da sie sonst nur auf der seite, auf der das tipafriend plugin installiert ist, geladen wird
	$('.tipafriendDOMWindow').click(function(e) {		
		$.getScript('typo3conf/ext/sr_freecap/pi2/freeCap.js', function() {
			clickOnRecommendLink++;		
			var aPageId = gup(e['target']['href'], 'aPageId');			
			ajaxFunction("index.php?id="+aPageId, '', true, 'GET');					
		});
		return false;
	});	
}

function gup( url, name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( url );
  if( results == null )
    return "";
  else
    return results[1];
}

var ajaxFunction = function(url, data, firstCall, type){
	$.ajax({
	  url: url,
	  cache: false,	
	  type: type,
	  data: data,
	  success: function(html){
		var htmlElements = $(html);
		
		$('#DOMWindow').empty();
		
		for(var i = 0; i < htmlElements.length; i++){
			if(htmlElements[i].id != null && htmlElements[i].id != '' && htmlElements[i].id == 'ajaxcontent'){				
				if(firstCall){
					var hiddenUrlField = $('input[name="tipUrl"]', htmlElements[i]);					
					hiddenUrlField[0].value = document.URL;
					var urlLink = $('a[class="tx_tipafriend_url"]', htmlElements[i]);					
					urlLink[0].href = document.URL;
					urlLink[0].innerHTML = document.URL;								
				} 				
				$('#DOMWindow').append(htmlElements[i]);
			}				
		}
		/*
		$('.closebox').click(function(e) {
			$('.tipafriendDOMWindow').closeDOMWindow();
		});*/
		
		$('.closebox').attr('href', document.URL);
		
		if(!firstCall || (clickOnRecommendLink > 1)){
			$("span.tx-srfreecap-pi2-cant-read > a").click();
		}
		
		if(document.forms["tx_tipafriend"] != null){						
			document.forms["tx_tipafriend"].onsubmit = onFormSubmit;
			document.forms["tx_tipafriend"].elements['TIPFORM[name]'].focus();						
		} else {
			document.getElementById("closebox").focus();
			//var t = setTimeout(function(){$('.tipafriendDOMWindow').closeDOMWindow();}, 2000);
		}
	  }
	});
} 

var toggleLayer = function(e){
	$('.tipafriendDOMWindow').closeDOMWindow();
}

var addClassNameToFirstLinkInMainbottom = function(){
	var a = $('a:first', $('#mainbottom'));
	a.addClass('focusClass');
}

var registerOnFocusEvents = function(){
	$('.focusClass').focus(function(e) {
		toggleLayer();
	});
}

var onFormSubmit = function(e){
	var target;
	if(e && e.target){		
		target = e.target;
	} else {		
		target = event.srcElement;		
	}
	var data = '';
	for(var i = 0; i < target.elements.length; i++){		
		data += target.elements[i].name+'='+target.elements[i].value;
		if(i != (target.elements.length-1)){
			data += '&';
		}
	}	
	ajaxFunction(target.action, data, false, 'POST');	
	
	return false;
}

var openRecommendPageLayer = function(){	
	$('.tipafriendDOMWindow').openDOMWindow({ 
		eventType:'click', 
		width: 680,
		height: 800	
	});
}

//die javascript von capcha muss hier geladen werden, da sie sonst nur auf der seite, auf der das tipafriend plugin installiert ist, geladen wird
var loadCapchaJS = function(){
	//$.getScript('typo3conf/ext/sr_freecap/pi2/freeCap.js', function() {});
	/*
	$.ajax({
	      type: "GET",
	      url: 'typo3conf/ext/sr_freecap/pi2/freeCap.js',
	      dataType: "script",
	      error: function (XMLHttpRequest, textStatus, errorThrown) {
			//alert("freeCap.js konnte nicht geladen werden! ");
		  },
	      success:function(){ 
			  try{
				  //$.getScript('typo3conf/ext/sr_freecap/pi2/freeCap.js', function() {});
			  }catch(err){alert(err.toString());}
	      }
	   });*/
}


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* faq */

/**
* toggle answer container in faq
*/

mOptions = {
		'kontext' : '.faq .questions ol li',
		'allq' : ' h4 a',
		'cq' : '.active h4 a',
		'ncq' : ':not(.active) h4 a',
		'alla' : ' div.container_antworten',
		'ca' : '.active div.container_antworten',
		'nca' : ':not(.active) div.container_antworten',
		'showtitle' : 'Details zu dieser Frage anzeigen',
		'hidetitle' : 'Details zu dieser Frage ausblenden',
		'num' : 0
};/* mOptions */


function toggle_meinungen(){

    var faqkontext = '.faq .questions ol li';
    var allQ = $(faqkontext+" h4 a");
    var actQ = $(faqkontext+".active h4 a");
    var tempi = 0;
    var alltitle = "Details zu dieser Frage anzeigen";
    var acttitle = "Details zu dieser Frage ausblenden";

    $(faqkontext+':first').addClass('active');
    allQ.each(function (index) {

      var answer = $(this).attr('href').substring($(this).attr('href').indexOf('#'));
      if(index > 0){
       $(answer).slideToggle();       
      }
      $(this).attr('title',acttitle);

      $(this).click(function(event) {
        //event.preventDefault();
        $(answer).slideToggle("fast", function () {
          tempi = 1+index;
          $(faqkontext+':nth-child('+tempi+')').toggleClass('active');
          $(faqkontext+':not(.active) h4 a').attr('title',alltitle);
          $(faqkontext+'.active h4 a').attr('title',acttitle);
          check_viewport(answer);
        });
      });
    });/* each */
}

function set_active(){	
	var currentHash= String(showHash());
	var mynum = 1 + mOptions.num;
	if( 0 == currentHash.indexOf('#antwort_') ) {
		if(parseInt( currentHash.substring(currentHash.lastIndexOf("_")+1) ) != NaN)
			mynum = 1 + parseInt( currentHash.substring(currentHash.lastIndexOf("_")+1) );
		$(mOptions.kontext+':nth-child('+mynum+')').addClass('active');
	}
}
function showHash () {
	return location.hash;
}
/**
* make sure, that question is in viewport
*/
function check_viewport(answer){
	var y = 0;
	var currentHash= String(showHash());
	if (window.pageYOffset) {
		y = window.pageYOffset;
	} else if (document.body && document.body.scrollTop) {
		y = document.body.scrollTop;
	}
	
	if (y > 100) {
		do {
			window.scrollBy(0, 10);
			y = y - 10;
		} while (y > 10);
	}
}



/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* initFunctions tipafriend */

function initFunctions(){	
	if($('div[class^="backlink ajaxTipPageId"]') != null && $('div[class^="backlink ajaxTipPageId"]').length > 0){
		var className = $('div[class^="backlink ajaxTipPageId"]')[0].className;		
		var ajaxTipPageId = parseInt(className.replace(/backlink ajaxTipPageId/g, ''));		
		$('div[class^="backlink ajaxTipPageId"]').append('<p><a href="index.php?aPageId='+ajaxTipPageId+'" class="tipafriendDOMWindow focusClass">Seite empfehlen</a></p>');
	}
	
	if($('.tipafriendDOMWindow') != null && $('.tipafriendDOMWindow').length > 0){
		openRecommendPageLayer();
		registerOnClickTipAFriendLink();
		//loadCapchaJS();
		addClassNameToFirstLinkInMainbottom();
		registerOnFocusEvents();
	}
}

function mouseoverTeaser(){
	if($('.shortcutarea .box.teaser a').length > 0){			
			$('.shortcutarea .box.teaser a').parents('.box').mouseover(
				function(e){						
					$(this).addClass('shortcuthover');
				}
			);
			$('.shortcutarea .box.teaser a').parents('.box').mouseout(
				function(e){
					if($(this).hasClass('shortcuthover'))
						$(this).removeClass('shortcuthover');
				}
			);
			
			$('.shortcutarea .box.teaser a').parents('.box').bind('click',
				function(e){
					var href = $(this).find('a')[0].href;
					window.location.href = href;
				}
			);
		
	}
}



/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* topteasercontent behaviour */
if ('undefined' == typeof(tOptions)) { tOptions = new Object(); }
tOptions = {
	'cnum' : 0,
  	'ncount' : 0,
  	'maxTeaser':12,
  	'defaulthead' : 'aktuelle Nachricht',
	'imagesize': 'width="588" height="365"',
	'imageclass': 'image',
	'teasersize': 'width="238"',
	'fid': 'teaserfocus',
	'teaserclass': 'teaser',
	'blindimg': '/fileadmin/layout/images/structure/blind.gif',
	'icon_browser_default_src': '/fileadmin/layout/images/structure/icon_round.gif',
	'icon_browser_active_src': '/fileadmin/layout/images/structure/icon_round_active.gif',
	'icon_browser_arrow_prev': '/fileadmin/layout/images/structure/icon_prev.gif',
	'icon_browser_arrow_next': '/fileadmin/layout/images/structure/icon_next.gif',
	'timerIsOn' : false
};/* sOptions */

var cimgs = new Array(); 
var tteaser = (".start #main .area1 #content .box:not(.browse)");
//var tteaser = (".start #main .area1 #content .box #teasercontent");

var counter = 0;

/* load events for topteasercontent behaviour  */
var initiate_topteasercontent = function(){		
	if(document.getElementById('content') && $('div.wrapper').hasClass('start')){    
		try{
			if(topteaser && topteaser.count) {
				if(parseInt(topteaser.count) > tOptions.maxTeaser) counter = tOptions.maxTeaser; else counter = parseInt(topteaser.count);
        
				if(topteaser.count > 1){
					write_focuslink(tOptions.fid);
					tOptions.ncount = topteaser.count-1;
					$.extend(true, tOptions, topteaser);
					$(tteaser).attr('aria-live', 'polite');
					next_teaserlink(); 
					prev_teaserlink(); 
				}else if(topteaser.count == 1){
					$.extend(true, tOptions, topteaser);
				}
			}      
		}catch(err){
			//alert(err);
		}
  }
}; /* initiate_topteasercontent */

/* ersetzt die Pfeile mit dem Mini Teaser Browser*/
var showMiniTeaserBrowser = function(){	
	
	var browseContainer = $('.start #content .box.browse');
	var html = '<div>';	
	var count = 0;
	if('undefined' != typeof(topteaser)&& topteaser != null && topteaser.count)
		count = parseInt(topteaser.count);	
		
	if( browseContainer.length > 0 ){
		browseContainer.html('');		

		if(count > 1){
			if(tOptions.cnum == 0) 
				var prevTeaser = counter; 
			else
				var prevTeaser = tOptions.cnum;
			
			if(tOptions.cnum == counter-1){
				var nextTeaser =  1;
			} else { 
				var nextTeaser = tOptions.cnum;
			}
			
			html += '<a href="#" title="" class="prev"><span class="noborder first"><img class="bimg" height="17" width="17" src="'+tOptions.icon_browser_arrow_prev+'" alt="zur&uuml;ck" /></span>';
			html += '<span class="out"> zum '+(prevTeaser)+' Inhalt</span>';
			html += '</a>';
			html += '<span class="out">/</span>';
			//for( var i = 0, j = 0; i < count && j < tOptions.maxTeaser ; i++, j++ ){	
			for( var i = 0; i < counter; i++ ){
				if(tOptions.cnum == i)
					html += '<strong><span class="out">angezeigt: </span><span><img class="bimg" height="13" width="13" src="'+tOptions.icon_browser_active_src+'" alt="Inhalt" /></span><span class="out"> '+ i +'</span></strong>';
				else 
					html += '<a href="#" class="teaserlink_'+ i +'" title=""><span><img class="bimg" height="13" width="13" src="'+tOptions.icon_browser_default_src+'" alt="Inhalt" /></span><span class="out"> '+ i +' anzeigen</span></a>';
				html += '<span class="out">/</span>';
			}
			html += '<a href="#" title="" class="next"><span class="noborder last"><img class="bimg" height="17" width="17" alt="vor" src="'+tOptions.icon_browser_arrow_next+'" /></span><span class="out"> zum '+(nextTeaser)+' Inhalt</span></a>';
		}
				
		html += '</div><div class="clearer"></div>';		
	}
	browseContainer.html(html);
	registerOnClickEventsTeaserLinks();
}

var t;
var firstTimeout;

/* click Event auf Pfeile und P�nktchen der Teaser Mininavigation */
var registerOnClickEventsTeaserLinks = function(){	
	var teaserlinks = $('a[class^="teaserlink"]');
	if(teaserlinks != null && teaserlinks.length > 0){
		teaserlinks.click(function(e){
			if(firstTimeout != null) clearTimeout(firstTimeout);
			var clickedTeaser = parseInt(this.className.replace('teaserlink_', ''));
			$('#teasercontent').fadeOut(1000, function() {				
				loadTeaser(clickedTeaser);				
				showMiniTeaserBrowser();
				$('#teasercontent').fadeIn(1000);		
			});
			if(t != null && 'undefined' != typeof(t)){
				clearTimeout(t);
				tOptions.timerIsOn = false;
			}			
			set_newfocus(tOptions.fid);
			return false;
		});
	}
	
	var prev = $('a.prev');
	var next = $('a.next');
	
	prev.click(function(e){
		if(firstTimeout != null) clearTimeout(firstTimeout);
		if(t != null && 'undefined' != typeof(t)){
			clearTimeout(t);
			tOptions.timerIsOn = false;
		}
		$('#teasercontent').fadeOut(1000, function() {
			loadPrevTeaser();
			$('#teasercontent').fadeIn(1000);		
		});
		set_newfocus(tOptions.fid);
		return false;	
	});
	
	next.click(function(e){
		if(firstTimeout != null) clearTimeout(firstTimeout);
		if(t != null && 'undefined' != typeof(t)){
			clearTimeout(t);
			tOptions.timerIsOn = false;
		}		
		$('#teasercontent').fadeOut(1000, function() {
			loadNextTeaser();
			$('#teasercontent').fadeIn(1000);		
		});
		set_newfocus(tOptions.fid);
		return false;
	});
			
}

/**
 * click auf kleinen linken Pfeil in der Teaser-Navigation
 * */
var loadPrevTeaser = function(){
	if( tOptions.cnum == 0 ){
		loadTeaser(counter-1);
	} else { 
		loadTeaser(tOptions.cnum - 1);
	}
	showMiniTeaserBrowser();
}

/**
 * click auf kleinen rechten Pfeil in der Teaser-Navigation
 * */
var loadNextTeaser = function(){
	if(tOptions.cnum == counter-1){
		loadTeaser(0);
	} else { 
		loadTeaser(tOptions.cnum + 1);
	}
	showMiniTeaserBrowser();
} 

var startSlider = function(){	
	if('undefined' != typeof(topteaser) && topteaser != null && (topteaser.count > 1)){
		if(!tOptions.timerIsOn){
			tOptions.timerIsOn = true;
			firstTimeout = setTimeout(timeOut, 5000);
		}
	}
}



var timeOut = function(){	
	if(firstTimeout != null) clearTimeout(firstTimeout);	
	$('#teasercontent').fadeOut(1000, function() {
		loadNextTeaser();
		$('#teasercontent').fadeIn(1000);		
	});
	t = setTimeout(timeOut,10000);
}

/* write next ff link */
var next_teaserlink = function(){	
  $(tteaser+' .ff a').click(function(event) {
		event.preventDefault();
		
		if(tOptions.cnum < tOptions.ncount){
			num = tOptions.cnum+1;
		}else{
			num = 0;
		}
		loadTeaser(num);
		set_newfocus(tOptions.fid);
	});  
}; /* next_teaserlink */

/* write previous rew link */
var prev_teaserlink = function(){
  $(tteaser+' .rew a').click(function(event) {
		event.preventDefault();
		if(tOptions.cnum > 0){
			num = tOptions.cnum-1;
		}else{
			num = tOptions.ncount;
		}
		loadTeaser(num);
		set_newfocus(tOptions.fid);
	});
  
}; /* next_teaserlink */

/* load next teaser content */
var loadTeaser = function(num){	
	tOptions.cnum = num;
	switch_teaserimg(num);
	switch_teaserhead(num);
	switch_teasertext(num);
	
}; /* loadTeaser */

/* write next teaser img */
var switch_teaserimg = function(key){
  if(tOptions[key] && tOptions[key].img_src && tOptions[key].img_alt && tOptions[key].ttype && tOptions.imagesize && tOptions.teasersize && tOptions.teaserclass && tOptions.imageclass ){
		var sizeattr = tOptions.imagesize;
		if(tOptions[key].ttype == tOptions.teaserclass){
			sizeattr = tOptions.teasersize;
			$(tteaser).removeClass(tOptions.imageclass).addClass(tOptions.teaserclass);
		}else{
			$(tteaser).removeClass(tOptions.teaserclass).addClass(tOptions.imageclass);
		}		
		//$(tteaser+' img:not(.bimg)').replaceWith('<img src="'+tOptions[key].img_src+'" alt="'+tOptions[key].img_alt+'" '+sizeattr+' />');
		$('#teasercontent img:not(.bimg)').replaceWith('<img src="'+tOptions[key].img_src+'" alt="'+tOptions[key].img_alt+'" '+sizeattr+' />');
  }else{ 
		//$(tteaser+' img:not(.bimg)').replaceWith('<img src="'+tOptions[key].img_src+'" alt="" width="1" height="1" />');
		$('#teasercontent img:not(.bimg)').replaceWith('<img src="'+tOptions[key].img_src+'" alt="" width="1" height="1" />');
	}
  
}; /* switch_teaserimg */

/* write next teaser headline */
var switch_teaserhead = function(key){
  if(tOptions[key] && tOptions[key].thead){
		var thead= tOptions[key].thead;
		if(tOptions[key].tlink && String(tOptions[key].tlink).length > 3){
			//thead = '<a href="'+tOptions[key].tlink+'">'+thead+'</a>';
			thead = tOptions[key].tlink;
		}
		//$(tteaser+' h2').replaceWith('<h2>'+thead+'</h2>');
		$('#teasercontent h2').replaceWith('<h2>'+thead+'</h2>');
	}else{
		//$(tteaser+' h2').replaceWith('<h2 class="out">'+tOptions.defaulthead+'</h2>');
		$('#teasercontent h2').replaceWith('<h2 class="out">'+tOptions.defaulthead+'</h2>');
	}
}; /* switch_teaserimg */

/* write next teaser headline */
var switch_teasertext = function(key){
  if(tOptions[key] && tOptions[key].ttext){	
	  //$(tteaser+' > h3,'+tteaser+' > h4,'+tteaser+' > h5,'+tteaser+' > h6,'+tteaser+' > p,'+tteaser+' > ul,'+tteaser+' > ol').remove();		
	  $('#teasercontent > h3, #teasercontent > h4,#teasercontent > h5,#teasercontent > h6,#teasercontent > p,#teasercontent > ul,#teasercontent > ol').remove();	
	  //$(tteaser+' .browse').before(tOptions[key].ttext);
	  $('#teasercontent h2').after(tOptions[key].ttext);	  
	} 
}; /* switch_teaserimg */

/* set focus to teaserheadline */
var set_newfocus = function(fid){	
	var focusobj = document.getElementById(fid);
	if(focusobj) focusobj.focus(); 
}; /* set_newFocus */

/* set focus to teaserheadline */
var write_focuslink = function(fid){
	$(tteaser).prepend('<a href="#content" class="'+fid+'" name="'+fid+'" id="'+fid+'">zur Nachricht</a>');
}; /* write_focuslink */

var smNewsRoomLinks = function(){	
	if('undefined' != typeof(snr) && snr != null ){		
		if('undefined' != typeof(snr.presse) && snr.presse != null ){						
			createMoreLink('presse', snr.presse);					
		}
		if('undefined' != typeof(snr.downloads) && snr.downloads != null ){
			createMoreLink('downloads', snr.downloads);			
		}
		if('undefined' != typeof(snr.images) && snr.images != null ){
			createMoreLink('image', snr.images);
		}
		if('undefined' != typeof(snr.twitter) && snr.twitter != null ){
			createMoreLink('twitter', snr.twitter);		
		}
		
		if('undefined' != typeof(snr.videos) && snr.videos != null ){			
			createMoreLink('video', snr.videos);		
		}
	}
}

var createMoreLink = function(morewhat, object){

	if($('div.outer.'+ morewhat).length > 0){
		var morelink = $('<a href="#" class="'+morewhat+'"><span>mehr</span></a>');		
		morelink.click(function(event) {
			event.preventDefault();		
			var className = $(this).attr('class');	
			
			if($('div.outer.'+ className).html() == ''){			
				$('div.outer.'+className).append(object.html);			
			}

			if($('div.outer.'+className).is(":hidden")){
				$('div.outer.'+className).slideDown("slow", function(){
					$(event.currentTarget).find('span').html('weniger');
				});
			} else {
				$('div.outer.'+className).slideUp("slow", function(){
					$(event.currentTarget).find('span').html('mehr');
				});
			}
		});	
		
		if('undefined' != $('div.social.'+morewhat+' div.morelinks p'))
			$('div.social.'+morewhat+' div.morelinks p').prepend(morelink);
	}
}



/**
* facebook like it button
*/
var fblboxdefaults = {
    'wrap':              '',
    'prefix':            '<strong class="out"><span lang="en">Facebook: </span>Gef&auml;llt mir<br/></strong>',
    'url':               'http://www.sozialwahl.de',
    'class':             'fblikebox',
    'title':             "Facebook Funktion 'Gef&auml;llt mir'",
    'scrolling':         'no',
    'frameborder':       '0',
    'allowTransparency': 'true',
    'show_faces':        'true',
    'width':             '182',
    'height':            '280',
    'style':             'border:none; overflow:hidden;',
    'colorscheme':       'light',
    'stream':             'false',
    'header':             'false',
    'locale':            'de%5FDE'
  };

$.fn.set_fblbox = function(options) {

  var fblboxoptions = $.extend({}, fblboxdefaults, options);

  return this.each(function() {
    var $this = $(this);

    var fblsrc = "http://www.facebook.com/plugins/likebox.php?";
    fblsrc += "href="+fblboxoptions.url;
    fblsrc += "&locale="+fblboxoptions.locale;
    fblsrc += "&show_faces="+fblboxoptions.show_faces;
    fblsrc += "&width="+fblboxoptions.width;
    fblsrc += "&height="+fblboxoptions.height;
    fblsrc += "&colorscheme="+fblboxoptions.colorscheme;
    fblsrc += "&stream="+fblboxoptions.stream;
    fblsrc += "&header="+fblboxoptions.header;

    var fblframe = fblboxoptions.prefix + '<iframe title="'+fblboxoptions.title+'" class="'+fblboxoptions['class']+'" src="'+fblsrc+'" scrolling="'+fblboxoptions.scrolling+'" frameborder="'+fblboxoptions.frameborder+'" style="width:'+fblboxoptions.width+'px; height:'+fblboxoptions.height+'px; '+fblboxoptions.style+'" allowTransparency="'+fblboxoptions.allowTransparency+'"></iframe>';
    $this.append(fblframe);
  });
};

var set_fb_likebox = function(){  
  //$('.fb_like').append('<img width="40" height="40" alt="Sozialwahl 2011" src="/js/content/assets/fb_teaser_img_40x40.jpg" /><p><a href="https://www.facebook.com/sozialwahl2011">Sozialwahl 2011</a><br/>auf Facebook</p><div class="clearer"></div>');
  
 // $('.fb_like').addClass('fb_likebox');
  $('.fb_like').append('<h2>Sozialwahl 2011 auf Facebook</h2>');
  var fblurl = String('http://www.facebook.com/sozialwahl2011');
  if(is_ie7) $('.fb_like').set_fblbox({'url': fblurl, 'width': '182','height': '290'});
  else $('.fb_like').set_fblbox({'url': fblurl, 'width': '182','height': '280'}); 
}


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* loaded events */
//addLoadEvent(check);
addLoadEvent(initiate_topteasercontent);
addLoadEvent(toggle_meinungen);
addLoadEvent(initFunctions);
addLoadEvent(mouseoverTeaser);
addLoadEvent(showMiniTeaserBrowser);
addLoadEvent(startSlider);
addLoadEvent(smNewsRoomLinks);
addLoadEvent(set_fb_likebox);
})(jQuery);
