//newsletter objects
function newsletter(title, url, date, year) {
	this.title = title;
	this.url = url;
	this.date = date;
	this.year = year;
}

//newsletter popup window
function popWin(theURL, winName) {
	newWin = window.open("http://www.healthvote.org/updates/newsletterFrameset.html?page=" + theURL, winName, "width=625, height=500, scrollbars=auto, resizable, statusbar=true");
	newWin.focus();
}

//get filename of current page
function getFilename() {
	var theFile = main.document.URL.substr(main.document.URL.indexOf("updates")+ 8, main.document.URL.length);
	/* only needed if URL is in subdirectory
	if (theFile.indexOf("\\") != -1) {
		theFileAr = theFile.split("\\");
	}
	else {
		theFileAr = theFile.split("/");
	}
	theFilename = theFileAr[0] + '/' + theFileAr[1];
	*/
	theFilename = theFile;
	return theFilename;
}

//get the current array
function getAr() {
	var pageFilename = getFilename();
	thisAr = eval('newsletterAr');
	return thisAr;
}

//get the current index
function getIndex(theArray) {
	var pageFilename = getFilename();
	for (i=0;i<theArray.length;i++) {
		if (pageFilename == theArray[i].url) {
			thisArNum = i;
		}
	}
	return thisArNum;
}

//go to previous release
function goPrevious(theArray, theIndex) {
	prevIndex = parseInt(theIndex) - 1;
	if (prevIndex > -1) {
		main.location.href = theArray[prevIndex].url;
		nav.location.reload();
	}
}

//go to next release
function goNext(theArray, theIndex) {
	nextIndex = parseInt(theIndex) + 1;
	if (nextIndex < theArray.length) {
		main.location.href = theArray[nextIndex].url;
		nav.location.reload();
	}
}

function showList() {
		htmlStr = "";
		for (i=newsletterAr.length-1; i>-1; i--) {
			itemObj = newsletterAr[i];
			htmlStr += '<li class="paragraph"> ' + itemObj.date + ': <a href="javascript:popWin(\'http://www.healthvote.org/updates/' + itemObj.url + '\', \'newsletterWin\')">' + itemObj.title + '</a></li>';
		}
		return htmlStr;
}

var newsletterAr = new Array();
/*
newsletterAr[0] = new newsletter("HealthVote.org Re-Launches for 2006 Election with New Features", "SiteLaunchPublic_090606.html", "September 6, 2006", "2006")
newsletterAr[1] = new newsletter("$43.5 Million Raised for Health Initiatives", "091506.html", "September 15, 2006", "2006")
newsletterAr[2] = new newsletter("Prop. 86 Tobacco Tax Battle Inundating the Airwaves", "092206.html", "September 22, 2006", "2006")
newsletterAr[3] = new newsletter("AdWatch Analysis of Prop. 86 TV Spots Separates Facts from Spin", "092906.html", "September 29, 2006", "2006")
newsletterAr[4] = new newsletter("Prop. 86 TV Advertising Influences Poll Results", "100606.html", "October 6, 2006", "2006")
newsletterAr[5] = new newsletter("$76.8 Million Raised For Health-Related Ballot Measure Campaigns", "101306.html", "October 13, 2006", "2006")
newsletterAr[6] = new newsletter("Newspapers Statewide Weighing in on Props. 85 and 86", "102006.html", "October 20, 2006", "2006")
newsletterAr[7] = new newsletter("TV Ads Blanket Airwaves in Election's Final Two Weeks", "102706.html", "October 27, 2006", "2006")
newsletterAr[8] = new newsletter("New Field Poll Report Shows Races Too Close to Call", "110306.html", "November 3, 2006", "2006")
newsletterAr[9] = new newsletter("Voters Reject Tobacco Tax Increase and Parental Notification", "110806.html", "November 8, 2006", "2006")
newsletterAr[10] = new newsletter("New Report Examines Forces That Led to Defeat of Prop. 86", "122006.html", "December 20, 2006", "2006")
newsletterAr[11] = new newsletter("Voters Adopt High-Profile Health Measures - And Then What?", "062207.html", "June 22, 2007", "2007")
*/
// 2009
newsletterAr[0] = new newsletter("HealthVote.org Launches Special Election Coverage to Track Health-Related Measures", "042009.html", "April 20, 2009", "2009")
newsletterAr[1] = new newsletter("Budget Compromise Goes Down in Defeat", "052109.html", "May 21, 2009", "2009")

// - from 2008
/*
newsletterAr[0] = new newsletter("HealthVote.org Launches November Ballot Coverage", "090408.html", "September 4, 2008", "2008")
newsletterAr[1] = new newsletter("Health-Related California Ballot Initiative Committees Raise $15.3 Million", "091208.html", "September 12, 2008", "2008")
newsletterAr[2] = new newsletter("After Two Failed Parental Notification Initiatives, Backers and Opponents Keep Spending", "091808.html", "September 18, 2008", "2008")
newsletterAr[3] = new newsletter("What Would Prop. 3 Mean for California's Bottom Line?", "092508.html", "September 25, 2008", "2008")
newsletterAr[4] = new newsletter("Props. 3 and 4 May Be Decided by Voter Drop-off", "100208.html", "October 2, 2008", "2008")
newsletterAr[5] = new newsletter("Parental Notification Opponents Rerun 2006 Ad", "100908.html", "October 9, 2008", "2008")
*/

/*
newsletterAr[0] = new newsletter("New Web Site Helps Media & Public Assess Health Ballot Initiatives", "090605.html", "September 6, 2005", "2005")
newsletterAr[1] = new newsletter("New AdWatch Analysis Focuses on Factual Accuracy of Ads, Not Spin", "092105.html", "September 21, 2005", "2005")
newsletterAr[2] = new newsletter("Advocates for Proposition 78 Blanket Airwaves", "093005.html", "September 30, 2005", "2005")
newsletterAr[3] = new newsletter("Millions of Dollars Collected For and Against Props. 78 & 79", "100705.html", "October 7, 2005", "2005")
newsletterAr[4] = new newsletter("First Yes on Proposition 79 Television Commercial Relies on Emotion, Not Statistics", "101405.html", "October 14, 2005", "2005")
newsletterAr[5] = new newsletter("RAND Releases In-Depth Report Examining Competing Initiatives", "102105.html", "October 21, 2005", "2005")
newsletterAr[6] = new newsletter("Newspapers Publish Wave of Endorsements on Special Election Health Care Measures", "102805.html", "October 28, 2005", "2005")
newsletterAr[7] = new newsletter("New Field Poll Report Shows 'No' on Props. 73, 78 & 79 Leading", "110205.html", "November 2, 2005", "2005")
*/
