function writeDate(){
	months = new Array();
	months[0]  = "January";
	months[1]  = "February";
	months[2]  = "March";
	months[3]  = "April";
	months[4]  = "May";
	months[5]  = "June";
	months[6]  = "July";
	months[7]  = "August";
	months[8]  = "September";
	months[9]  = "Ocetober";
	months[10] = "November";
	months[11] = "December";
	todaysDate = "";
	myDate = new Date();
	//todaysDate = months[myDate.getMonth()] + " " + myDate.getDate() + ", " + myDate.getYear() + "<br />";
	todaysDate = months[myDate.getMonth()] + " " + myDate.getDate() + ", " + myDate.getUTCFullYear() + "<br />";
	document.write(todaysDate);
}

var blnPrompt = 1;
var downloadPage = 'thank-you-download.php';

function dontGo(){
	if(blnPrompt){
		msg  = '>>>>>>>>>>>>>>>>>>> WAIT WAIT WAIT <<<<<<<<<<<<<<<<<<<\n';
		msg += 'I realize that you probably don\'t want to give your email to\n';
		msg += 'just anybody - even if it means getting some incredible\n';
		msg += 'bonuses.\n\n';
		msg += 'But I\'m so confident that you need this book that I want you\n';
		msg += 'to download 2 Free Chapters without even giving up your email!\n\n';
		msg += 'Just click CANCEL to stay and download the eBook or OK if you\n';
		msg += 'really want to pass up this opportunity.';
		setTimeout("goToDownload();",1000);
		return msg;
	}

}

function addEvents(){
	var a = document.getElementsByTagName('A');
	var f = document.getElementsByTagName('FORM');
	for(i = 0; i < a.length; i++){
		if(typeof a[i].onclick != 'function'){
			a[i].onclick = killPrompt;
		}
	}
	for(i = 0; i < f.length; i++){
		if(typeof f[i].onclick != 'function'){
			if(!f[i].onclick){
				f[i].onclick = killPrompt;
			} else if(!f[i].onsubmit){
				f[i].onsubmit = killPrompt;
			}
		}
	}
}

function killPrompt(){
	blnPrompt = 0;
}

function goToDownload(){
	blnPrompt = 0;
	window.location = downloadPage;
}

function showPreview(){
	window.onbeforeunload = null;
	/*alert('eBook preview is in the works!');*/
}

window.onload = addEvents;
/*window.onbeforeunload = dontGo;*/