/**
 * @author Syl
 */


function initializeHome() 
{
	//first grab the "Digest","Concept", and "Technical" sections
	var digestSection = YAHOO.util.Dom.get("digest");
	var conceptSection = YAHOO.util.Dom.get("concept");
	var technicalSection = YAHOO.util.Dom.get("technical");
	
	var digestLinks = digestSection.getElementsByTagName("a");
	var conceptLinks = conceptSection.getElementsByTagName("a");
	var technicalLinks = technicalSection.getElementsByTagName("a");
	for(var i=0; i< digestLinks.length; i++)
	{		
		YAHOO.util.Event.addListener(digestLinks[i], "click", setCookie, "Digest", true);
	}
	
	for(var i=0; i< conceptLinks.length; i++)
	{		
		YAHOO.util.Event.addListener(conceptLinks[i], "click", setCookie, "Concept", true);
	}
	
	for(var i=0; i< technicalLinks.length; i++)
	{		
		YAHOO.util.Event.addListener(technicalLinks[i], "click", setCookie, "Technical", true);
	}
}

function setCookie(e, type)
{
	//remove the cookie (if it existed)
	YAHOO.util.Cookie.remove("type");
	//set the cookie
	YAHOO.util.Cookie.set("type", type);
	
	//go to the linked page
	window.location = e.href;
	
}


function landingPage(e, id)
{	
	//set the cookie
	YAHOO.util.Cookie.set("type", id);

	//redirect to landing page	
	window.location = id.toLowerCase()+".html";
}

YAHOO.util.Event.onDOMReady(initializeHome);
