$(document).ready(function() {
	
	//megamenu
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}


	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 60, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	$("ul#topNav li .sub").css({'opacity':'25'});
	$("ul#topNav li").hoverIntent(config);

	//scrollfollow stuff for navbar
	$( '#follower' ).scrollFollow( {
	speed: 750,
	offset: 0,
	easing: 'easeInOutCirc',
	container: 'rightBar'
	} );
	
	
	//to top
	$().UItoTop({ easingType: 'easeOutQuart' });
	
	
	
//scan for pdfs, add icon and tooltip
$('.ckBlock a[href*=.pdf]').append("<img src=\"/images/icons/soc/pdf.gif\" alt=\"PDF File\" title=\"PDF File\" class=\"siteIcon\" border=\"0\" onmouseout=\"UnTip\(\)\" onmouseover=\"Tip\('<div class=balloonTit><strong><span class=homeHex>PDF File<\/span><\/strong><\/div><div class=balloonDesc>This file is in PDF Format.  All PDF Files open in new browser windows or tabs.<\/div>', BALLOON, false, ABOVE, true, OFFSETX, -17, PADDING, 5, DELAY, 250, WIDTH, 250, BGCOLOR, '#FFFFFF',BORDERCOLOR, '#57738D'\)\" />");

//scan for docs, add icon and tooltip
$('.ckBlock a[href*=.doc]').append("<img src=\"/images/icons/soc/word.png\" alt=\"DOC File\" title=\"DOC File\" class=\"siteIcon\" border=\"0\" onmouseout=\"UnTip\(\)\" onmouseover=\"Tip\('<div class=balloonTit><strong><span class=homeHex>DOC File<\/span><\/strong><\/div><div class=balloonDesc>This file is in DOC Format.  All DOC Files open in new browser windows or tabs.<\/div>', BALLOON, false, ABOVE, true, OFFSETX, -17, PADDING, 5, DELAY, 250, WIDTH, 250, BGCOLOR, '#FFFFFF',BORDERCOLOR, '#57738D'\)\" />");

//scan for xls, add icon and tooltip
$('.ckBlock a[href*=.xls]').append("<img src=\"/images/icons/soc/xsl.gif\" alt=\"XLS File\" title=\"XLS File\" class=\"siteIcon\" border=\"0\" onmouseout=\"UnTip\(\)\" onmouseover=\"Tip\('<div class=balloonTit><strong><span class=homeHex>XLS File<\/span><\/strong><\/div><div class=balloonDesc>This file is in XLS Format.  All XLS Files open in new browser windows or tabs.<\/div>', BALLOON, false, ABOVE, true, OFFSETX, -17, PADDING, 5, DELAY, 250, WIDTH, 250, BGCOLOR, '#FFFFFF',BORDERCOLOR, '#57738D'\)\" />");

//scans for ext links, add tooltip to link
$('.ckBlock a').filter(function() {if(this.hostname !== 'www.city.pittsburgh.pa.us' && this.hostname !== 'pittsburghpa.gov' && this.hostname !== 'www.youtube.com'){
return this.hostname && this.hostname !== location.hostname;}
}).attr({"onmouseout":"UnTip()","onmouseover":"Tip('<div class=balloonTit><strong><span class=homeHex>External Link Policy<\/span><\/strong><\/div><div class=balloonDesc><p>When you click this link,  you are leaving the PittsburghPA.gov municipal website. This external link provides additional information that is consistent with the intended purpose of PittsburghPA.gov.</p> <p>PittsburghPA.gov cannot attest to the accuracy of a non-government website. Linking to a non-government website does not constitute an endorsement by PittsburghPA.gov or any of its employees of the sponsors or the information and products presented on the site.</p> <p>You will be subject to the destination site privacy policy when you follow the link.</p><\/div>\', BALLOON, false, ABOVE, true, OFFSETX, -17, PADDING, 5, WIDTH, 350,DELAY, 250,BGCOLOR, \'#FFFFFF\',BORDERCOLOR, \'#57738D\')"});

//ext links open window
$('.ckBlock a').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).attr({"target":"_blank"});

//pdfs open window
$('.ckBlock a[href*=.pdf]').attr({"target":"_blank"});	
//docs open window
$('.ckBlock a[href*=.doc]').attr({"target":"_blank"});
//xls open window
$('.ckBlock a[href*=.xls]').attr({"target":"_blank"});
	
	


});
