function writeCookie (CookieName, CookieValue) {
	document.cookie = escape(CookieName ) + '=' + escape(CookieValue) + ';  path=/';window.location = (unescape(window.location.pathname));
}

function getCookieValue (cookieName) {
	var exp = new RegExp (escape(cookieName) + '=([^;]+)');
	if (exp.test (document.cookie + ';')) {
		exp.exec (document.cookie + ';');
		return unescape(RegExp.$1);
	} else return false;
}

switch (getCookieValue('TextMode')) {
	case 'textonly':
		break;
	case 'normal':
		default:
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/style.css" media="screen" type="text/css">');
		break;
}

/*switch (getCookieValue('Colour')) {
	case 'normal':
		default:
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/styles-default.css" media="screen" type="text/css">');
		break;
	case 'yelblack':
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/styles-yellow-black.css" media="screen" type="text/css">');
		break;
	case 'blackyel':
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/styles-black-yellow.css" media="screen" type="text/css">');
		break;
}

switch (getCookieValue('TextMode')) {
	case 'normal':
		break;
	case 'textonly':
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/styles-text-only.css" media="screen" type="text/css">');
		break;
}*/

switch (getCookieValue('TextSize')) {
	case 'a':
		default:
		//document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/style-normal.css" media="screen" type="text/css">');
		break;
	case 'aa':
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/style-large.css" media="screen" type="text/css">');
		break;
	case 'aaa':
		document.write('<link rel="StyleSheet" href="/wp-content/themes/sandbox/www.honorarydoctors.org/style-largest.css" media="screen" type="text/css">');
		break;
}


function genAccessibilityBar( url ) {

    var url = (url == null) ? '' : url;
    
    document.write('<ul class="accessibility" >');

    /*document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'TextMode\',\'normal\');"><span class="textonly">Graphical Layout</span></a></li>');
    document.write('<li><a href="'+ url+ '#" onclick="javascript:writeCookie(\'TextMode\',\'textonly\');">Text Only Layout</a></li>');

    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'Colour\',\'normal\');"><img src="images/fullcolour.gif" alt="Colours: Default Colours" style="width:1.25em" /><span class="textonly">Default</span></a></li>');
    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'Colour\',\'yelblack\');"><img src="images/blackonyell.gif" alt="Colours: Black on Yellow" style="width:1.25em" /><span class="textonly">Black/Yellow</span></a></li>');
    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'Colour\',\'blackyel\');"><img src="images/yellonblack.gif" alt="Colours: Yellow on Black" style="width:1.25em" /><span class="textonly">Yellow/Black</span></a></li>');*/

    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'TextSize\',\'a\');"><img src="/wp-content/themes/sandbox/www.honorarydoctors.org/images/small-a.png" alt="Standard text size" /><span class="textonly">Text standard</span></a></li>');
    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'TextSize\',\'aa\');"><img src="/wp-content/themes/sandbox/www.honorarydoctors.org/images/medium-a.png" alt="Larger text size" /><span class="textonly">Text Larger</span></a></li>');
    document.write('<li><a href="'+ url + '#" onclick="javascript:writeCookie(\'TextSize\',\'aaa\');"><img src="/wp-content/themes/sandbox/www.honorarydoctors.org/images/large-a.png" alt="Largest text size" /><span class="textonly">Text Largest</span></a></li>');
    document.write('</ul>');
}