//window.onload = initHomePage;

function initHomePage(){

	document.getElementById("recipes").onclick = goToPage;
	document.getElementById("products").onclick = goToPage;
	document.getElementById("commercials").onclick = goToPage;
	document.getElementById("tour").onclick = goToPage;
}

function goToPage(e){
	var targ = getTarget(e,"DIV");
	var id = targ.id;
	var page = id + ".aspx";
	
	if (targ.id == "recipes")
	    window.location = "sitecontent/feature/";
	if (targ.id == "products")
	    window.location = "products/default.aspx?PostId=35";
	if (targ.id == "commercials")
	    window.location = "sitecontent/videos";
	if (targ.id == "tour")
	    window.location = "d-lights/";
}

// gets a reference to the clicked item
function getTarget(e,element)
{
	if (!e) var e = window.event;
	if (e.target) var tg = e.target;
	else if (e.srcElement) var tg = e.srcElement;
	while (tg.nodeName != element) // Safari
		tg = tg.parentNode;
		
	// returns the item represented by var tg
	return tg;
}	

//generic openWin that accepts parameter settings
function openWin(url,name,params) {
		theWin = window.open(url,name,params);
		theWin.focus();
}