/*<![CDATA[*/
<!--

// JavaScript Document

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Default Funktionen vor Typo3 */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

function openPic(url,winName,winParams)	{	//
	var theWindow = window.open(url,winName,winParams);
	if (theWindow)	{theWindow.focus();}
}



var browserName=navigator.appName;var browserVer=parseInt(navigator.appVersion);var version="";var msie4=(browserName=="Microsoft Internet Explorer"&&browserVer>=4);if((browserName=="Netscape"&&browserVer>=3)||msie4||browserName=="Konqueror"||browserName=="Opera"){version="n3";}else{version="n2";}
function blurLink(theObject){if(msie4){theObject.blur();}}
function decryptCharcode(n,start,end,offset){n=n+offset;if(offset>0&&n>end){n=start+(n-end-1);}else if(offset<0&&n<start){n=end-(start-n-1);}
return String.fromCharCode(n);}
function decryptString(enc,offset){var dec="";var len=enc.length;for(var i=0;i<len;i++){var n=enc.charCodeAt(i);if(n>=0x2B&&n<=0x3A){dec+=decryptCharcode(n,0x2B,0x3A,offset);}else if(n>=0x40&&n<=0x5A){dec+=decryptCharcode(n,0x40,0x5A,offset);}else if(n>=0x61&&n<=0x7A){dec+=decryptCharcode(n,0x61,0x7A,offset);}else{dec+=enc.charAt(i);}}
return dec;}
function linkTo_UnCryptMailto(s){location.href=decryptString(s,-1);}




/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Style Switcher Scripte*/
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

function setActiveStyleSheet(group, title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && a.getAttribute("lang") == group) {
			a.disabled = true
			if(a.getAttribute("title") == title) {
				a.disabled = false;
			}
		}
	}
	// Loginframe mit ansprechen
	if(parent.frames.length == 1){
		
	}
}

function getActiveStyleSheet(group) {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    	if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled && a.getAttribute("lang") == group) return a.getAttribute("title");
  	}
	return null;
}

