function createCookie(cookie_name,cookie_value,cookie_days) {
	var date = new Date();
	if (cookie_days) {
		date.setTime(date.getTime()+(cookie_days*24*60*60*1000));
	} else {
		date.setTime(date.getTime()+(1*24*60*60*1000));
	}
	var expires = "; expires="+date.toGMTString();
	
	document.cookie = cookie_name+"="+cookie_value+"expires=; path=/";
	document.cookie = cookie_name+"="+cookie_value+expires+"; path=/";
}

function getPromoRotationCookie() {
	
	var cookie_match = false;
	var cookie_name = "promo_rotation";
	var cookie_value2 = "vetcorner";
	//var cookie_value3 = "vetcorner1";
	var cookie_value1 = "animalvote";
	
	var cookieArray = document.cookie.split(';');
	
	for(var i=0;i<cookieArray.length;i++) {
		
		var thisCookie = cookieArray[i];
		var thisCookieArray = thisCookie.split('=');
		var thisCookieName = thisCookieArray[0];
		var thisCookieValue = thisCookieArray[1];
		
		thisCookieName = thisCookieName.replace(" ", "");
		cookie_name = cookie_name.replace(" ", "");
		thisCookieValue = thisCookieValue.replace(" ", "");
		cookie_value1 = cookie_value1.replace(" ", "");
		
		if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value2)) {
			
			cookie_match = true;
			createCookie('promo_rotation','animalvote',30);
			
			document.write(''+
			'<table border="0" cellpadding="0" cellspacing="0" width="241">'+
									'<tr>'+
										'<td colspan="3" height="1" class="border_dash_horizontal"></td>'+
									'</tr>'+
									'<tr>'+
										'<td class="border_dash_vertical"></td>'+
										'<td bgcolor="#CCF2FF"><img src="/img/home/home_btm_vetcorner.gif" border="0" alt="Now in Vet Corner" /></td>'+
										'<td class="border_dash_vertical"></td>'+
									'</tr>'+
								 	'<tr>'+
										'<td class="border_dash_vertical"></td>'+
										'<td width="239" height="202" bgcolor="#ffffff">'+
											'<table cellpadding="0" cellspacing="0" border="0">'+
												'<tr>'+
													'<td colspan="2" align="left" valign="middle" style="padding-top:2px;padding-bottom:2px;padding-left:5px;">This Month:&nbsp;<strong><i>Providing Purrfect Play</i></strong></td>'+
												'</tr>'+
												'<tr>'+
													'<td align="left" valign="top" style="padding-left:5px;"><img src="/img/home/btm_promo_vetcorner_10.jpg" border="0" alt="cat claws" /></td>'+
													'<td align="left" valign="top" style="padding-left:5px;padding-right:5px;">How well do you know your cat? Dig into our articles and you may be surprised at what you find. Check back every month for a fresh topic!</td>'+
												'</tr>'+
												'<tr>'+
													'<td colspan="2" align="right" valign="top" style="padding-right:5px;padding-bottom:5px;"><a href="/cat_health/"><img onClick="loadTrackingImages(\'/img/tracking.png?pageID=HomepageVetCornerPromoBtn\')" src="/img/home/btn_find_out.gif" border="0" alt="Find Out Here" /></a></td>'+
												'</tr>'+
											'</table>'+
										'</td>'+
										'<td class="border_dash_vertical"></td>'+
									'</tr>'+
									'<tr>'+
										'<td colspan="3" height="1" class="border_dash_horizontal"></td>'+
									'</tr>'+
								'</table>'
			);
			 
		//} else if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value3)) {
			
		//	cookie_match = true;
		//	createCookie('promo_rotation','animalvote',30);
		//	document.write('<a href="housekeeping.php"><img alt="Fresh Step wins a 2007 Good Housekeeping Good Buy Award" src="/img/good_house.gif" border="0"></a>');
			
		} else if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value1)) {
			
			cookie_match = true;
			createCookie('promo_rotation','vetcorner',30);
			document.write('<div class="bottom_promo last"><div class="content"><div class="img_last"><img src="/img/animal_hero.jpg" alt="Voting for Animal Planet 2008 Hero of the Year is now closed. Stay tuned for the reveal starting November 17." /></div><p>Voting for <strong>Animal Planet 2008 Hero of the Year</strong> is now closed. Stay tuned for the reveal starting November 17.</p></div><div class="cta"><a href="http://animal.discovery.com/convergence/hero_of_the_year/hero.html" onMouseover="exitFreshStep();" onMouseout="removePopup();" onMouseout="removePopup();" onClick="loadTrackingImages(\'/img/tracking.png?pageID=HomepageAnimalPlanet2008\')" target="_blank"><img src="/img/go_cta.gif" alt="Go" /></a></div><br /><p id="exitfreshstep" class="popup" style="display: none;">You are exiting the www.freshstep.com website. The Clorox Company is not responsible for the content or data collection of that independent site.</p></div>');
			
		}
	}
	if (cookie_match == false) {
		createCookie('promo_rotation','vetcorner',30);
			document.write('<div class="bottom_promo last"><div class="content"><div class="img_last"><img src="/img/animal_hero.jpg" alt="Voting for Animal Planet 2008 Hero of the Year is now closed. Stay tuned for the reveal starting November 17." /></div><p>Voting for <strong>Animal Planet 2008 Hero of the Year</strong> is now closed. Stay tuned for the reveal starting November 17.</p></div><div class="cta"><a href="http://animal.discovery.com/convergence/hero_of_the_year/hero.html" onMouseover="exitFreshStep();" onMouseout="removePopup();" onMouseout="removePopup();" onClick="loadTrackingImages(\'/img/tracking.png?pageID=HomepageAnimalPlanet2008\')" target="_blank"><img src="/img/go_cta.gif" alt="Go" /></a></div><br /><p id="exitfreshstep" class="popup" style="display: none;">You are exiting the www.freshstep.com website. The Clorox Company is not responsible for the content or data collection of that independent site.</p></div>');
	}
	
}


