// set the onload event to run the init function
window.onload = function(){init()};

function init()
{
	// read the section id from the cookie
	var sid = readCookie("sectionid");
	
	// if it's not null & it's different to the current section id launch the popup
	if(sid!=null&&sid!=sectionid) popup();
	
	// write the current section id to the cookie
	createCookie("sectionid",sectionid,30)
}

function popup()
{
	// only launch the survey if they haven't seen one before
	if(readCookie("ngsurvey")==null)
	{
		// get the url depending on the section cookie value
		var url = "";
		var sid = readCookie("sectionid");
		
		switch(sid)
		{
			case "education":
				url = "http://clicktools.com/dashboard/survey/go.jsp?iv=108292f5e55154";
				break;
			case "collection":
				url = "http://clicktools.com/dashboard/survey/go.jsp?iv=108292efdd5153";
				break;
			case "plan":
				url = "http://clicktools.com/dashboard/survey/go.jsp?iv=108292fb07e156";
				break;
			case "whatsonexhib":
				url = "http://clicktools.com/dashboard/survey/go.jsp?iv=1082930171f157";
				break;
		}
	
		// launch the survey popup window
		survey = window.open(url,"survey","width=550,height=500,resizable=yes");
		if(survey!=null)
		{
			createCookie("ngsurvey","true",30)
			survey.focus();
		}
	}
}
