// Browser Warning Script
// If browser has not been tested with browser, display warning
if(showBrowserWarning && document.cookie.indexOf("notTested=reported") ==-1) {
	var warningHTML
	= "<h1>Please Note:</h1>"
	+ "<p>Your browser has not been tested with this website. New W3C standards are used as well "
	+ "as advanced Javascript, which may not be compatible.<br />If you have any problems, or see strange "
	+ "or wrong looking page-layouts, please update your browser to the newest version of "
	+ "Safari, Chrome, Firefox or Internet Explorer.</p>"
	+ "<p>If you have time, please write to let us know how your browser works with the site, so we "
	+ "can improve your experience by removing this warning message if it works,<br />or turning off the "
	+ "features that do not work in your browser and removing this message. Thank you.</p>"
	+ "<p align='right'><button id='closeBrowserWarning'>No Thanks.</button>"
	+ "&nbsp;&nbsp;"
	+ "<button id='remindBrowserWarning'>Remind me in 5 minutes.</button>"
	+ "&nbsp;&nbsp;"
	+ "<button id='respondBrowserWarning'>Let us know.</button></p>";
	
	$("<div id='browserWarning' />")
		.html(warningHTML)
		.appendTo(document.body);
		
	$("#remindBrowserWarning").click(remindBrowserWarning);
	$("#closeBrowserWarning").click(closeBrowserWarning);
	$("#respondBrowserWarning").click(respondBrowserWarning);
}

function remindBrowserWarning() {
	$("#browserWarning").slideUp(300, function() {$("#browserWarning").remove();});
	var currentDate = new Date();
	currentDate.setMinutes(currentDate.getMinutes()+5);
	var expires = "expires="+currentDate.toGMTString();
	
	document.cookie = "notTested=reported;"+expires+";path=/";
}

function closeBrowserWarning() {
	setCookie();	
}

function respondBrowserWarning() {
	var emailMessage 
		= "Reporting Browser warning from following user agent:\r"
		+ navigator.userAgent + "\r\r"
		+ "Reports the following:\r";
	var emailSubject = "Reporting on untested browser";
	
	location.href = "mailto:bairdleon@mac.com?subject="+emailSubject+"&body="+encodeURI(emailMessage);
	setCookie();
}

function setCookie() {
	$("#browserWarning").slideUp(300, function() {$("#browserWarning").remove();});
	
	var currentDate = new Date();
	currentDate.setHours(currentDate.getHours()+24);
	var expires = "expires="+currentDate.toGMTString();
	
	document.cookie = "notTested=reported;"+expires+";path=/";
}
