var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='/images/platzhalter_flashvideo.jpg';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}



/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
            
           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);

/**
 * jQuery.ScrollTo
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 2/19/2008
 *
 * @projectDescription Easy element scrolling using jQuery.
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 * Tested with jQuery 1.2.1. On FF 2.0.0.11, IE 6, Opera 9.22 and Safari 3 beta. on Windows.
 *
 * @author Ariel Flesler
 * @version 1.3.3
 *
 * @id jQuery.scrollTo
 * @id jQuery.fn.scrollTo
 * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
 *	  The different options for target are:
 *		- A number position (will be applied to all axes).
 *		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
 *		- A jQuery/DOM element ( logically, child of the element to scroll )
 *		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
 *		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
 * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
 * @param {Object} settings Hash of settings, optional.
 *	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
 *	 @option {Number} duration The OVERALL length of the animation.
 *	 @option {String} easing The easing method for the animation.
 *	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
 *	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
 *	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
 *	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
 *	 @option {Function} onAfter Function to be called after the scrolling ends. 
 *	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
 * @return {jQuery} Returns the same jQuery object, for chaining.
 *
 * @example $('div').scrollTo( 340 );
 *
 * @example $('div').scrollTo( '+=340px', { axis:'y' } );
 *
 * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
 *
 * @example var second_child = document.getElementById('container').firstChild.nextSibling;
 *			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
 *				alert('scrolled!!');																   
 *			}});
 *
 * @example $('div').scrollTo( { top: 300, left:'+=200' }, { offset:-20 } );
 *
 * Notes:
 *  - jQuery.scrollTo will make the whole window scroll, it accepts the same arguments as jQuery.fn.scrollTo.
 *	- If you are interested in animated anchor navigation, check http://jquery.com/plugins/project/LocalScroll.
 *	- The options margin, offset and over are ignored, if the target is not a jQuery object or a DOM element.
 *	- The option 'queue' won't be taken into account, if only 1 axis is given.
 */
