jQuery(function(){
	
	jQuery("a.external").click(function() {
		return !window.open(jQuery(this).attr("href"));
	});
	

	jQuery.easing.easeOutExpo = function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	};
	
    function selectNav() {
        jQuery(this)
            .parents('#navMain:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }

    jQuery('#navMain').find('a').click(selectNav);

    function trigger(data) {
        var el = jQuery('#navMain').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el);
    }
    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
    } else {
        jQuery('#navMain a:first').click();
    }

	jQuery.localScroll.defaults.axis = 'xy';
	jQuery.localScroll({
		target: '#content', 
		queue:true,
		duration:1000,
		hash: false,
		easing: 'easeOutExpo',
		onAfter: trigger
	});
	
	jQuery.fn.qtip.styles.custom = { 
	width: 'auto',
	background: '#eee',
	color: '#555',
	textAlign: 'center',
	border: {
		width: 1,
		radius: 0,
		color: '#ccc'
	},
	tip: true
	}

	jQuery('#navMain a[titlessss]').qtip({
	style: 'custom',
	prerender: true,
	position: {
	  corner: {
		 target: 'topMiddle',
		 tooltip: 'bottomMiddle'
	  }
	}
	});
	
	//settings for the vCard tootlip
	jQuery('.slides2 a[title]').qtip({
	style: 'custom',
	prerender: true,
	position: {
	  corner: {
		 target: 'topMiddle',
		 tooltip: 'bottomMiddle'
	  }
	}
	});
	
	//settings for general tooltips
	jQuery('a.tooltip').qtip({
	style: 'custom',
	prerender: true,
	position: {
	  corner: {
		 target: 'rightMiddle',
		 tooltip: 'bottomMiddle'
	  }
	}
	});

		   
	// ------ Home page
	jQuery(".HomeUp").hover(function () {
			jQuery(this).stop().animate({
				'top' : '-4px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'top' : '0px' 
				}, 100 )
		    });

	// ------ Home
	jQuery(".home-i").hover(function () {
			jQuery(this).stop().animate({
				'left' : '27px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'left' : '56px' 
				}, 100 )
		    });
		    
	// ------ About
	jQuery(".about-i").hover(function () {
			jQuery(this).stop().animate({
				'left' : '5px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'left' : '56px'
				}, 100 )
		    });
		    
	// ------ portfolio
	jQuery(".portfolio-i").hover(function () {
			jQuery(this).stop().animate({
				'left' : '4px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'left' : '56px'
				}, 100 )
		    });
		    
	// ------ order
	jQuery(".order-i").hover(function () {
			jQuery(this).stop().animate({
				'left' : '25px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'left' : '56px'
				}, 100 )
		    });
		    
	// ------ contact
	jQuery(".contact-i").hover(function () {
			jQuery(this).stop().animate({
				'left' : '3px'
				}, 200 );
		    }, function () {
			jQuery(this).stop().animate({
				'left' : '56px'
				}, 100 )
		    });
		 
	
});

