var active_bullet = null;
var page_actions = {
	'page12': function() {
		$('#head_content').css( 'overflow', 'hidden' );
		$('.his a').lightBox();
		var i = 0;
   	$('.his').each( function() { $(this).attr( 'id', 'his' + i++ )  });
		c = i - 1;
		m = parseInt( $('#his' + c ).css( 'margin-right' ) );
		w = 40 +  ++c * (90 + m) - m; 
		$('#his' + c ).css( 'margin-right', '0px' );
		$('#historie ul').css( 'width', w );
		$('#historie').css( 'overflow', 'hidden' );
		$('#historie ul').css( 'overflow', 'hidden' );
		$('#historie').append( '<div class="slider"><div class="handle"></div><span class="slider-lbl1">1930</span><span class="slider-lbl3">1950</span><span class="slider-lbl4">1970</span><span class="slider-lbl5">1990</span><span class="slider-lbl6">2000</span></div>' );
  	
    var container = $('#historie');
    var ul = $('ul', container);
    
    var itemsWidth = ul.innerWidth() - container.outerWidth();

    $('.slider', container).slider({
        minValue: 0,
        maxValue: itemsWidth,
        handle: '.handle',
        stop: function (event, ui) {
            ul.animate({'left' : ui.value * -1}, 500);
        },
        slide: function (event, ui) {
            ul.css('left', ui.value * -1);
        }
    });

    $('.his').each( function() {
	  	$(this).css( 'opacity', 0.6 );
			$(this).mouseover( function() { $(this).css( 'opacity', 1.0 ) } );
			$(this).mouseout( function() { $(this).css( 'opacity', 0.6 ) } );
		} );
	},
	'page11': function()
	{
		m = $("#mood");
		m.append($('<img id="noticeme" src="/fileadmin/img/highlighter.gif" />'));
		n = $("#noticeme");
		n.css({
			  position: "absolute"
			, top: "146px"
			, left: "735px"
		});
		
		var blinki = setInterval(function(){
			n.css({left: "735px", opacity: 1});
			n.animate({
				  left: "710px"
				, opacity: 0
			}, 600);

		}, 2000);
		
		
		hq_id = 3;
		hq = $('#loc' + hq_id );
		if( !hq.length ) {
			hq_id = 44;
			hq = $('#loc' + hq_id );
		}

		$('.location' ).hide();
		hq.fadeIn();

		var active_id = hq_id;

		$('.bullet a').each( function() {
			
			$(this).attr( 'id', 'b' + $(this).attr( 'rel') );
			
			$(this).click( function() {
				rel = $(this).attr( 'rel' );
				if( active_id != rel ) {
					$('#b' + active_id ).children().attr( 'src', '/fileadmin/img/bullet.png' );
				}
				
				active_id = rel;
			
				$(this).children().attr( 'src', '/fileadmin/img/bullet_s.png' );
				$('.location' ).hide();
				$( '#loc' + rel ).fadeIn();
			});
			
			$(this).mouseover( function() { 
				$(this).children().attr( 'src', '/fileadmin/img/bullet_s.png' );
			} );
			
			$(this).mouseout( function() { 
				if( $(this).attr( 'rel' ) != active_id ) {
					$(this).children().attr( 'src', '/fileadmin/img/bullet.png' );				
				}
			} );          

			$(this).tooltip({ 
	    	track: false, 
	    	delay: 0, 
	    	showURL: false, 
	    	showBody: " - ", 
	    	opacity: 0.8,
	 			top: -23, 
	    	left: 3
			});     

			
		});
		
		$('#b' + hq_id ).children().attr( 'src', '/fileadmin/img/bullet_s.png' );
	},
	'page1': function()
	{
	
	$('#products').cycle({
		fx:       'scrollHorz' 
		, speed:    'fast' 
	    , timeout:  0 
	    , next:     '#carousel_next'
	    , prev:   '#carousel_prev' 
	    , easing:   'easeInOutSine'
	    , speed:    600
	    , timeout:  6000
	    , delay:    1000
	    , pause:    true
	    , cleartypeNoBg: true

	});
	}
}


$(document).ready(function(){ 
	bodyid = $(document.body).attr('id');
	if( page_actions[bodyid] ) {
		page_actions[bodyid]();
	}
	
	openPic = function(url, winName, winParams)
	{
		return false;
	}
	

	$('a[@href^=index.php?eID=tx_cms_showpic]').each( function() {
		href = $(this).attr( 'href' );
		img_src = unescape( href.split( '&' )[1].split( '=' )[1] );
		$(this).attr( 'href', img_src );
		$(this).lightBox();
 	} );
 	
});