//Second rotating burst

function getPromoRotationCookie2() {
	
	var cookie_match = false;
	var cookie_name = "promo_rotation2";
	var cookie_value2 = "doctor";
	//var cookie_value3 = "vetcorner1";
	var cookie_value1 = "science";
	
	var cookieArray = document.cookie.split(';');
	
	for(var i=0;i<cookieArray.length;i++) {
		
		var thisCookie = cookieArray[i];
		var thisCookieArray = thisCookie.split('=');
		var thisCookieName = thisCookieArray[0];
		var thisCookieValue = thisCookieArray[1];
		
		thisCookieName = thisCookieName.replace(" ", "");
		cookie_name = cookie_name.replace(" ", "");
		thisCookieValue = thisCookieValue.replace(" ", "");
		cookie_value1 = cookie_value1.replace(" ", "");
		
		if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value2)) {
			
			cookie_match = true;
			createCookie('promo_rotation2','fresh',30);
			
			document.write('<h2><img src="/img/home/promo2_h.gif" alt="New cat or kitty" /></h2><div class="content"><div class="img"><img src="/img/home/woman_hugging_kitten.jpg" alt="photo: woman hugging kitten" /></div><p>Download a free welcome home brochure with advice from top animal behaviorist, Dr. Peter Borchelt.</p></div><div class="cta"><a href="/adoption/brochure.php"><img src="/img/downloadpdf_btn.gif" alt="Download PDF" /></a></div>'
			);
			 
		//} else if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value3)) {
			
		//	cookie_match = true;
		//	createCookie('promo_rotation','animalvote',30);
		//	document.write('<a href="housekeeping.php"><img alt="Fresh Step wins a 2007 Good Housekeeping Good Buy Award" src="/img/good_house.gif" border="0"></a>');
			
		} else if ((thisCookieName == cookie_name) && (thisCookieValue == cookie_value1)) {
			
			cookie_match = true;
			createCookie('promo_rotation2','doctor',30);
			document.write('<h2><img src="/img/home/promo4_h.gif" alt="Try our scented scoopable litter" /></h2><div class="content"><div class="img"><img src="/img/home/promo_freshexp.jpg" alt="photo: fresh expressions" /></div><p>Enjoy the inviting scents of Fresh Step&reg; Fresh Expressions&#8482; Scoopable litter.</p></div><div class="cta"><a href="/prodfreshexpressions.php"><img src="/img/learnMore.gif" alt="Download PDF" /></a></div>'
			);
			
		}
	}
	if (cookie_match == false) {
		createCookie('promo_rotation2','doctor',30);
			document.write('<h2><img src="/img/home/promo4_h.gif" alt="Try our scented scoopable litter" /></h2><div class="content"><div class="img"><img src="/img/home/promo_freshexp.jpg" alt="photo: fresh expressions" /></div><p>Enjoy the inviting scents of Fresh Step&reg; Fresh Expressions&#8482; Scoopable litter.</p></div><div class="cta"><a href="/prodfreshexpressions.php"><img src="/img/learnMore.gif" alt="Download PDF" /></a></div>'
			);
	}
	
}
