// JavaScript Document
//alert(document.cookie());
	function resizeText(n){
		//alert('value received is' +n);
		var bod = document.getElementById('BODY');
		switch(n){
		case '1':
			bod.style.fontSize = "100.1%";
			document.cookie = "font-size=1; path=/";
			break;
		case'2':
			bod.style.fontSize = "110.1%";
			document.cookie = "font-size=2; path=/";
			break;
		case '3':
			bod.style.fontSize = "120.1%";
			document.cookie = "font-size=3; path=/";
			break;
		default:
			bod.style.fontSize = "100.1%";
			document.cookie = "font-size=0; path=/";
			}
	}
	
function fontSizeCookieCheck(){
	var c = document.cookie;
	var string = 'font-size';
	var cvar = c.indexOf(string);
	if(cvar == -1){}else{
		cvar +=10;
		var n = c.substring(cvar,cvar+1);
		//alert('value passsed to func id '+n);
		resizeText(n);
		}
	}
	
function PrintPage(){
	window.print();
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function deleteCookie(name){
	
	var d = new Date();
	d.setDate(d.getTime()-100000);
	document.cookie = name + '=; expires=' + d.toGMTString();
	
}

function contrastCookieCheck(){
	
	var string = get_cookie('contrast');
	if((string == '') || (string == null)){}else{
	/*	cvar +=9;
		var n = c.substring(cvar,cvar+1);
		//alert('value passsed to func id '+n);
		alert('n is equal to: '+n);*/
	if(string == '0'){
		//The page isn;t of high contrast and so leave it
	}
	else if(string == '1'){
		//the page is to be shown in high contrast, therefore acll the high contrast function
		highContrast();
		}
	}
}


function highContrast(){
		var sheet = 'style1';
		var noContrast = 'styles/enceppx2cols_green.css';
		var contrast = 'styles/enceppx2cols_highContrast.css';
		
		/*if(navigator.appName == 'Microsoft Internet Explorer'){
		var noContrast = '../styles/enceppx2cols_green.css';
		var contrast = '../styles/enceppx2cols_highContrast.css';
		}*/
		
		if(document.getElementById){
			var d = new Date();
			d.setTime(d.getTime()+(30*24*60*60*1000));
			var styleSheet = document.getElementById(sheet);
				if(styleSheet.href.search(noContrast) != '-1'){
					var toUse = '/'+contrast;
					if(document.all)deleteCookie('contrast');
					document.cookie = "contrast=1; expires="+d.toGMTString()+"; path=/";
					
				}else{
					var toUse = '/'+noContrast;
					if(document.all)deleteCookie('contrast')
					document.cookie = "contrast=0; expires=" + d.toGMTString() + "; path=/";
				}
		}
		else if(document.layers){
			var styleSheet = document.layers[sheet];
			if(styleSheet.href.search(noContrast) != '-1'){
				var toUse = '/'+contrast;
				if(document.all)deleteCookie('contrast');
				document.cookie = "contrast=1; expires=" + d.toGMTString() + "; path=/";
			}else{
				var toUse = '/'+noContrast;
				if(document.all)deleteCookie('contrast');
				document.cookie = "contrast=0; expires=" + d.toGMTString() + "; path=/";
			}
		}
		else if(document.all){			
		var styleSheet = document.all.sheet;
			if(styleSheet.href == noContrast){
				var toUse = '/'+contrast;
				if(document.all)deleteCookie('contrast');
				document.cookie = "contrast=1; expires=" + d.toGMTString() + "; path=/";
			}else{
				var toUse = '/'+noContrast;
				if(document.all)deleteCookie('contrast');
				document.cookie = "contrast=0; expires=" + d.toGMTString() + "; path=/";
			}
		}
		
		styleSheet.href = toUse;
		
}
