jQuery(document).ready(function(){
	
	// Infocenter
	$(".infocenter_ul li a, a.tx-guestbook-link").click(function() {
	
		var content;
		$.get($(this).attr('href'), function(data){
			// get info from url
			content = jQuery(data).find('#mainIn');
			// start fancybox with new content
			$.fancybox({
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'speedIn'		:	600, 
				'speedOut'		:	600, 
				'height'		:	400, 
				'width'			:	600, 
				'overlayShow'	:	false,
				'autoDimensions':	false,
				'content'		: 	content
			});
		});
		
		return false;   
		
	});
	
	// DropDown Menu
	jQuery('ul.hmenu_ul').superfish({
		delay:       1000,                            // one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
		speed:       'fast',                          // faster animation speed 
		autoArrows:  false,                           // disable generation of arrow mark-up 
		dropShadows: false                            // disable drop shadows 
	});
	
	// Tabs
	jQuery('#tabLeft').hover(function(){
		jQuery(this).stop().animate({'left' : 0}, 200);	
	},function(){
		jQuery(this).stop().animate({'left' : -246}, 600);
	});
	jQuery('#tabRight').hover(function(){
		jQuery(this).stop().animate({'right' : 0}, 200);	
	},function(){
		jQuery(this).stop().animate({'right' : -388}, 600);
	});
	
	jQuery('#tabLeft').delay(2000).animate({'left' : -246}, 600);
	jQuery('#tabRight').delay(2000).animate({'right' : -388}, 600);
	
	// Content Slide
	var contentSlideItemNum = jQuery('.contentSlide-item > div.contentItem').size();
	var contentSlideItemWidth = jQuery('.contentSlide-item .contentItem').width();
	var contentSlideItemContWidth = contentSlideItemWidth*contentSlideItemNum;
	var contentSlideItemContPosEnd = eval((contentSlideItemWidth*contentSlideItemNum)-contentSlideItemWidth)*(-1);
	var contentSlideItemMove = eval(contentSlideItemWidth*(-1));
	var contentSlideItemPos = 0;
	
	jQuery('.contentSlide-item').css('width',contentSlideItemContWidth);
	jQuery('.contentSlide-bRight .button').click(function(){
		
		if( contentSlideItemPos > contentSlideItemContPosEnd ){ // 0 > -234
			jQuery('.contentSlide-item').animate({
				'left'	:	'+='+contentSlideItemMove+'px'
			});
			contentSlideItemPos = contentSlideItemPos + contentSlideItemMove;
			console.log(contentSlideItemPos);
		}
		return false;
	});
	jQuery('.contentSlide-bLeft .button').click(function(){
		if( contentSlideItemPos < 0 ){
			jQuery('.contentSlide-item').animate({
				'left'	:	'-='+contentSlideItemMove+'px'
			});
			contentSlideItemPos = contentSlideItemPos - contentSlideItemMove;
			console.log(contentSlideItemPos);
		}
		return false;
	});
	
});