function getPreferredStyleSheet(group) {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	if(a.getAttribute("rel").indexOf("style") != -1
		&& a.getAttribute("rel").indexOf("alt") == -1
		&& a.getAttribute("title")
		&& a.getAttribute("lang") == group
	) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

window.onload = function(e) {
	var cookie_1 = readCookie("size");
	var title_1 = cookie_1 ? cookie_1 : getPreferredStyleSheet("size");
	setActiveStyleSheet(title_1);
	
	var cookie_2 = readCookie("colormode");
	var title_2 = cookie_2 ? cookie_2 : getPreferredStyleSheet("colormode");
	setActiveStyleSheet(title_2);
}

window.onunload = function(e) {
	var title_1 = getActiveStyleSheet("size");
	createCookie("size", title_1, 365);
	
	var title_2 = getActiveStyleSheet("colormode");
	createCookie("colormode", title_2, 365);
}

var cookie_1 = readCookie("size");
var title_1 = cookie_1 ? cookie_1 : getPreferredStyleSheet("size");
setActiveStyleSheet('size', title_1);

var cookie_2 = readCookie("colormode");
var title_2 = cookie_2 ? cookie_2 : getPreferredStyleSheet("colormode");
setActiveStyleSheet('colormode', title_2);




/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Autocomplete f�r Indizierte Suche */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

$(document).ready(function() {
	var ela = $("tx-indexedsearch-searchbox-sword-full");
	if (ela) {
		var forma = ela;
		for (var i=0;i<20;i++) {
			forma = forma.parent();
			if (forma.nodeName=="FORM") break;
		}
		var sectionpid = 0;
		var languageid = 0;
		var mediaid = -1;
		 $("#tx-indexedsearch-searchbox-sword-full").autocomplete({ 
		    serviceUrl:"index.php?eID=pmkisac&id=49&sp="+sectionpid+"&la="+languageid+"&me="+mediaid+"&sw=1&ml=3&mc=20&wc=1",
		    minChars:3, 
		    maxHeight:400,
			autoSubmit: 0,
			spinner: 1,
		    width:156,
			delimiter: " ",
		    // callback function:
		    onSelect: function(value, data){
		        //alert("You selected: " + value + ", " + data);
		    }
		});
	}
});
  
  
 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Autocomplete f�r Indizierte Suche - Nur im Bereich Institute*/
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

$(document).ready(function() {
	var elb = $("#tx-indexedsearch-searchbox-sword-advanced-inst");
	if (elb) {
		var formb = elb;
		for (var i=0;i<20;i++) {
			formb = formb.parent();
			if (formb.nodeName=="FORM") break;
		}
		var sectionpid = $("#tx_indexedsearch-sectionflag-inst").val();
		var languageid = 0;
		var mediaid = -1;

		 $("#tx-indexedsearch-searchbox-sword-advanced-inst").autocomplete({ 
		    serviceUrl:"index.php?eID=pmkisac&id=57&sp="+sectionpid+"&la="+languageid+"&me="+mediaid+"&sw=1&ml=3&mc=20&wc=1",
		    minChars:3, 
		    maxHeight:400,
			autoSubmit: 0,
			spinner: 1,
		    width:156,
			delimiter: " ",
		    // callback function:
		    onSelect: function(value, data){
		        //alert("You selected: " + value + ", " + data);
		    }
		});
	}
	
	var elb = $("#tx-indexedsearch-searchbox-sword-advanced-stud");
	if (elb) {
		var formb = elb;
		for (var i=0;i<20;i++) {
			formb = formb.parent();
			if (formb.nodeName=="FORM") break;
		}
		var sectionpid = $("#tx_indexedsearch-sectionflag-stud").val();
		var languageid = 0;
		var mediaid = -1;

		 $("#tx-indexedsearch-searchbox-sword-advanced-stud").autocomplete({ 
		    serviceUrl:"index.php?eID=pmkisac&id=57&sp="+sectionpid+"&la="+languageid+"&me="+mediaid+"&sw=1&ml=3&mc=20&wc=1",
		    minChars:3, 
		    maxHeight:400,
			autoSubmit: 0,
			spinner: 1,
		    width:156,
			delimiter: " ",
		    // callback function:
		    onSelect: function(value, data){
		        //alert("You selected: " + value + ", " + data);
		    }
		});
	}
});


/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* iChannel No flash aktivieren */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

$(document).ready(function() {	

	//if($('#ichannel-body')) {
	
		$('#panel').width(parseInt($('#mask').width() * $('#panel div').length+1));
		//Set the sub-panel width according to the #mask width (width of #mask and sub-panel must be same)
		$('#panel div').width($('#mask').width());
		
		//Get all the links with rel as panel
		$('a[rel=panel]').click(function () {
		
			//Set class for the selected item
			$('a[rel=panel]').removeClass('selected');
			
			//Set class for the next item
			$('a[rel=panel]').removeClass('next');
			
			$(this).addClass('selected');
			
			if($(this).next().length== 0){
				$('a[rel=panel]:first').addClass('next');
				//$('#panel div:first').insertAfter('#panel div:last');
			} else {
				$(this).next().addClass('next');
			}
			//$('#panel div:first').clone().insertAfter('#panel div:last')
			$('#mask').animate({queue:true, duration:50});	
			//console.log($(this).attr('href'));
			$('#mask').scrollTo($(this).attr('href'), 1500,{onAfter:function(){
				
			}});
		
			return false;
		});
		
		//interval
		window.setInterval("$('a.next[rel=panel]').click();", 7500);
	
	//};
});



/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Nes Callendar aus typo3conf/ext/newscalendar/res/class.newscalendar.js */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var newscalendar = {}


newscalendar.tipSetup = function(
	width,
	backgroundColor,
	borderColor,
	borderWidth,
	radius,
	padding,
	spikeLength,
	spikeGirth,
	shadow,
	shadowBlur,
	shadowOffsetX,
	shadowOffsetY,
	positions,
	fadeSpeed) {

	newscalendar.tip = {

		width : width,
		backgroundColor : backgroundColor,
		borderColor : borderColor,
		borderWidth : borderWidth,
		radius : radius,
		padding : padding,
		spikeLength : spikeLength,
		spikeGirth : spikeGirth,
		shadow: shadow,
		shadowBlur: shadowBlur,
		shadowOffsetX: shadowOffsetX,
		shadowOffsetY: shadowOffsetY,
		positions: positions,
		fadeSpeed : fadeSpeed
	}

}

newscalendar.addToolTipSelectorClass = function( element, className ) {
    jQuery( element ).addClass( className );
}

newscalendar.removeToolTipSelectorClass = function( element, className ) {
    jQuery( element ).removeClass( className );
}

newscalendar.processToolTip = function( toolTipID ) {

	try {

		jQuery( '#idMenu' + toolTipID ).bt({

			    shadow: newscalendar.tip.shadow,
			    shadowBlur: newscalendar.tip.shadowBlur,
			    shadowOffsetX: newscalendar.tip.shadowOffsetX,
			    shadowOffsetY: newscalendar.tip.shadowOffsetY,
				positions: newscalendar.tip.positions,
				cssClass: 'newscalendar-tip newscalendar-tip-id-' + toolTipID ,
				trigger : 'none',
				contentSelector : 'jQuery( "#toolTipIdMenu' + toolTipID + '").html()',
				padding: newscalendar.tip.padding,
				width: newscalendar.tip.width,
				spikeLength: newscalendar.tip.spikeLength,
				spikeGirth: newscalendar.tip.spikeGirth,
				cornerRadius: newscalendar.tip.radius,
				fill: newscalendar.tip.backgroundColor,
				strokeWidth: newscalendar.tip.borderWidth,
				strokeStyle: newscalendar.tip.borderColor,
				showTip: function(box){
					jQuery(box).fadeIn(newscalendar.tip.fadeSpeed);
				},
				hideTip: function(box, callback){
					callback();
				},
				shrinkToFit: true,
				hoverIntentOpts: {
					interval: 0,
					timeout: 0
				}

		});

		jQuery( '#idMenu' + toolTipID ).mouseover( function( event ) {

			event.preventDefault();
			var currentSelectStarter = this;
			newscalendar.addToolTipSelectorClass( currentSelectStarter, 'newscalendar-tip-selector' );


			jQuery( '#idMenu' + toolTipID ).btOn();

			jQuery( '.newscalendar-tip-id-' + toolTipID ).bind( 'mouseleave', function( event ) {

				event.preventDefault();
				jQuery( '#idMenu' + toolTipID ).btOff();
				newscalendar.removeToolTipSelectorClass( currentSelectStarter, 'newscalendar-tip-selector' );

			});

			jQuery( '#idMenu' + toolTipID ).mouseout( function( event ) {

				event.preventDefault();

				var checkTo = 'not_defined';
				if ( typeof event.toElement !== "undefined" ) {
				    checkTo = event.toElement.tagName ;
				}  else if ( typeof event.relatedTarget !== "undefined" ) {
				    checkTo = event.relatedTarget.localName;
				}

				try {
				    if ( checkTo !== 'canvas' && checkTo !== 'CANVAS' &&  checkTo !== 'shape' ) {

					jQuery( '#idMenu' + toolTipID ).btOff();
					newscalendar.removeToolTipSelectorClass( currentSelectStarter, 'newscalendar-tip-selector' );

				    }
				} catch(e) {}

			} );


		} );

	} catch( e ) {}
}



/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Prety Foto Aktivieren */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({
			theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			slideshow: 5000 ,/* false OR interval time in ms */
			keyboard_shortcuts: true,
			overlay_gallery: false
	});
});



