function getCookie(cook) {
    var start = document.cookie.indexOf(cook+"=");
    var len = start+cook.length+1;
    if ((!start) && (cook != document.cookie.substring(0,cook.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

hImages = new Array("ss10_growyourown.gif","ss10_hangon.gif","ss10_products.gif","ss10_takecomfort.gif","ss10_treatyourself.gif");
hURL = new Array ("limitededitions.aspx?type=2","collections.aspx?type=2&collection=Stapled Clog","limitededitions.aspx","collections.aspx?type=2&collection=Acadia","occupational.aspx?type=2");
var imgCt = hImages.length;

var thisImg = 1;
var myCookie = getCookie("homey");
if (myCookie != null) {
	var mc = parseFloat(myCookie) + 1;
	if (mc > 2) {
		mc = 0;	
	}
		thisImg = mc;
} else {
	thisImg = Math.floor(Math.random()*3);
}

document.cookie = "homey=" + thisImg;

function rotate() {
	if (document.images){
		thisImg++;
		if (thisImg == imgCt) {
			thisImg = 0;
		}
		var img2 = thisImg+1;
		if (img2 == imgCt) {
			img2 = 0;	
		}
		var img3 = img2+1;
		if (img3 == imgCt) {
			img3 = 0;	
		}
		if (document.home1.complete) {
			document.home1.src = "images/home/" + hImages[thisImg];
			document.getElementById("link1").href = hURL[thisImg];
		}
		if (document.home2.complete) {
			document.home2.src = "images/home/" + hImages[img2];
			document.getElementById("link2").href = hURL[img2];
		}
		if (document.home3.complete) {
			document.home3.src = "images/home/" + hImages[img3];
			document.getElementById("link3").href = hURL[img3];
		}
		timer = setTimeout("rotate()", 15*1000);
		document.cookie = "homey=" + thisImg;
	}
}
timer = setTimeout("rotate()", 5*1000);
//rotate();
// end hiding script -->