﻿$(document).ready(function() { 
	
	$('#nav ul.sf-menu li.dropdown').hover(function() {
	  $(this).addClass('mouseover');
	}, function() {
	  $(this).removeClass('mouseover');
	});
	
    $('#nav ul.sf-menu').superfish({ 
        delay:       0,                           
        animation:   {opacity:'show',height:'show'}, 
        speed:       'fast'
    }); 
	 
	$('#getSocial a').each(function () {
	$('<div class="fader" />').css('opacity', 0).prependTo(this);
	  }).hover(function () {
		$('img', this).stop().animate({
		  marginTop : 3
		}, 100);
		
		$('.fader', this).stop().animate({
		  opacity : 0.15
		});
		
	  }, function () {
		$('img', this).stop().animate({
		  marginTop : 0
		}, 300);
		
		$('.fader', this).stop().animate({
		  opacity : 0
		});
	  }).find('img').css('marginTop', 0);
	 
	$("#videos").easySlider({
		controlsBefore:	'<div id="rotate">',
		controlsAfter:	'</div>',
		prevText: ' &lsaquo; Previous',
		nextText: 'Next &rsaquo;'
	});
	$("#photos").easySlider({
		controlsBefore:	'<div id="rotate2">',
		controlsAfter:	'</div>',
		prevText: ' &lsaquo; Previous',
		nextText: 'Next &rsaquo;',
		prevId: 'prevBtn2',
		nextId: 'nextBtn2'
	});
	  $('a.twitterLink').click(function(){
        window.open(this.href);
        return false;
    });
	  $('a.facebookLink').click(function(){
        window.open(this.href);
        return false;
    });
	$(".screenerCount h4:contains('James Belushi')").replaceWith('<h4>Jim Belushi</h4>');
	
	
   
     $('.ext').click(function() {
			return confirm('This link will take you to a website outside of Boehringer Ingelheim Pharmaceuticals, Inc. network of websites.');
	});

});

$(document).ready(function() { 
	$("#footer ul.partners li a").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Campaign Partners', 'Click', $(this).attr("href"));
		});
	});
	$("#getSocial ul li a").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Social Media', 'Click', $(this).attr("href"));
		});
	});
	$("#wrapperBtm #indexSelect .indexSelectCont a").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Homepage Buttons', 'Click', $(this).attr("href"));
		});
	});
	$("#contentLeft .wanttoknowmore").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('KNOWCOPD', 'Click', $(this).attr("href"));
		});
	});
	$("#contentLeft .areyouatrisk").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('AreYouAtRisk', 'Click', $(this).attr("href"));
		});
	});
	$(".listen").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Homepage Drive', 'Click', $(this).attr("href"));
		});
	});
	$(".listenSec").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Patty Loveless Drive', 'Click', $(this).attr("href"));
		});
	});
	$(".findoutnow").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Homepage Screener Competition', 'Click', $(this).attr("href"));
		});
	});
	$("#lb_Danica_Patrick").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Downloads', 'Click', $(this).attr("href"));
		});
	});
	$("#lb_Patty_Loveless").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Downloads', 'Click', $(this).attr("href"));
		});
	});
	$("#lb_Bruce_Jenner").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Downloads', 'Click', $(this).attr("href"));
		});
	});
	$("#lbMichael_Strahan").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Downloads', 'Click', $(this).attr("href"));
		});
	});
	$(".fbSocialShare").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Social Sharing', 'Click', $(this).attr("href"));
		});
	});
	$("#LinkButton1").each(function(){
		$(this).click(function () {
			pageTracker._trackEvent('Ambassador Downloads', 'Click', $(this).attr("href"));
		});
	});
});

AudioPlayer.setup("http://www.drive4copd.com/swf/player.swf", {  
    height: 46,
	width: 450,
	animation: "no",
	autostart: "yes",
	bg: "EFEFEF",
	transparentpagebg: "yes",
	leftbg: "002863",
	lefticon: "ffffff",
	voltrack: "ffffff",
	volslider: "EF530C",
	rightbg: "002863",
	rightbghover: "EF530C",
	righticon: "ffffff",
	righticonhover: "ffffff",
	text: "EF530C",
	slider: "cccccc",
	tracker: "cccccc",
	track: "EFEFEF",
	border: "EFEFEF",
	loader: "EF530C"
});

$(document).ready(function(){	
			$.ajaxSetup({ cache: true });
			$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=47173959@N04&lang=en-us&format=json&jsoncallback=?", function(data){
				$.each(data.items, function(i,item){
				i = i++;
				$("<img/>").attr("src", item.media.m).appendTo("#flickrImages")
					.wrap("<li><a target='_blank' href='" + item.link + "'></a></li>");
					$("ul#flickrImages li a img").each(function() {
						   var smallThumb = $(this).attr("src").replace(/_m.jpg$/i,'_s.jpg');
						   $(this).attr("src", smallThumb);
					});
					if ( i == 5 ) return false;
				});

			});
		});
	
