jQuery(document).ready(function() {
    if(typeof jQuery('.mycarousel').get(0) != 'undefined' && typeof jQuery('.mycarousel').jcarousel != 'undefined')
    {
    	$('.mycarousel').jcarousel();
    }
    
    if (typeof $('ul#subnavi').get(0) != 'undefined')
    {
		$('ul#subnavi').superfish();
    }
		  
    $('#comment').keyup(function(){
    limitChars('comment', 1650, 'charlimitinfo');
    })
    
    //for picture and video page - servicearea
    $('#service_media .scroll-pane-cont').hide();
    $('#service_media .scroll-pane-cont:first').show();
    $('#service_media .showTickercontent').click(function(e){
    	e.preventDefault();
    	$('#service_media .showTickercontent').parent('li').removeClass('active');
    	$(this).parent('li').addClass('active');
    	$('#service_media .scroll-pane-cont').hide();
    	$(this.hash).show();
    	$('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
    })
    
    $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
    
    //for sonderthema
    $('.themen_content').hide();
    $('.themen_content:first').show();    
    $('.themen_head a:first').addClass('active');
    $('.themen_head a').click(function(e){
     	$('.themen_content').hide();
     	$('.themen_head a').removeClass('active');
     	$(this).addClass('active');
     	$(this.hash).show();
     	e.preventDefault();
     
    });

});
//Cufon.replace('.headzusatz');
//Cufon.replace('.ganzunten h2');

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function weatherSwap(id, clickedLinkElement)
{
	var clickedLinkElement = $(clickedLinkElement);
	clickedLinkElement.parent().find('a').css('font-weight', 'normal');
	clickedLinkElement.css('font-weight', 'bold');
	if(id == 'heute')
	{
		$('div#morgen').hide();
		$('div#heute').show();
	}	
	else
	{
		$('div#morgen').show();
		$('div#heute').hide();
	}
}

function ratingSwap(id, clickedLinkElement )
{
	//var clickedLinkElement = $(clickedLinkElement);
	//clickedLinkElement.parent().find('a').css('font-weight', 'normal');
	//clickedLinkElement.css('font-weight', 'bold');
	if(id == 'beforeVote')
	{
		$('div#beforeVote').hide();
		$('div#afterVote').show();
		$('div.before').hide();		
		$('div.after').show();
		
	}
	else
	{
		$('div#beforeVote').show();
		$('div#afterVote').hide();
		$('div.before').show();
		$('div.after').hide();
	}
}


// Setzen eines Cookies ueber JavaScript
// Verwendung in epaper
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}
