$(document).ready( function(){
	$(".ctaHeadline,.cta").mouseenter( function(){
		$("img:last",this).show();
		$("img:first",this).hide();
	}).mouseleave( function(){
		$("img:first",this).show();
		$("img:last",this).hide();
	});
	$(".cta,.ftr").each( function(){
		$(this).click( function(){
			window.open($(this).attr("link"));
		});
	});
	$(".ctaHeadline").click( function(){
		ctaHeadlineClick();
	});
});

$(window).load( function(){
	convertPNGs();
});

//Spotlight click tag for sweepstakes
function ctaHeadlineClick(){
	var axel = Math.random()+"";
	var a = axel * 10000000000000;
	var spotpix = new Image(1,1);
	spotpix.src = 'http://ad.doubleclick.net/activity;src=1869704;type=yopla867;cat=yopssg02;ord=1;num='+ a + '?';
	spotpix.onload = window.open("http://www.yoplait.com/Coupon/coupon_gateway.aspx?targetcoupon=Yoplait_kids");
}

//ie6 png fix
function convertPNGs(){
	var browser=navigator.userAgent;
	if(browser.indexOf('MSIE 6')>-1){
		var fullDom=document.getElementsByTagName('body');
		var imgs=fullDom[0].getElementsByTagName('img');
		for(i=0;i<imgs.length;i++){
			var imgurl=imgs[i].src.replace(/^\s|\s$/g,"");
			if(imgurl.match(/([^\/\\]+)\.(png)$/i)){
				imgs[i].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+imgs[i].src+')';
				imgs[i].src='images/blank.gif';
			}
		}
	}
}