(function( $ ){

	var $scrollTo = $.scrollTo = function( target, duration, settings ){
		$scrollTo.window().scrollTo( target, duration, settings );
	};

	$scrollTo.defaults = {
		axis:'y',
		duration:1
	};

	//returns the element that needs to be animated to scroll the window
	$scrollTo.window = function(){
		return $( $.browser.safari ? 'body' : 'html' );
	};

	$.fn.scrollTo = function( target, duration, settings ){
		if( typeof duration == 'object' ){
			settings = duration;
			duration = 0;
		}
		settings = $.extend( {}, $scrollTo.defaults, settings );
		duration = duration || settings.speed || settings.duration;//speed is still recognized for backwards compatibility
		settings.queue = settings.queue && settings.axis.length > 1;//make sure the settings are given right
		if( settings.queue )
			duration /= 2; 
			//let's keep the overall speed, the same.
		settings.offset = both( settings.offset );
		settings.over = both( settings.over );

		return this.each(function(){
			var elem = this, $elem = $(elem),
				t = target, toff, attr = {},
				win = $elem.is('html,body');
			switch( typeof t ){
				case 'number'://will pass the regex
				case 'string':
					if( /^([+-]=)?\d+(px)?$/.test(t) ){
						t = both( t );
						break;//we are done
					}
					t = $(t,this);// relative selector, no break!
				case 'object':
					if( t.is || t.style )//DOM/jQuery
						toff = (t = $(t)).offset();//get the real position of the target 
			}
			$.each( settings.axis.split(''), function( i, axis ){
				var Pos	= axis == 'x' ? 'Left' : 'Top',
					pos = Pos.toLowerCase(),
					key = 'scroll' + Pos,
					act = elem[key],
					Dim = axis == 'x' ? 'Width' : 'Height',
					dim = Dim.toLowerCase();

				if( toff ){//jQuery/DOM
					attr[key] = toff[pos] + ( win ? 0 : act - $elem.offset()[pos] );

					if( settings.margin ){//if it's a dom element, reduce the margin
						attr[key] -= parseInt(t.css('margin'+Pos)) || 0;
						attr[key] -= parseInt(t.css('border'+Pos+'Width')) || 0;
					}
					
					attr[key] += settings.offset[pos] || 0;//add/deduct the offset
					
					if( settings.over[pos] )//scroll to a fraction of its width/height
						attr[key] += t[dim]() * settings.over[pos];
				}else
					attr[key] = t[pos];//remove the unnecesary 'px'

				if( /^\d+$/.test(attr[key]) )//number or 'number'
					attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );//check the limits

				if( !i && settings.queue ){//queueing each axis is required					
					if( act != attr[key] )//don't waste time animating, if there's no need.
						animate( settings.onAfterFirst );//intermediate animation
					delete attr[key];//don't animate this axis again in the next iteration.
				}
			});			
			animate( settings.onAfter );			

			function animate( callback ){
				$elem.animate( attr, duration, settings.easing, callback && function(){
					callback.call(this, target);
				});
			};
			function max( Dim ){
				var el = win ? $.browser.opera ? document.body : document.documentElement : elem;
				return el['scroll'+Dim] - el['client'+Dim];
			};
		});
	};

	function both( val ){
		return typeof val == 'object' ? val : { top:val, left:val };
	};

/**
 * jQuery.serialScroll
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/20/2008
 *
 * @projectDescription Animated scrolling of series.
 * @author Ariel Flesler
 * @version 1.2.1
 *
 * @id jQuery.serialScroll
 * @id jQuery.fn.serialScroll
 * @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required.
 * @return {jQuery} Returns the same jQuery object, for chaining.
 *
 * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
 *
 * Notes:
 *	- The plugin requires jQuery.ScrollTo.
 *	- The hash of settings, is passed to jQuery.ScrollTo, so its settings can be used as well.
 */

	var $serialScroll = $.serialScroll = function( settings ){
		$.scrollTo.window().serialScroll( settings );
	};

	//Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option.
	//@see http://flesler.webs/jQuery.ScrollTo/
	$serialScroll.defaults = {//the defaults are public and can be overriden.
		duration:1000, //how long to animate.
		axis:'x', //which of top and left should be scrolled
		event:'click', //on which event to react.
		start:0, //first element (zero-based index)
		step:1, //how many elements to scroll on each action
		lock:true,//ignore events if already animating
		cycle:true, //cycle endlessly ( constant velocity )
		constant:true //use contant speed ?
		/*
		navigation:null,//if specified, it's a selector a collection of items to navigate the container
		target:null, //if specified, it's a selector to the element to be scrolled.
		interval:0, //it's the number of milliseconds to automatically go to the next
		lazy:false,//go find the elements each time (allows AJAX or JS content, or reordering)
		stop:false, //stop any previous animations to avoid queueing
		force:false,//force the scroll to the first element on start ?
		jump: false,//if true, when the event is triggered on an element, the pane scrolls to it
		items:null, //selector to the items (relative to the matched elements)
		prev:null, //selector to the 'prev' button
		next:null, //selector to the 'next' button
		onBefore: function(){}, //function called before scrolling, if it returns false, the event is ignored
		exclude:0 //exclude the last x elements, so we cannot scroll past the end
		*/
	};

	$.fn.serialScroll = function( settings ){
		settings = $.extend( {}, $serialScroll.defaults, settings );
		var event = settings.event, //this one is just to get shorter code when compressed
			step = settings.step, // idem
			lazy = settings.lazy;//idem

		return this.each(function(){
			var 
				context = settings.target ? this : document, //if a target is specified, then everything's relative to 'this'.
				$pane = $(settings.target || this, context),//the element to be scrolled (will carry all the events)
				pane = $pane[0], //will be reused, save it into a variable
				items = settings.items, //will hold a lazy list of elements
				active = settings.start, //active index
				auto = settings.interval, //boolean, do auto or not
				nav = settings.navigation, //save it now to make the code shorter
				timer; //holds the interval id

			if( !lazy )//if not lazy, go get the items now
				items = getItems();

			if( settings.force )
				jump( {}, active );//generate an initial call

			// Button binding, optionall
			$(settings.prev||[], context).bind( event, -step, move );
			$(settings.next||[], context).bind( event, step, move );

			// Custom events bound to the container
			if( !pane.ssbound )//don't bind more than once
				$pane
					.bind('prev.serialScroll', -step, move ) //you can trigger with just 'prev'
					.bind('next.serialScroll', step, move ) //for example: $(container).trigger('next');
					.bind('goto.serialScroll', jump ); //for example: $(container).trigger('goto', [4] );
			if( auto )
				$pane
					.bind('start.serialScroll', function(e){
						if( !auto ){
							clear();
							auto = true;
							next();
						}
					 })
					.bind('stop.serialScroll', function(){//stop a current animation
						clear();
						auto = false;
					});
			$pane.bind('notify.serialScroll', function(e, elem){//let serialScroll know that the index changed externally
				var i = index(elem);
				if( i > -1 )
					active = i;
			});
			pane.ssbound = true;//avoid many bindings

			if( settings.jump )//can't use jump if using lazy items and a non-bubbling event
				(lazy ? $pane : getItems()).bind( event, function( e ){
					jump( e, index(e.target) );
				});

			if( nav )
				nav = $(nav, context).bind(event, function( e ){
					e.data = Math.round(getItems().length / nav.length) * nav.index(this);
					jump( e, this );
				});

			function move( e ){
				e.data += active;
				jump( e, this );
			};
			function jump( e, button ){
				if( !isNaN(button) ){//initial or special call from the outside $(container).trigger('goto',[index]);
					e.data = button;
					button = pane;
				}

				var
					pos = e.data, n,
					real = e.type, //is a real event triggering ?
					$items = settings.exclude ? getItems().slice(0,-settings.exclude) : getItems(),//handle a possible exclude
					limit = $items.length,
					elem = $items[pos],
					duration = settings.duration;

				if( real )//real event object
					e.preventDefault();

				if( auto ){
					clear();//clear any possible automatic scrolling.
					timer = setTimeout( next, settings.interval ); 
				}

				if( !elem ){ //exceeded the limits
					n = pos < 0 ? 0 : limit - 1;
					if( active != n )//we exceeded for the first time
						pos = n;
					else if( !settings.cycle )//this is a bad case
						return;
					else
						pos = limit - n - 1;//invert, go to the other side
					elem = $items[pos];
				}

				if( !elem || real && active == pos || //could happen, save some CPU cycles in vain
					settings.lock && $pane.is(':animated') || //no animations while busy
					real && settings.onBefore && //callback returns false ?
					settings.onBefore.call(button, e, elem, $pane, getItems(), pos) === false ) return;

				if( settings.stop )
					$pane.queue('fx',[]).stop();//remove all its animations

				if( settings.constant )
					duration = Math.abs(duration/step * (active - pos ));//keep constant velocity

				$pane
					.scrollTo( elem, duration, settings )//do scroll
					.trigger('notify.serialScroll',[pos]);//in case serialScroll was called on this elem more than once.
			};
			function next(){//I'll use the namespace to avoid conflicts
				$pane.trigger('next.serialScroll');
			};
			function clear(){
				clearTimeout(timer);
			};
			function getItems(){
				return $( items, pane );
			};
			function index( elem ){
				if( !isNaN(elem) ) return elem;//number
				var $items = getItems(), i;
				while(( i = $items.index(elem)) == -1 && elem != pane )//see if it matches or one of its ancestors
					elem = elem.parentNode;
				return i;
			};
		});
	};

})( jQuery );



	
	//$("a.btn-prev").click(function(){
								   
			//$('ul.boxes', boxContainer).slider("moveTo","-250px");
			//$('ul.boxes').animate({"left": "+=158px"}, "slow");
			//$('.box-slider-handle').animate({"left": "-=3px"}, "slow");
			
	//});
	
	//$("a.btn-next").click(function(){
				
		//	$('ul.boxes', boxContainer).slider("moveTo","-250px");
			//$('ul.boxes').animate({"left": "-=158px"}, "slow");
			//$('.box-slider-handle').animate({"left": "+=3px"}, "slow");
