var popUpWin = null;

var urls = new Array(	"http://www.jwt.com",
						"http://www.ogilvy.com",
						"http://www.mccann.com",
						"http://www.yr.com",
						"http://www.deutschinc.com",
						"http://www.ddb.com"
					);

function gotoURL() {
	top.location.href = getRandomURL();
}

function getRandomURL() {
	return urls[Math.round(Math.random() * (urls.length - 1))];	
}

function setPopUpWindowRandom() {
	setPopUpWindow("resources/caution.html", screen.width / 2 - 400, screen.height / 2 - 300, 800, 600);
}

function setPopUpWindowNews() {
	setPopUpWindowWithScrollbars("http://inform-ventures.com/blog/", screen.width / 2 - 500, 0, 1000, screen.height);
}

function setPopUpWindow(URLStr, left, top, width, height) {
	if(popUpWin) {
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = window.open(URLStr, "popUpWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width="+width+",height="+height+",left="+left+", top="+top+",screenX="+left+",screenY="+top+'');
	
	if(!popUpWin) {
		alert('In order to view this site, you have to allow popups in your browser!');
	}
	popUpWin.focus();
}

function setPopUpWindowWithScrollbars(URLStr, left, top, width, height) {
	if(popUpWin) {
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = window.open(URLStr, "popUpWin", "toolbar=no,location=yes,directories=yes,status=yes,menubar=yes,scrollbar=yes,scrollbars=1,resizable=yes,copyhistory=yes,width="+width+",height="+height+",left="+left+", top="+top+",screenX="+left+",screenY="+top+'');
	
	if(!popUpWin) {
		alert('In order to view this site, you have to allow popups in your browser!');
	}
	popUpWin.focus();
}

function setPopUpWindowAutoPos(URLStr, width, height) {
	setPopUpWindow(URLStr, screen.width/2 - width, screen.height/2 * 0.97 - height, width, height);
}

