jQuery.noConflict();
jQuery(function() {
	
	jQuery('ul.sf-menu')
		.addClass('sf-menu')
		.supersubs({
			minWidth:    14,                                // minimum width of sub-menus in em units
			maxWidth:    27,                                // maximum width of sub-menus in em units
			extraWidth:  1                                  // extra width can ensure lines don't sometimes turn over due to slight rounding differences and font-family
		}).superfish({
			delay:       400,                               // delay on mouseout 
	        animation:   {opacity:'show',height:'show'},    // fade-in and slide-down animation 
	        speed:       'fast'                            // faster animation speed 
		})
		.find('ul')
			.bgIframe({
				opacity: false
			});
			
	jQuery('div.tabs').tabs('#slides > div', {
			effect: 'fade', // enable "cross-fading" effect
			fadeOutSpeed: 'slow', // start from the beginning after the last tab
			rotate: true
		}).slideshow({ // use the slideshow plugin. It accepts its own configuration
			// stop the tabs from automatically advancing to the next tab when clicking on the visible pane
			clickable: false,
			autoplay: true,
			interval: 20000
		});
	
	// body background needs to be shifted to below the body
	var body = jQuery('body');
	var bgpos = body.height();
	body.css('background-position', '50% ' + bgpos + 'px');
	
	jQuery('.slug-industry-partners .entry-content a[href^="http"], .slug-vendor-partners .entry-content a[href^="http"], .slug-events .entry-content a[href^="http"], .iat-login a[href^="http"], #footer a[href^="http"]').attr('target', '_blank');
	
	jQuery('.slug-faqs h2, .slug-tech-tips h2')
		.prepend('<span>')
		.click(function(){
			jQuery(this).toggleClass('open').next('blockquote').toggle();
		});
		
	jQuery('.entry-content p').defuscate();
	
	function setRegionsImg(region){
		jQuery('#regionsContainer .' + region).addClass('active');
	}
				
	jQuery('#regionsMap area').hover(
		function() {
			var region = jQuery(this).attr('class');
			setRegionsImg(region);
		},
		function(){
			jQuery('#regionsContainer .active').removeClass('active');
		})
		.tooltip({ 
		    bodyHandler: function() { 
				var region = jQuery(this).attr('class');
		        return jQuery('#salesReps .'+ region).html(); 
		    }, 
		    showURL: false 
		});
	
});
