/*
 * AKQA Tags for clorox.com
 * Note: Creates AKQA Tags for anything with a class 'akqa-tag' and uses the id
 * for the unique AKQA order ID. Anything with that class and a valid id will
 * load a tracking pixel on mousedown.
 * Note: Original tags added June 7th 2011. Code updated and tweaked and Feb 1st 2012.
 */
$(document).ready(function() {

	// Initialize mousedown AKQA tags for all class 'akqa-tag' but MUST have
	// valid id
	$('.akqa-tag').each(function() {
		$(this).mousedown(function() {
			var akqatag = new Image();

			//These are likely constant for the site
			var trackerid='1396';
			var cb='448722285';

			//These change per page, but page value 1 is a useful default
			var _sr_PageValue='1';
			var _sr_Action='Unknown';

			//These make the URL match protocold and be unique
			var az_p=location.protocol=='https:'?'https:':'http:';
			var az_r=Math.floor(Math.random()*999999);

			//Switch on the ID of the element
			switch (this.id) { 
	
		        case 'where_to_buy_2': 
					_sr_Action='where_to_buy';	
					_sr_PageValue='3';	
					cb='2014737318';
					trackerid='1387';
		            break; //end where_to_buy  
	
		        case 'where_to_buy_3': 
					_sr_Action='=where_to_buy';	
					_sr_PageValue='3';
					cb='1979945880';
					trackerid='1390';	
		            break; //end where_to_buy  
	
		        case 'where_to_buy_4': 
					_sr_Action='=where_to_buy';    
					_sr_PageValue='3';
					cb='1565017586';
					trackerid='1393';	
		            break; //end where_to_buy  
	
		        case 'where_to_buy_5': 
					_sr_Action='=where_to_buy';    
					_sr_PageValue='3';
					cb='1772232303';
					trackerid='1402';	
		            break; //end 
	
		        case 'GA-Iphone': 
					_sr_Action='=download_for_iphone';	
					_sr_PageValue='2';	
					cb='2014737318';
					trackerid='1387';
		            break; //end download_for_iphone
	
		        case 'messy_play': 
					_sr_Action='=messy_play';   
					_sr_PageValue='2';
					cb='1979945880';
					trackerid='1390';	
		            break; //end messy_play 
	
		        case 'newsletter_register': 
					_sr_Action='newsletter_register';    
					_sr_PageValue='3';	
					cb='496304774';
					trackerid='1399';
		            break; //end newsletter_register 
	
		        case 'ccu_link': 
					_sr_Action='ccu_link';    
					cb='496304774';
					trackerid='1399';						
		            break; //end 
	
		        case 'cdw_link': 
					_sr_Action='cdw_link';    
					cb='496304774';
					trackerid='1399';						
		            break; //end 
	
		        case 'bleach_link': 
					_sr_Action='bleach_link';    
					cb='496304774';
					trackerid='1399';						
		            break; //end 
	
		        case 'sanitizing_spray_link': 
					_sr_Action='sanitizing_spray_link';    
					cb='496304774';
					trackerid='1399';						
		            break; //end 
	
		        case 'momBlog': 
					_sr_Action='mom_blog_post_comment';    
					_sr_PageValue='3';	
					cb='496304774';
					trackerid='1399';						
		            break; //end 
	
		        case 'GA-en-espanol': 
					_sr_Action='ALL_spanishsite';    
		            break; //end 
	
		        case 'formSubmitButton': 
					_sr_Action='ALL_EmailSignUp';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'GA-enterPABF': 
					_sr_Action='ALL_pabf';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'GA-enterPlay2Day': 
					_sr_Action='ALL_play2day';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'GA-enterNowSOW': 
					_sr_Action='ALL_sow';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'GA-getNewsletter': 
					_sr_Action='ALL_email';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'GA-getCouponTW': 
					_sr_Action='ALL_CTW_coupon';	
		            break; //end  
	
		        case 'GA-mom-moments-button': 
					_sr_Action='ALL_MomMoments';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'GA-dr-laundry-button': 
					_sr_Action='ALL_Dr.Laundry';	
		            break; //end  
	
		        case 'gameDisinfectorProtector': 
					_sr_Action='ALL_Game_DisenfectorProtector';	
		            break; //end  
	
		        case 'gameStacks': 
					_sr_Action='ALL_Game_Stacks';	
		            break; //end  
	
		        case 'gamePottyblox': 
					_sr_Action='ALL_Game_PottyBlox';	
		            break; //end  
	
		        case 'gameMahjongg': 
					_sr_Action='ALL_Game_Mahjongg';	
		            break; //end  
	
		        case 'gameSudoku': 
					_sr_Action='ALL_Game_Sudoku';	
		            break; //end  
	
		        case 'gameGermWipeout': 
					_sr_Action='ALL_Game_GermWipeout';	
		            break; //end  
	
		        case 'gameCleanUpCraze': 
					_sr_Action='ALL_Game_CleanUpCraze';	
		            break; //end  
	
		        case 'gameSeek': 
					_sr_Action='ALL_Game_SeekSanitize';	
		            break; //end  
	
		        case 'GA-Twitter': 
					_sr_Action='ALL_Twitter';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'joinFacebook': 
					_sr_Action='ALL_Facebook';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_reg': 
					_sr_Action='CLB_where_to_buy_reg';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_splashless': 
					_sr_Action='CLB_where_to_buy_splashless';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_scented': 
					_sr_Action='CLB_where_to_buy_scented';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_ultimate': 
					_sr_Action='CLB_where_to_buy_ultimate';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_HE': 
					_sr_Action='CLB_where_to_buy_HE';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_machine_cleaner': 
					_sr_Action='CLB_where_to_buy_machine_cleaner';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'where_to_buy_pen': 
					_sr_Action='CLB_where_to_buy_pen';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'video_bleach_nursery': 
					_sr_Action='CLB_nursery_video';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_bleach_kitchen': 
					_sr_Action='CLB_Kitchen_video';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_bleach_bathroom': 
					_sr_Action='CLB_bathroom_video';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_bleach_baby': 
					_sr_Action='CLB_baby_products_videos';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_bleach_house': 
					_sr_Action='CLB_house_videos';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'visit_drLaundry_blog': 
					_sr_Action='CLB_visit_drLaundry_blog';	
		            break; //end  
	
		        case 'submit_question_drlaundry': 
					_sr_Action='CLB_submit_question_drlaundry';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'C2_where_to_buy': 
					_sr_Action='C2_where_to_buy';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'C2_where_to_buy_StainRemover': 
					_sr_Action='C2_where_to_buy_StainRemover';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'video-mostoutofeveryload_he': 
					_sr_Action='C2_Video_HE';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video-fightstains_std': 
					_sr_Action='C2_Video_PreTreat';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video-mostoutofeveryload_std': 
					_sr_Action='C2_Video_Standard';	
					_sr_PageValue='2';	
		            break; //end  
		
		        case 'video_powerful_stain_removal': 
					_sr_Action='C2_Commercial_StainRemoval';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_noticeably_brighter': 
					_sr_Action='C2_Commercial_Brighter';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'video_save_money': 
					_sr_Action='C2_Commercial_SaveMoney';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'promoMyStain': 
					_sr_Action='C2_MyStain';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'C2_ShareButton': 
					_sr_Action='C2_ShareButton';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'C2_searchBar': 
					_sr_Action='C2_searchBar';	
		            break; //end  
	
		        case 'CCU_where_to_buy': 
					_sr_Action='CCU_where_to_buy';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'CCU_fb_like': 
					_sr_Action='CCU_fb_like';	
					_sr_PageValue='2';	
		            break; //end  
	
		        case 'CDW_where_to_buy': 
					_sr_Action='CDW_where_to_buy';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'TAO_where_to_buyATB': 
					_sr_Action='TAO_where_to_buyATB';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'TAO_where_to_buyATB_BLUE': 
					_sr_Action='TAO_where_to_buyATB_BLUE';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'TAO_where_to_buyTWS': 
					_sr_Action='TAO_where_to_buyTWS';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'TAO_where_to_buyBC': 
					_sr_Action='TAO_where_to_buyBC';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'TAO_fb_like': 
					_sr_Action='TAO_fb_like';	
					_sr_PageValue='3';	
		            break; //end  
	
		        case 'HW_bleach': 
					_sr_Action='HW_bleach';	
		            break; //end  
	
		        case 'HW_CDW': 
					_sr_Action='HW_CDW';	
		            break; //end  
	
		        case 'HW_CCU': 
					_sr_Action='HW_CCU';	
		            break; //end  
	
		        case 'HW_DSS': 
					_sr_Action='HW_DSS';	
		            break; //end  
		            
		        case 'GA-nominatePABF': 
					_sr_Action='ALL_pabf';	
					_sr_PageValue='2';	
		            break; //end  
		            
		        case 'GA-learnMorePlay2Day': 
					_sr_Action='ALL_play2day';
					_sr_PageValue='2';	
		            break; //end  
		            
		        case 'GA-shareBleachable':
		        	_sr_Action='ALL_bleachable';
		        	_sr_PageValue='2';
		        	break; //end    
		            
		        case 'GA-kitchenCentral':
		        	_sr_Action='ALL_kitchenCentral';
		        	_sr_PageValue='2';
		        	break; //end

				default:
					alert('Element has AKQA Tag class but unrecognized ID');
			}

			//Request the image
			akqatag.src = az_p + '//s0.srtk.net/www/delivery/ti.php' +
				'?trackerid=' + trackerid +
				'&cb=' + cb +
				'&_sr_PageValue=' + _sr_PageValue +
				'&_sr_Action=' + _sr_Action +
				'&r=' + az_r;	

			//Uncomment to debug
			//console.log(akqatag.src);
		})
	});

});