//	});
	 
$(document).ready(function () {
							
/***************************************
*
*		jquery - Start
*
*/
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -10;
		yOffset = 10;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */
$("a, abbr").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(200);
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a, abbr").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
});
};

//easing equation, borrowed from jQuery easing plugin
//http://gsgd.co.uk/sandbox/jquery/easing/
//$.easing.easeOutQuart = function (x, t, b, c, d) {
//	return -c * ((t=t/d-1)*t*t*t - 1) + b;
//};

	/**
	 * Most jQuery.serialScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.webs.com/jQuery.ScrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.serialScroll.
	 *
	 * IMPORTANT: this call to the plugin specifies ALL the settings (plus some of jQuery.ScrollTo)
	 * This is done so you can see them. You DON'T need to specify them all.
	 * A 'target' is specified, that means that #screen is the context for target, prev, next and navigation.
	 */
	var projektelem = $('#projekt-slideshow ul');
	var projektcount = projektelem.find('li').length;
	projektelem.css('width', (projektcount * 400));
		
	projektelem.css("width", $("div#projekt-slideshow ul").innerWidth());
		
	$('.projekt-gallery').serialScroll({
		target:'#projekt-slideshow',
		items:'li', //selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'a.btn-last-projects',
		next:'a.btn-next-projects',
		offset:-400,
		axis:'x',//the default is 'y'
		queue:false,//we scroll on both axes, scroll both at the same time.
		event:'click',//on which event to react (click is the default, you probably won't need to specify it)
		stop:false,//each click will stop any previous animations of the target. (false by default)
		lock:true, //ignore events if already animating (true by default)
		duration:900,//length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		start: 0, //on which element (index) to begin ( 0 is the default, redundant in this case )
		force:false, //force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		cycle:true,//cycle endlessly ( constant velocity, true is the default )
		step:1, //how many items to scroll each time ( 1 is the default, no need to specify )
		jump:false, //if true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		lazy:false,//(default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		interval:false, //it's the number of milliseconds to automatically go to the next
		constant:false,
		onBefore:function( e, elem, $pane, $items, pos ){
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//'this' is the element being scrolled ($pane) not jqueryfied
		}
	});
	

});

