/* this uses stylesheets.js now */

function detectFontSize( name ){
	var style_sheet = readCookie( name );
	if( style_sheet ){
		setFontSize( style_sheet );
	}
	else
	{
		//setFontSize( "fs_default");	
	}
}

function storeFontSize( title, days, path ){
	setStyleSheet( title );
	createCookie( "fontsize-switch", title, setDays( days ), path, '' );
}

function setFontSize( title ){
	//alert(title);
	storeFontSize( title, 30, '' );	
}

function setFontSizeLinks( img_path ){
	//alert("here");
	var link_holder = document.getElementById( "fontsize_switch" );
	if(!link_holder)
	{
		return false;
	}
	//var imgs = ['a_'+pagename+'.gif','aa_'+pagename+'.gif','aaa_'+pagename+'.gif'];
	//var textdate
	var actions = ['fs_min','fs_default','fs_max'];
	var fonts = ['font55','font75','font95'];
	//var title = ['Minimum font size','Medium font size','Maximum font size'];
	for( var i = 0 ; i < 3 ; i++ ){
		var action = actions[i];
		var font = fonts[i];
		//var img_src = img_path + imgs[ i ];
		//var img_alt = alts[ i ];
		var link = document.createElement( "a" );
		link.setAttribute( "href", "#" );
		link.setAttribute( "name", action );
		//link.setAttribute( "class", font);
		link.className = font;
		//alert(link.className);
		link.onclick = function(){
			setFontSize( this.getAttribute( "name" ) );
			return false;
		};
		
		//var img = document.createElement( "img" );
		//img.setAttribute( "alt", img_alt );
		//img.alt = img_alt;
		//img.setAttribute( "src", img_src );
		var linkText=document.createTextNode("A ");
		//alert(img);
		link.appendChild(linkText);
		link_holder.appendChild( link );
	}
}

function initFontSize(){
	setFontSizeLinks( "images/index.html" );
	detectFontSize( "fontsize-switch" );
}	
