jQuery.noConflict();

function mainmenu(){
jQuery("#nav-one ul").css({display: "none"}); // Opera Fix

jQuery("#nav-one li").hover(function(){//rollover
	jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(600);
  	jQuery(this).addClass('activeHover');
  	}, function(){//rollout
  	jQuery(this).find('ul:first').fadeOut(300);
   	jQuery(this).removeClass('activeHover');
  });
  
  //add in Top & bottom extra LIs for style
 jQuery("#nav-one UL LI:first-child").before("<li class='navcap'>&nbsp; </li>");
 jQuery("#nav-one UL LI:last-child").after("<li class='navbot'>&nbsp; </li>"); 
 //jQuery("#nav-one UL:last-child").after("<div class='navbot'>bottom</div>"); 
}

jQuery.fn.hoverClass = function(c) {
	return this.each(function(){
		jQuery(this).hover( 
			function() { jQuery(this).addClass(c); },
			function() { jQuery(this).removeClass(c);}
		);
	});
};	

var thumbnail = {
				effectDuration : 400 /* the duration of the effect (zoom and caption) */
				};


jQuery(document).ready(function(){

	mainmenu();
	
	//add style to top level nav LIs
	jQuery('#nav-one li li a').addClass('sublevel');
	
	
	//hide homepage image captions
	jQuery(".homeImagesHolder DIV.caption").css("display", "none");
	
	jQuery('.homeImagesHolder .homeImage').hover(function(){
	
		//show the caption using slideDown event
		jQuery(this).find('.caption:not(:animated)').slideDown(thumbnail.effectDuration);
	
		//when mouse leave...
		}, function(){
					
		//hide the caption using slideUp event
		jQuery(this).find('.caption').slideUp(thumbnail.effectDuration);
	
	});

	
	
	//isolate offsite links and make blank
	jQuery("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank")
	
	//add pdf icons
	jQuery('#maincontent a[href$=".pdf"]').each(function(){
    	jQuery(this).wrap("<span class='pdf'></span>");
		jQuery(this).attr("target","_blank");
	}); 
	
	//add ppt icons
	jQuery('#maincontent a[href$=".ppt"]').each(function(){
    	jQuery(this).wrap("<span class='ppt'></span>");
		jQuery(this).attr("target","_blank");
	}); 
	
	//add doc icons
	jQuery('#maincontent a[href$=".doc"], #maincontent a[href$=".docx"]').each(function(){
    	jQuery(this).wrap("<span class='doc'></span>");
		jQuery(this).attr("target","_blank");
	}); 
	
	
	//add botttom fo block quote
	//jQuery("#maincontent BLOCKQUOTE").after("<div class=\"quoteclose\">&nbsp;</div>");
	jQuery("#maincontent BLOCKQUOTE STRONG").wrap("<div class=\"quoteclose\"></div>");
	
	
	//tweak every 3rd image in sidebar CSS
	jQuery("#photolist :nth-child(3), #photolist :nth-child(6), #photolist :nth-child(9)").css("margin-right", "0px");
	
	//activate lightbox
	jQuery('#photolist .photoHolder a, #photolistlarge .photoHolder a').lightBox({
		imageLoading: '/wp-content/themes/spicercomms/images/lightbox-ico-loading.gif',
		imageBtnClose: '/wp-content/themes/spicercomms/images/lightbox-btn-close.gif',
		imageBtnPrev: '/wp-content/themes/spicercomms/images/lightbox-btn-prev.gif',
		imageBtnNext: '/wp-content/themes/spicercomms/images/lightbox-btn-next.gif',
		imageBlank: '/wp-content/themes/spicercomms/images/lightbox-blank.gif'

	});
	
	
});