/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* Widget Rahmen Video - Bilder mit Playsymbol versehen */
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

$(document).ready(function(){
		$(".csc-frame-widget-video a[rel^='prettyPhoto'] img").wrap('<div class="image-width-play-button" style="width:' + $(".csc-frame-widget-video a[rel^='prettyPhoto'] img").width() +'px; height:'+ $(".csc-frame-widget-video a[rel^='prettyPhoto'] img").height() + 'px;" />');
		$('<div class="video-play-button" style="width:' + $(".csc-frame-widget-video a[rel^='prettyPhoto'] img").width() +'px; height:'+ $(".csc-frame-widget-video a[rel^='prettyPhoto'] img").height() + 'px;"><!-- --></div>').insertAfter($(".csc-frame-widget-video a[rel^='prettyPhoto'] img"));		
						   
});

// Akkordion Elemente
jQuery(document).ready( function() {
	$('.csc-accordion-element .csc-accordion-teaser').click( function() {
		$(this).toggleClass('csc-accordion-teaser-selected');
		$(this).next('.csc-accordion-content').toggle('slow');
                return false;
	}).next().hide();
        // Letztes Element mit Zusatzklasse versehen
	$(".csc-accordion-element:last").addClass("csc-accordion-element-last");
	
});

// -->
/*]]>*/

