jQuery(document).ready(function(){ 
			  
			  // external links get a tooltip
			jQuery('a.exit').qtip({
				content: {
						text: '<a href="http://www.drugabuse.gov/web-site-disclaimer">External Web Site Policy.</a>'
				},
				style: {
					width: {
						max: 250 
						} 
				},
				hide: {
						 when: 'mouseout',
						 fixed: true,
						 delay: 700
				 },
				 style: {
						classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
				 },
				 show: { 
					when: { event: 'focus' }
				}
			});		
			jQuery('a.exitImage').qtip({
				content: {
						text: '<a href="http://www.drugabuse.gov/web-site-disclaimer">External Web Site Policy.</a>'
				},
				style: {
					width: {
						max: 250 
						} 
				},
				hide: {
						 when: 'mouseout',
						 fixed: true,
						 delay: 700
				 },
				 style: {
						classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
				 },
				 show: { 
					when: { event: 'focus' }
				}
			});	
			jQuery('a.socialmedia').qtip({
				content: {
						text: '<a href="http://www.drugabuse.gov/web-site-disclaimer">External Web Site Policy.</a>'
				},
				style: {
					width: {
						max: 250 
						} 
				},
				hide: {
						 when: 'mouseout',
						 fixed: true,
						 delay: 700
				 },
				 style: {
						classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
				 }
			});	
				

			// external links get an image at the end attached that links to a disclaimer page
			jQuery('#mainContent a.exit').filter(function() {
				return this.hostname && this.hostname !== location.hostname;
			}).after(' <a href="http://www.drugabuse.gov/web-site-disclaimer"><img src="http://drugfactsweek.drugabuse.gov/images/exit_disclaimer.png" class="externalLink" alt="External link" /></a>');
			
					
jQuery('#footer a.exit').filter(function() {
				return this.hostname && this.hostname !== location.hostname;
			}).after(' <a href="http://www.drugabuse.gov/web-site-disclaimer"><img src="http://drugfactsweek.drugabuse.gov/images/exit_disclaimer.png" class="externalLink" alt="External link" /></a>');
			
			// image is removed in some instances due to design priority
			jQuery("a.exit ~ img").css({border:"none",background:"none",position:"relative",top:"0px",padding:"0"})
			
			// Removing browser jump on captcha links
		   jQuery('.captcha a').click(function(){
			return false;
			});
		 
		 //Open pdf in new window automatically		
		jQuery(function(){
			jQuery('A, AREA').filter(function(){
				return (!this.target && (this.href.indexOf(window.location.hostname) == -1 || this.href.match(/\.pdf$/i)));
			}).attr('target', '_blank');
		});

  });