/*
*	Jquery - Start
*/

$(document).ready(function() {

$("#middle .box-product:last").css("margin", "0 0 40px 0");
/*
*	Mainmenu 
*/
$("ul.menu li a").append("<span><!-- --></span>");
$("ul.menu li a span").hide();

$("ul.menu li a").hover(function(){ 
  $(this).find("span").fadeIn("slow")
	},function(){ 
  $(this).find("span").fadeOut("slow")
});
/*
*	Footermenu 
*/
$("div.produkte dl dt").hover(function(){ 
  $(this).fadeTo("slow", 1)
	},function(){ 
  $(this).fadeTo("slow", 0.75)
});
/*
*	Footermenu 
*/
$("ul.footermenu li a").hover(function(){ 
  $(this).animate({color: "#ffffff"}, {queue:false,duration:500});
	},function(){ 
  $(this).animate({color: "#666666"}, {queue:false,duration:500});
});
/*
*	Unternehmen - Team & Office
*/

$('div.team-trouper a.hover').css({opacity:0});
$("div.team-trouper a.hover").hover( 
      function () { 
        $(this).andSelf().fadeTo("slow", 0.75); 
      },  
      function () { 
        $(this).andSelf().fadeTo("fast", 0); 
      } 
    ); 
  
$("#news-slider .ui-slider-handle").css('opacity',0.3);
$("#news-slider .ui-slider-handle").css('margin-left','-10px');
$("#news-slider").slider();

/*
*	Projekt Vorschau - Reflection
*/

$('.projekt-preview img').reflect({height: 0.1, opacity: 0.3});

/*
* 	Slide2Top
*/

$("div#toplink strong").click(function(){
  var h = $("body").height();
 $('html, body').animate({scrollTop:0}, 'slow');
}); 


/*
*	Header - Show/Hide
*/

$("#openClose").hide();
$("#animate").click(function() {
	if ($("#openClose").is(":hidden")) {	
		$("#openClose").show();
		$("#innerheader").animate({	height: "0"}, 500 );	
		$("#layout").animate({ paddingBottom: "124px"	}, 100 ).removeClass("open").addClass("close");
		$(document).css({height: "100%", width: "100%"});
	
	} else {
		$("#openClose").hide();
		$("#innerheader").animate({	height: "138px"}, 500 );
		$("#layout").animate({	paddingBottom: "138px" }, 300 ).removeClass("close").addClass("open");
		$(document).css({height: "100%", width: "100%"});
	}
});
/*
$("#animate").click(function(){
	  $("#innerheader").slideToggle("slow");
	  $(this).toggleClass("active");
});


$('#openClose').hide();

$('#animate').click(function(){
		$(this).hide();
		$("#openClose").show();
		$("#innerheader").animate({	height: "1px"	}, 500 );
		$("#layout").animate({ paddingBottom: "124px"	}, 100 ).removeClass("open").addClass("close");
		$.cookie('hide', '.view-header-latest', {expires:365});
		$.cookie('show', null);
		return false;
});

var hide = $.cookie('hide');
if (hide) {
		$('a.hide').hide();
		$('a.show').show();
		$('h2.title').hide();
};

$('#animate').click(function(){
		$(this).hide();
		$("#openClose").hide();
		$("#innerheader").animate({	height: "138px"}, 500 );
		$("#layout").animate({	paddingBottom: "138px" }, 300 ).removeClass("close").addClass("open");
		$.cookie('show', '.view-header-latest', {expires:365});
		$.cookie('hide', null);
		return false;
});

var show = $.cookie('show');
if (show) {
		$('h2.title').show();
		$('.view-header-latest').show();
};
*/

/*
$("li._input_2008").click(function () {
      $("secred-timeline-content").animate({left: "-3072px"}),
      $("div.ui-slider-handle").animate({left: "15%"});
}); 
$("li._input_2007").click(function () {
      $("secred-timeline-content").animate({left: "-6144px"}),
      $("div.ui-slider-handle").animate({left: "15%"});
}); 
*/
/*
*	accordionv - Projektuebersicht
*/
$('dl.accordion').accordion({ 
    event: 'click', 
    active: '.selected', 
	duration: 1500, 
    selectedClass: 'active', 
	autoHeight: false,
	collapsible: true,
    header: "dt" 
});

$('dl.accordionv2').accordion({ 
    event: 'click', 
	duration: 1000, 
    active: '.selected', 
    selectedClass: 'active', 
	autoHeight: false,
	collapsible: true,
    header: "dt" 
}).accordion("activate", "dt:first").bind("change.ui-accordion", function(event, ui) { 
    $('<div>' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown</div>'); 
});

$('dl.accordionv3').accordion({ 
    event: 'click', 
	duration: 1000, 
    active: '.selected', 
    selectedClass: 'active', 
	autoHeight: false,
	collapsible: true,
    header: "dt" 
});

/*
*	Product-Select Input
*/
$('#productselect').selectbox({  
	inputClass: 'selectbox', 
	containerClass: 'selectbox-wrapper', 
	hoverClass: 'current', 
	currentClass: 'selected', 
	debug: false 
});  
/*
*	Kontaktformular - Select
*/
$('select.anliegen').selectbox({  
	inputClass: 'selectbox-v2', 
	containerClass: 'selectbox-wrapper-v2', 
	hoverClass: 'current', 
	currentClass: 'selected', 
	debug: false 
});  

/*
*	Aktuelles - Zeitstahl - Select
*/
$('select.aktuelles-jahr').selectbox({  
	inputClass: 'selectbox-v3', 
	containerClass: 'selectbox-wrapper-v3', 
	hoverClass: 'current', 
	currentClass: 'selected', 
	debug: false 
});  

/*
*	Multiselect - Startseite - Produkte
*/

$("select.branchenselect").multiSelect( { hideWhenClicked:false , noneSelected: 'Branchen selektieren' , oneOrMoreSelected: 'Branchen selektieren' , selectAllText: 'Alle Branchen' } ,
										function(el) {
	updateProjectBranche( $(el).val() );
										} );
$("select.bereichselect").multiSelect({ hideWhenClicked:false , noneSelected: 'Bereiche selektieren' , oneOrMoreSelected: 'Bereiche selektieren' , selectAllText: 'Alle Bereiche' },
										function(el) {
	updateProjectBereich( $(el).val() );
										} );


  /*
   *	Timeline - Zeitstahl
   */
	var timelineelem = $('.secred-timeline-content');
	var monthcount = ( timelineelem.find('div.timeline-year').length - 1 ) * 12;
	var monthcount_actyear = timelineelem.find('div.timeline-year').eq(0).find('div.timeline-monat').length;
	monthcount += monthcount_actyear;
	timelineelem.css('width', (monthcount * 256));

//	breite vom ersten jahresdiv anpassen 
	timelineelem.find('div.timeline-year').eq(0).css("width" , (monthcount_actyear * 256) );

	timelineelem.css("width", $("div.secred-timeline-content").innerWidth());

	$("#timeline_slider").slider({
		handle: ".timeline-slider-handle",
		value: 0,
		min: 0,
		max: (monthcount * 256),
		step: 256,
		change: function( event , ui ) {
		$("div.secred-timeline div.innertimeline").animate({scrollLeft: ui.value} , "slow" );
	}
	});


	$("a.btn-prev-timeline").click(function(){
		var val_slider = $("#timeline_slider").slider( "value" );
		if ( val_slider >= 256 ) {
			$("#timeline_slider").slider( "value" , ( val_slider - 256 ) );
		}
	});

	$("a.btn-next-timeline").click(function(){
		var val_slider = $("#timeline_slider").slider( "value" );
		if ( val_slider < (monthcount * 256) ) {
			$("#timeline_slider").slider( "value" , ( val_slider + 256 ) );
		}
	});

	$('div.timeline-entry').bind('click',function(){
		$('div.timeline-entry').removeClass('active');
		$(this).toggleClass('active');
		return false;
	});


  /*
   *	Timeline - Boxen
   */
  var elem = $('ul.boxes');
  var count = elem.find('li').length;
  elem.css('width', (count * 157));

  elem.css("width", $("ul.boxes").innerWidth());

  $("#box_slider").slider({
	  handle: ".box-slider-handle",
	  value: 0,
	  min: 0,
	  max: (count * 157),
	  step: 157,
	  change: function( event , ui ) {
	  $("div.secred-boxtimeline div.innertimeline").animate({scrollLeft: ui.value} , "slow" );
  }
  });

  $("a.btn-prev-box").click(function(){
	  var box_slider = $("#box_slider").slider( "value" );
	  if ( box_slider >= 157 ) {
		  $("#box_slider").slider( "value" , ( box_slider - 157 ) );
	  }
  });

  $("a.btn-next-box").click(function(){
	  var box_slider = $("#box_slider").slider( "value" );
	  if ( box_slider < (count * 157) ) {
		  $("#box_slider").slider( "value" , ( box_slider + 157 ) );
	  }
  });

  $('ul.boxes').find('li').bind('click',function(){
	  $('ul.boxes').find('li').removeClass('active');
	  $(this).toggleClass('active');
	  return false;
  });
	
  /*
   *	Jquery Close
   */
});
