/* ------------------------------------------------------------------------------------------ */
/* Tiptip: http://code.drewwilson.com/entry/tiptip-jquery-plugin */
/* ------------------------------------------------------------------------------------------ */
$(function(){
	$("div#sidebar a#sidebar_logo").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 5, 
		defaultPosition: "right",
		content: "Torna alla pagina principale della guida"
	});	
	$("div#sidebar a#sidebar_logo_prestashop").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 5, 
		defaultPosition: "right",
		content: "Torna alla pagina principale della guida"
	});	
	$("div#sidebar a#sidebar_logo_wordpress").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 5, 
		defaultPosition: "right",
		content: "Torna alla pagina principale della guida"
	});				
	$("div#sidebar a#help_modal_link").tipTip({
		delay: 400,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 5, 
		defaultPosition: "right",
		content: "Clicka qui per inviare una richiesta d'aiuto"
	});		
	
});
/* ------------------------------------------------------------------------------------------ */
/* Jquery Cycle: http://malsup.com/jquery/cycle/ */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {
	$('#facebox_pic').cycle({
		fx: 'fade'
	});
}); 
/*$(document).ready(function() {
	$('#bottom_text').cycle({
		fx: 'fade',
		delay:  2000 
	});
}); */
/* ------------------------------------------------------------------------------------------ */
/* Table rows: allows to set a specific class for table's rows */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {
	$('table tbody tr:not([th]):even').addClass('even');
	$('table tbody tr:not([th]):odd').addClass('odd');
});

/* ------------------------------------------------------------------------------------------ */
/* Jquery Hover */
/* ------------------------------------------------------------------------------------------ */
	jQuery(document).ready(function() {				
		banners_home();
		romanzi_lista();
	});
	
	function banners_home() {
	jQuery('div#bottom_banners ul li a.banner_thumbnail img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
	function romanzi_lista() {
	jQuery('ul#romanzi_list li a.banner_thumbnail img').hover(function(){
			jQuery(this).stop().fadeTo(500, 0.4);
		}, function() {
			jQuery(this).stop().fadeTo(500, 1);
		});
	}
/* ------------------------------------------------------------------------------------------ */
/* Popup window */
/* ------------------------------------------------------------------------------------------ */
function popup_window(url,w,h)
{
	var width=w;
	var height=h;
	var from_top=250;
	var from_left=250;
	var toolbar='no';
	var location='no';
	var directories='no';
	var status='no';
	var menubar='no';
	var scrollbars='false';
	var resizable='no';
	var atts='width='+width+'show,height='+height+',top='+from_top+',screenY=';
	atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
	atts+=',location='+location+',directories='+directories+',status='+status;
	atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
	window.open(url,'win_name',atts);
}

 
 
 
 
/* ------------------------------------------------------------------------------------------ */
/* jQuery SmoothScroll | Version 11-03-14 */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {

   $('a[href*=#]').click(function() {

      // duration in ms
      var duration=1000;

      // easing values: swing | linear
      var easing='swing';

      // get / set parameters
      var newHash=this.hash;
      var target=$(this.hash+', a[name='+this.hash.slice(1)+']').offset().top;
      var oldLocation=window.location.href.replace(window.location.hash, '');
      var newLocation=this;

      // make sure it's the same location      
      if(oldLocation+newHash==newLocation)
      {
         // set selector
         if($.browser.safari) var animationSelector='body:not(:animated)';
         else var animationSelector='html:not(:animated)';

         // animate to target and set the hash to the window.location after the animation
         $(animationSelector).animate({ scrollTop: target }, duration, easing, function() {

            // add new hash to the browser location
            window.location.href=newLocation;
         });

         // cancel default click action
         return false;
      }
   });

});


