//function settext(theme_name) {

	// Searches for existance of cookie
	var starter = document.cookie.indexOf("TEXTSIZE=");
	var ender = document.cookie.indexOf("ENDTEXTSIZE");
	var size = document.cookie.substring(starter+9,ender);
	
	var contraststarter = document.cookie.indexOf("CONTRAST=");
	var contrastender = document.cookie.indexOf("ENDCONTRAST");
	var contrast = document.cookie.substring(contraststarter+9,contrastender);
	
	/*if the cookie wasn't found (text sizing never having been done before), 
	output the bog-standard stylesheet html tag  */
	if (starter < 0 || size == "") {
		//alert('no cookie');
		//document.getElementById('sizecss').href='/bodysize.css';
		//document.write('<link rel="stylesheet" type="text/css" href="/bodysize.css" id="sizecss" />');
	}
	/*Otherwise, if the cookie IS found, load the correct size.*/
	else {
		//alert('/css/front/import' +size+ '.css');
		//document.getElementById('sizecss').href='bodysize' +size+ '.css';
		document.write('<link rel="stylesheet" type="text/css" href="/css/bodysize'+size+'.css" id="sizecss" />');
	}
	//}
	
	/*if the cookie wasn't found (contrast change never having been done before), 
		output the bog-standard stylesheet html tag  */
	if (contraststarter < 0) {
		//don't need to do anything
	}
	/*Otherwise, if the cookie IS found, load the correct contrast.*/
	else {
		if (contrast != "") {
			//document.getElementById('themecss').href='/highcontrast.css';
			document.write('<link rel="stylesheet" type="text/css" href="/contrast'+contrast+'.css" id="contrastcss" />');
		}
		//else {
			//document.write('<link rel="stylesheet" type="text/css" href="/contrast'+theme_name+'.css" id="themecss" />');
		//}
	}

function textsizer(the_size){
	var contraststarter = document.cookie.indexOf("CONTRAST=");
	var contrastender = document.cookie.indexOf("ENDCONTRAST");
	var contrast = document.cookie.substring(contraststarter+9,contrastender);
	
	if (contraststarter < 0) {
		contrast = "";
	}
	
	//if there is no size specified, set small cookie
	if(the_size==""){
	var the_cookie ="TEXTSIZE=ENDTEXTSIZE+CONTRAST=" + contrast + "ENDCONTRAST; path=/";
	document.cookie = the_cookie;
	//document.getElementById('sizecss').href='/bodysize.css';
	window.location.reload( true );
	}
	
	if (the_size=="med"){
		//set medium cookie
		var the_cookie ="TEXTSIZE=medENDTEXTSIZE+CONTRAST=" + contrast + "ENDCONTRAST; path=/";
		document.cookie = the_cookie;
		//document.getElementById('sizecss').href='/bodysizemed.css';
		window.location.reload( true );
	}
	
	if (the_size=="lrg"){
		//set large cookie
		var the_cookie ="TEXTSIZE=lrgENDTEXTSIZE+CONTRAST=" + contrast + "ENDCONTRAST; path=/";
		document.cookie = the_cookie;
		//document.getElementById('sizecss').href='/bodysizelrg.css';
		window.location.reload( true );
	}
}

function contrastchanger(the_contrast){
	var starter = document.cookie.indexOf("TEXTSIZE=");
	var ender = document.cookie.indexOf("ENDTEXTSIZE");
	var size = document.cookie.substring(starter+9,ender);
	
	if (starter < 0) {
		size = "";
	}
	
	// contrast stuff

	var the_cookie ="TEXTSIZE=" + size + "ENDTEXTSIZE+CONTRAST="+the_contrast+"ENDCONTRAST; path=/";
	document.cookie = the_cookie;
	window.location.reload( true );
}

