jQuery(function($) {
			 $(".slidetabs").tabs(".images > div", {
	
		            // enable "cross-fading" effect
		            effect: 'fade',
		            fadeOutSpeed: 2000, fadeInSpeed: 2000,
	
		            // start from the beginning after the last tab
		            rotate: true
	
		            // use the slideshow plugin. It accepts its own configuration
		        }).slideshow({ autoplay: true, interval: 4000 });
		
		
			var slide = false;
			var height = $('#lingue_content').height();
			$('#lingue_button').click(function() {
				var docHeight = $(document).height();
				var windowHeight = $(window).height();
				var scrollPos = docHeight - windowHeight + height;
				$('#lingue_content').animate({ height: "toggle"}, 1000);
				if(slide == false) {
					if($.browser.opera) {
						$('html').animate({scrollTop: scrollPos+'px'}, 1000);
					} else {
						$('html, body').animate({scrollTop: scrollPos+'px'}, 1000);
					}
					slide = true;
				} else {
					slide = false;
				}
			});
			
			
			// COLORBOX
			//Examples of how to assign the ColorBox event to elements
			$(".contentImg").colorbox({rel:'contentImg', maxWidth:"90%"});	
			$(".colorbox").colorbox({rel:'contentImg', maxWidth:"90%"});		
			$(".youtube").colorbox({iframe:true, innerWidth:"80%", innerHeight:"70%"});
			$(".offerteLavoro").colorbox({iframe:true, width:"75%", height:"75%"});

			$("a img").hover(function () { $(this).stop().animate({ opacity: 0.70 }); }, function () { $(this).stop().animate({  opacity: 1.0 }); });
			$("#galleria a img").hover(function () { $(this).stop().animate({  opacity: 1.0 }); }, function () { $(this).stop().animate({  opacity: 0.7 }); })
			$(".contentImg").hover(function () { $(this).stop().animate({  opacity: 0.60 }); }, function () { $(this).stop().animate({  opacity: 1.0 }); });
			
						
			
			 //Tooltips
			    $(".tip_trigger").hover(function(){
			        tip = $(this).find('.tip');
			        tip.show(); //Show tooltip
			    }, function() {
			        tip.hide(); //Hide tooltip
			    }).mousemove(function(e) {
			        var mousex = e.pageX + 20; //Get X coodrinates
			        var mousey = e.pageY + 20; //Get Y coordinates
			        var tipWidth = tip.width(); //Find width of tooltip
			        var tipHeight = tip.height(); //Find height of tooltip
			
			        //Distance of element from the right edge of viewport
			        var tipVisX = $(window).width() - (mousex + tipWidth);
			        //Distance of element from the bottom of viewport
			        var tipVisY = $(window).height() - (mousey + tipHeight);
			
			        if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
			            mousex = e.pageX - tipWidth - 20;
			        } if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
			            mousey = e.pageY - tipHeight - 20;
			        }
			        //Absolute position the tooltip according to mouse position
			        tip.css({  top: mousey, left: mousex });
			    });
			    
				$("#topmenu li").prepend("<span></span>"); //Throws an empty span tag right before the a tag
			
				$("#topmenu li").each(function() { //For each list item...
					var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
					$(this).find("span").show().html(linkText); //Add the text in the <span> tag
				}); 
			
				$("#topmenu li").hover(function() {	//On hover...
					$(this).find("span").stop().animate({
						marginTop: "-42" //Find the <span> tag and move it up 40 pixels
					}, 250);
				} , function() { //On hover out...
					$(this).find("span").stop().animate({
						marginTop: "0"  //Move the <span> back to its original state (0px)
					}, 250);
				});
				/*
				$("#topmenu li").click(function() {
					$("#topmenu li").removeClass("select");
					$(this).parent().addClass("select");	
				});
				*/
			 	$("#topmenulist li a[href="+getPageName()+"]").parent().addClass("select");
			 	
		});
		
				
			function getPageName() { 
			    var loc =  $(location).attr('href'); //window.location; 
			    return loc.substring(loc.lastIndexOf('/') + 1);
			} 
