// TOOLS MANAGER - handles effects and behavior //
var toolsMG = {

		// constructor: catch events
		init : function () {

			if (jQuery.support.cssFloat) {
				toolsMG.linksHover();
				toolsMG.imagesAnimate();
			}
			toolsMG.handleProductTabs();
			
			toolsMG.handleProductOverviewTabs();

			jQuery('#var_lang').selectbox({
				onChangeCallback: function(){ jQuery('#var_lang').closest('form').submit()}
			});

			$('#article a.image').nyroModal({
			  endShowContent: toolsMG.linksHover
			});

		},

		// handle link hover effect
		linksHover : function () {
			
			$('#menu > li:not(.active), a')
				.not('#site_logo, #menu > li a, #news > li a, #product_tabs > li > a, a.image')
				.bind('mouseenter', function(){ $(this).animate({'opacity' : 0.6}, 100).animate({'opacity': 1 }, 700); });

		},

		// handle image animation effect
		imagesAnimate : function () {

			$('img')
				.not('#site_logo img, #contact-images img')
				.animate({'opacity' : 0.2}, 0).animate({'opacity': 1 }, 1500);
		},

		// product tab switch
		handleProductTabs : function () {

			$('#product_tabs > li > a').click(function() {
				$('#product_content > div').hide();
				$('#product_tabs > li').removeClass('active');
				$('#'+$(this).attr('id').replace('tab_', '')).show();
				$(this).closest('li').addClass('active');
				//run masonry when page first loads
				$('.wrap').masonry(); 
				return false;
			});

		},
		


		// product overview tab switch
		handleProductOverviewTabs : function () {

			$('#other_tabs > li > a').click(function() {
				$('#product_content > div').hide();
				$('#product_tabs > li').removeClass('active');
				$('#'+$(this).attr('id').replace('show_', '')).show();
				$('#'+$(this).attr('id').replace('show_', 'tab_')).parent().addClass('active');
				//run masonry when page first loads
				$('.wrap').masonry(); 
				return false;
			});

		}

}

