$(document.body).ready(function() {
	$('body').removeClass('no-js').addClass('js');
});

(function() {
	jQuery.fn.extend( {
		placehold : function() {
			var $query = this; // this is a current jQuery selection

			var placeholdOptions = arguments[0] || {};

			var $inputs = $query.filter(":text, :password");

			$inputs.each(
					function() {
						var $this = jQuery(this);
						this.placeholdValue = placeholdOptions.placeholdValue
								|| $.trim($this.val());
						$this.val(this.placeholdValue);
						$this.addClass(placeholdOptions.blurClass || "");
					}).bind(
					"focus",
					function() {
						var $this = jQuery(this);
						var val = $.trim($this.val());
						if (val == this.placeholdValue || val == "") {
							$this.val("").removeClass(
									placeholdOptions.blurClass || "").addClass(
									placeholdOptions.focusClass || "");
						}
					}).bind(
					"blur",
					function() {
						var $this = jQuery(this);
						var val = $.trim($this.val());
						if (val == this.placeholdValue || val == "") {
							$this.val(this.placeholdValue).addClass(
									placeholdOptions.blurClass || "")
									.removeClass(
											placeholdOptions.focusClass || "")
						}

					});
			return $query;

		}
	})
})();

var get_options = function() {
	return {
		effect : 'fade', // Specify sets like: 'fold,fade,sliceDown'
		slices : 15,
		animSpeed : 500, // Slide transition speed
		pauseTime : 3000,
		startSlide : 0, // Set starting Slide (0 index)
		directionNav : false, // Next & Prev
		directionNavHide : false, // Only show on hover
		controlNav : true, // 1,2,3...
		controlNavThumbs : false, // Use thumbnails for Control Nav
		controlNavThumbsFromRel : false, // Use image rel for thumbs
		controlNavThumbsSearch : '.jpg', // Replace this with...
		controlNavThumbsReplace : '_thumb.jpg', // ...this in thumb Image
		// src
		keyboardNav : true, // Use left & right arrows
		pauseOnHover : true, // Stop animation while hovering
		manualAdvance : false, // Force manual transitions
		captionOpacity : 0.8, // Universal caption opacity
		beforeChange : function(a) {
		},
		afterChange : function(a) {

		},
		slideshowEnd : function(a) {
		} // Triggers after all slides have been shown
	};
};

$(document).ready(function() {
	// console.log('asd');
		$('input').placehold();
		$('div.tabs').tabs();
		$('body.home #teaser div.left').nivoSlider(get_options());
		//$('.media').media();
		//flowplayer("player", "/res/swf/flowplayer-3.2.4.swf");

	$('#gallery-current a, #gallery-thumbnails a').lightBox();
	
	$('#gallery-thumbnails a').click(function(event){
		$('#gallery-current a').attr('href', this.href);
		$('#gallery-current img').attr('src', this.href);
		event.preventDefault();
	});
	
    $('#gallery-move-left').click(function(){
		var marginLeft = parseInt($('#gallery-thumbnails').css('marginLeft'));
		if(marginLeft < 0) {
			$('#gallery-thumbnails').animate({
				marginLeft: ( marginLeft + 68 ) + 'px'
			}, 250);
		}
	});
    $('#gallery-move-right').click(function(){
		var thumbnails = $('#gallery-thumbnails');
		var marginLeft = parseInt(thumbnails.css('marginLeft'));
		if(marginLeft > ( $('#gallery-thumbnails a').length * -39 )) {
			$('#gallery-thumbnails').animate({
				marginLeft: ( marginLeft - 68 ) + 'px'
			}, 250);
		}
	});



	});
