﻿//To work with Accessibility buttons.///////////////////////var cookieEnabled=(navigator.cookieEnabled)? true : falsefunction noCookies () {alert ("This functionality requires you to accept Cookies in your browser!")}//create cookiefunction createCookie(name,value,days){	if (days)	{		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";}//read cookiefunction getCookie(name){	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++)	{		var c = ca[i];		while (c.charAt(0)==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;}//writes first stylesheets.if (getCookie("size")==null) {createCookie ("size", 0, 0);createCookie ("font", 0, 0);createCookie ("contrast", 0, 0);createCookie("caps", 0, 0);createCookie("leading", 0, 0);}//writes style sheet into page.function writeStyleSheet(stylesheet) {var path = "css/" + stylesheet + ".css";var link = '<link rel="stylesheet" media="all" type="text/css" href="'+path+'" />';document.write(link);}//write all stylesheets, called when page reloadsfunction writeStylesheets(){//strip cookie to relevant partsif (cookieEnabled) {size = getCookie("size");font = getCookie("font");contrast = getCookie("contrast");caps = getCookie("caps");leading = getCookie("leading")}else {size = 0;font = 0;contrast = 0;caps = 0;leading = 0;}//write size sheetwriteStyleSheet("size"+size);//write leading sheetwriteStyleSheet("leading"+leading);//write contrastwriteStyleSheet("contrast"+contrast);//write fontwriteStyleSheet("font"+font);//write capswriteStyleSheet("caps"+caps);}//individual function buttons//sizeUpfunction sizeUp(){if (cookieEnabled){var currentsize = getCookie("size");if (currentsize<2) currentsize++;size = currentsize;createCookie("size", size, 0);self.location = self.location;}else noCookies();}//sizeDownfunction sizeDown(){if (cookieEnabled){var currentsize = getCookie("size");if (currentsize>0) currentsize--;size = currentsize;createCookie("size", size, 0);self.location = self.location;}else noCookies();}//leadingUpfunction leadingUp(){if (cookieEnabled){var currentleading = getCookie("leading");if (currentleading<2) currentleading++;leading = currentleading;createCookie("leading", leading, 0);self.location = self.location;}else noCookies();}//leadingDownfunction leadingDown(){if (cookieEnabled){var currentleading = getCookie("leading");if (currentleading>0) currentleading--;leading = currentleading;createCookie("leading", leading, 0);self.location = self.location;}else noCookies();}//fontfunction toggleFont(){if (cookieEnabled){var currentFont = getCookie("font");if (currentFont == 0) font = 1else font = 0createCookie("font", font, 0);self.location = self.location;}else noCookies();}//capsfunction toggleCaps(){if (cookieEnabled){var currentCaps = getCookie("caps");if (currentCaps == 0) caps = 1else caps = 0createCookie("caps", caps, 0);self.location = self.location;}else noCookies();}//contrastfunction toggleContrast() {if (cookieEnabled){var currentContrast = getCookie("contrast");if (currentContrast == 0) contrast = 1;else contrast = 0;createCookie("contrast", contrast, 0);self.location = self.location;}else noCookies();}//defaultfunction reset(){if (cookieEnabled){var size=0;var leading=0;var caps=0;var contrast=0;var font=0;createCookie("size", size, 0);createCookie("leading", leading, 0);createCookie("caps", caps, 0);createCookie("contrast", contrast, 0);createCookie("font", font, 0);self.location = self.location;}else noCookies();}