/*-------------------- /projects/70/templates/js/main.js --------------------*/
/*
    Document   : main.js
    Created on : 24.02.2011, 04:45:08
    Description:
        Basis javascript Datei  
*/
$(document).ready(function() {
        //move the last list item before the first item. The purpose of this is if the user clicks previous he will be able to see the last item.
        $('.carousel ul li:first').before($('.carousel ul li:last'));

        //when user clicks the image for sliding right
        $('#newsnext').click(function(){

            //get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
            var item_width = $('.carousel ul li').outerWidth() + 10;

            //calculate the new left indent of the unordered list
            var left_indent = parseInt($('.carousel ul').css('left')) - item_width;

            //make the sliding effect using jquery's anumate function '
            $('.carousel ul').animate({'left' : left_indent},500,'swing',function(){

                //get the first list item and put it after the last list item (that's how the infinite effects is made) '
                $('.carousel ul li:last').after($('.carousel ul li:first'));

                //and get the left indent to the default -210px
                $('.carousel ul').css({'left' : '-285px'});
            });
        });

        //when user clicks the image for sliding left
        $('#newsback').click(function(){

            var item_width = $('.carousel ul li').outerWidth() + 10;

            /* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
            var left_indent = parseInt($('.carousel ul').css('left')) + item_width;

            $('.carousel ul').animate({'left' : left_indent},500, 'swing', function(){

				/* when sliding to left we are moving the last item before the first item */
				$('.carousel ul li:first').before($('.carousel ul li:last'));

				/* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
				$('.carousel ul').css({'left' : '-285px'});
            });

        });
  });



function slide(){
	$('#newsnext').click();
	//console.log('r');
	setTimeout('slide()', 9000);
}


$(document).ready(function () {
	slide() ;

	Cufon.replace('h1, h2, h3, #TopMenu a', {fontFamily: 'Delicious'});

	initImageHover();
	initPrettyFoto();
	
	var hideDropdownTimer = null;

	$('#TopMenu .dropdownhandler').hover(function(){
		//if (hideDropdownTimer){
			clearTimeout(hideDropdownTimer);
		//}
		//$(this).find('ul.dropdown').show(150)  ;
		$('ul.dropdown', this).stop(true, true).fadeIn();

	},
	function(){
		//if (hideDropdownTimer){
			clearTimeout(hideDropdownTimer);
		//}
		$('ul.dropdown', this).stop(true, true).fadeOut();
		//hideDropdownTimer = setTimeout(function() {
			//dropdown.stop().hide(500);
		//}, 300)


		//$(this).find('ul.dropdown').hide().stop().animate({opacity: 0}, 200) ;
		
	});

});

function initPrettyFoto(){
	/*-------------------------------------------------------------------------
	   prettyPhoto
	---------------------------------------------------------------------------*/
	$("a[rel^='prettyOverlay'],a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal',
			opacity: 0.55,
			showTitle: true,
			allowresize: true,
			counter_separator_label: '/' ,
			theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
		});
}

function initImageHover(){
	$('.references-liste a.img span').css({'opacity':0}).show();
	$('.references-liste a.img').hover(function(){
		$(this).find('span').stop().animate({'opacity':0.99} , 200);
	}, function(){
		$(this).find('span').stop().animate({'opacity':0} , 200);
	});
}

function ajax_trackimage(image_id){ }

function slideshow(){ }

/*--------------------------------------------------------------------------------
sum bytes: 3849 (4 KB)
--------------------------------------------------------------------------------*/

