(function($) {
	$(function() {
		
		function loadScripts(){
			if ($('div.panel').length > 0) {
				$('.tabnav li').each(function(){
					var position = $(this).position().left;
					$('span.overlay span',this).css('background-position','-' + position + 'px 0px');
				});
				$.getScript('mysite/javascript/jquery.tabSlider.min.js',function(){
					$('#tabs').tabSlider();
				});
			}
			
			if ($('div.slideshow').length > 0) {
				$.getScript('mysite/javascript/src/jquery.nivo.slider.js',function(){
					$('div.slideshow').nivoSlider({
						effect:'fade',
						slices:1,
						pauseOnHover:false,
						directionNav:false,
						keyboardNav:false,
						animSpeed:600,
						pauseTime:6000,
						pauseButton:true,
						captionOpacity:1
					}).css({'visibility':'visible','opacity':'0'}).animate({opacity:1},2000);;
				});
			}
			
			if($('.galleryCarousel').length > 0) {
				$.getScript('mysite/javascript/src/jquery.galleryCarousel.js',function(){
					$('.galleryCarousel').galleryCarousel();
				});
			}
		}
		
		/* no fancy scripts for IE6 :( */
		if($.browser.msie){
			if(parseInt($.browser.version) >= 7)
			{
				loadScripts();
			}
		}
		else {
			loadScripts();
		}
		
		$('#query-input').css({'background-image':'url("mysite/images/google_site_search.png")','background-repeat':'no-repeat','background-position':'0 50%'});
		$('#query-input').focus(function(){ $(this).css({'background-image':'none'}); });
		$('#query-input').blur(function(){ $(this).css({'background-image':'url("mysite/images/google_site_search.png")'}); });
		
		/* display search query on search page */
		if ($('span.searchquery').length > 0)
		{
			if (getQuery() != '')
				$('span.searchquery').html(getQuery());
			else
				$('span.searchquery').parent().html('Please enter a valid search term.');
		}
			
		if($('.contentToggle').length > 0) {
			$.getScript('mysite/javascript/src/jquery.contentToggle.js',function(){
				$('.contentToggle').contentToggle();
			});
		}
		
		// toggle for the industry select
		if($('#Industry select').length > 0) {
			$('#Other').hide();
			$('#Industry select').change(function() {
				if($(this).val() == "Other:")
					$('#Other').show();
				else
					$('#Other').hide();
			});
		}
	});
})(jQuery);
