var s = "" + window.location;
var sSplit = s.split("\/");
if (sSplit[3] == "corp" && sSplit[4] == "index.jsp") {
	window.location = "http://www.irobot.com";
}

function showCustomPopUp2(thisUrl,thisName,theseParams) {
	remote = open(thisUrl, thisName, theseParams);
}

function showCustomPopUpFront(thisUrl,thisName,theseParams) {
	remote = window.open(thisUrl, thisName, theseParams);
	remote.focus();
}

function showCustomPopUpRR(thisUrl) {
	remote = window.open('http://resources.irobot.com/index.php/' + thisUrl, 'newWin', 'width=602,height=520,scrollbars=0,resizable=0');
	remote.focus();
}
function showCustomPopUpChat() {
	remote = window.open('http://homesupport.irobot.com/cgi-bin/irobot_homesupport.cfg/php/enduser/chat.php','newWin','width=648,height=615,scrollbars=no,resizable=yes');
	remote.focus();
}

function irobotonloadhandler() {
	if (document.getElementById('hpASpot') != null) {
		storeFront040109Rotate();
	}
	if (document.getElementById('hpASpot041009') != null) {
		storeFront041009Rotate();
	}
	if (document.getElementById('chatButton') != null) {
		checkChatHours();
	}
}

function storeFront040109Rotate() {
	window.setTimeout("storeFront040109Change(2)", 3000);
	window.setTimeout("storeFront040109Change(1)", 10000);
	window.setTimeout("storeFront040109Change(3)", 13000);
	window.setTimeout("storeFront040109Change(1)", 20000);
	window.setTimeout("storeFront040109Rotate()", 20000);
}
function storeFront040109Change(divID) {
	document.getElementById('rotate1').style.display = "none";
	document.getElementById('rotate2').style.display = "none";
	document.getElementById('rotate3').style.display = "none";
	document.getElementById('rotate' + divID).style.display = "block";
}

function storeFront041009Rotate() {
	window.setTimeout("storeFront041009Change(2)", 4000);
	window.setTimeout("storeFront041009Change(1)", 11000);
	window.setTimeout("storeFront041009Rotate()", 11000);
}
function storeFront041009Change(divID) {
	document.getElementById('rotate1').style.display = "none";
	document.getElementById('rotate2').style.display = "none";
	document.getElementById('rotate' + divID).style.display = "block";
}

function checkChatHours() {
	var currentDate = new Date();
	if (currentDate.getUTCHours() - 4 < 20 && currentDate.getUTCHours() - 4 > 8) {
		document.getElementById('chatButton').style.display = "block";
	}
}

window.onload = irobotonloadhandler;
