



function startAccordion(step){

	$(".accordion").accordion({
		autoHeight: false,
		active: step-1
		//header: '.head',
		//navigation: true,
		//event: 'click',
		//animated: 'easeslide'
		//autoheight: true
	});

}


//Mythos/Portrait Sonderfall Menu
function sonderFunction(){
	activeHead = $('.accordion a.ui-state-active');
	$(activeHead).removeClass('ui-state-active');

	$('a.head').click(function(){
		$(activeHead).removeClass('ui-state-active');
		$('.accordion a.head').css('color','#D7D6CD');
		$(this).css('color','#DA2511')
	});
	
	
	$('.navPartTop a').click(function(){
		$(activeHead).removeClass('ui-state-active');
		$('.accordion a.head').css('color','#D7D6CD');
	});


	$('.slideBox a.zitat').click(function(){
		zitat = $(this).attr('rel');
		$('.accordion #'+zitat+'').addClass('ui-state-active');
		activeHead = $('.accordion a.ui-state-active');
	});


}



//Standards Menu
function standardsFunction(){
	activeHead = $('.accordion a.ui-state-active');
	//$(activeHead).removeClass('ui-state-active');

	$('a.head').click(function(){
		$(activeHead).removeClass('ui-state-active');
		$('.accordion a.head').css('color','#D7D6CD');
		$(this).css('color','#DA2511');
	});
	
}




// Mythos/Einfluesse
var slideMenu=function(){
	var sp,st,t,m,sa,l,w,sw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
		},
		timer:function(s){s.onclick=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t); return false}},
		slide:function(s){
			try{var cw=parseInt(s.style.width,'10')} catch(err){};
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
						owt=owt+(ow-oi)}}
				s.style.width=(w-owt)+'px';
			}else{clearInterval(m.timer)}
		}
	};
}();




//Mythos/Stationen
function initRollover(){

	var activeImg =  jQuery(".accordion_typ6 div.pic a.active");

	jQuery('.accordion_typ6 div.pic a').hover(function() {
		jQuery(this).addClass('active');
    
		}, function() {
			if(this == activeImg || jQuery(this).attr('href') == jQuery(activeImg).attr('href')  ) {
				return false;
			}
			jQuery(this).removeClass('active');
	});
	jQuery('.accordion_typ6 div.pic a').click(function() {
		jQuery('.accordion_typ6 div.pic a').removeClass('active');
		jQuery(this).addClass('active');
		activeImg = this;
	});
	jQuery('.accordion_typ6 a.head').click(function() {
		jQuery('.accordion_typ6 div.pic a').removeClass('active');
		var firstPic = jQuery(this).next().find('.firstPic');
		jQuery(firstPic).addClass('active');
		activeImg = firstPic;
	});

}



// Rollen/Einfluesse
function initPlayStop(){

	//var activeLi 	=  jQuery('.accordion').children('li:first-child').children('ul').children('li:first-child');

	var activeLi 	=  '';
	
	jQuery('.accordion_typ1 div.left a').click(function() {
		parentObj = jQuery(this).parent().parent();
		jQuery('.accordion_typ1 li').removeClass('active');
		activeLi = parentObj;
		jQuery(activeLi).addClass('active');
	});
	jQuery('.accordion_typ1 a.head').click(function() {
		jQuery('.accordion_typ1 li').removeClass('active');
		var firstLi = jQuery(this).next().children('li:first-child');
		jQuery(firstLi).addClass('active');
		activeLi = firstLi;
	});
}



// Hauptdarsteller/Videos
function initContainerLink(){
	
	var activeLi 	=  '';

	jQuery('.accordion_typ3 a').click(function() {
		parentObj = jQuery(this).parent();
		jQuery('.accordion_typ3 li').removeClass('active');
		activeLi = parentObj;
		jQuery(activeLi).addClass('active');
	});
	jQuery('.accordion a.head').click(function() {
		jQuery('.accordion_typ1 li').removeClass('active');
		var firstLi = jQuery(this).next().children('li:first-child');
		jQuery(firstLi).addClass('active');
		activeLi = firstLi;
	});

}





// Portrait TextSlide

actObj = '';

function slider() {
	obj 	= $(actObj).children();
	faktor	= 5;
	fenster = 700;
	
	if($(obj).parent().attr('class') == 'zitatDetailImg') {
		fenster = 592;
	}
	
	objWidth=obj.width();
	actPos	= parseInt($(obj).css('left'));
	newPos	= actPos-faktor;
	
	if(newPos < -(objWidth-fenster)) {
		newPos	= 0;
	}
	
	$(obj).css('left',newPos+'px');
}

var timer ='';

function startTimer() {
	timer = setInterval('slider()', 20);
}

function initTypos() {
	jQuery('.slideBox .zitatDiv').hover(function() {
		src = $(this).children().find('img').attr('src').replace(/_lo/g,'_hi');
		$(this).children().find('img').attr('src',src)

		actObj = $(this);
		startTimer();
		
	}, function() {
		clearInterval(timer);
		src = $(this).children().find('img').attr('src').replace(/_hi/g,'_lo');
		$(this).children().find('img').attr('src',src)
	});
}





//Portraits Detail
function initTyposDetail() {
	
	if(timer) {
		clearInterval(timer);
	}

	actObj = $(jQuery('.zitatDetailImg'));
	startTimer();

	jQuery('.zitatDetailImg').hover(function() {

		actObj = $(this);
		clearInterval(timer);

		$('.zitatDetailText').animate({
			opacity: 'show'
		}, 200);
		$('.zitatDetailImg').animate({
			opacity: 'hide'
		}, 200);
		
		
	}, function() {
		clearInterval(timer);
	});

	jQuery('.zitatDetailText').hover(function() {
		
		
	}, function() {
		$('.zitatDetailText').animate({
			opacity: 'hide'
		}, 200);
		$('.zitatDetailImg').animate({
			opacity: 'show'
		}, 200);
		clearInterval(timer);
		startTimer();
	});


}







// Portrait Folgeseite ( js/lib/marquee.js gibt es anpassungen )
function initMarqueeNew(){

	// basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras
	$('.zitatNew').marquee('zitatNew').mouseover(function () {
		$(this).trigger('stop');
	}).mouseout(function () {
		$(this).trigger('start');
	}).mousemove(function (event) {
		if ($(this).data('drag') == true) {
			this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
		}
	}).mousedown(function (event) {
		$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
	}).mouseup(function () {
		$(this).data('drag', false);
	});

}



function initMarqueeIndex(){
	
	$('marquee').marquee('pointer').mouseover(function () {
		$(this).trigger('start');
	}).mouseout(function () {
		$(this).trigger('stop');
	}).mousemove(function (event) {
		if ($(this).data('drag') == true) {
			this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
		}
	}).mousedown(function (event) {
		$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
	}).mouseup(function () {
		$(this).data('drag', false);
	});

}




function initExternalLink() {
	
	h1_line = jQuery('.mainRightStandards h1').html();
			
	if( h1_line.match(/Kontakt/gi) ) {
		jQuery('.accordion a.Kontakt').click();
	}
	else if( h1_line.match(/Impressum/gi) ) {
		jQuery('.accordion a.Impressum').click();
	}
	else if( h1_line.match(/Credits/gi) ) {
		jQuery('.accordion a.Credits').click();
	}
	else if( h1_line.match(/Links/gi) ) {
		jQuery('.accordion a.Links').click();
	}

}






jQuery(document).ready(function() {
	        


});
