var curFontSize = 12;
	// curFontSize needs to be the same as the font size for paragraphs, as set in the css (in pixels)
var curLineHeight = 16;
	// curLineHeight needs to be the same as the line height for paragraphs, as set in the css (in pixels)
var fontModifier = 2;
	// how much to increase/decrease font size each time (in pixels)
	// detect browser support for getElementById and createElement
var canGetElem = false;
var canCreateElem = false;
if (document.getElementById) {
    canGetElem = true;
    if (document.createElement) {
        canCreateElem = true;
    }
}
/*  font size changes  */
function fontSize(act) {
    if (canGetElem) {
        tmpContent = document.getElementById("centrecontent");
        if (act == 1) {
            curFontSize += fontModifier;
            curFontSize = Math.min(curFontSize, 41);
	    if(curFontSize==41)
	    {
	    	curFontSize=11;
	    }
        }
        else if (act == 0) {
            curFontSize -= fontModifier;
            curFontSize = Math.max(curFontSize, 9);
        }
        curLineHeight = Math.round(curFontSize * 1.45);
        tmpContent.style.fontSize = curFontSize + "px";
        tmpContent.style.lineHeight = curLineHeight + "px";
        for (v = 0; v < tmpContent.getElementsByTagName("p").length; v++) {
           tmpContent.getElementsByTagName("p")[v].style.fontSize = curFontSize + "px";
           tmpContent.getElementsByTagName("p")[v].style.lineHeight = curLineHeight + "px";
        }
      
    }
	// set cookie with font size
	var expdate = new Date();
	FixCookieDate (expdate);
	expdate.setTime (expdate.getTime() + (672*60*60*1000)); // 4 weeks
	SetCookie("userfontc",curFontSize,expdate,thisDomain);
}
var userfont = GetCookie ('userfontc');

if (userfont>1) {} else {userfont=11;}

function fontCookie() {
	ufd = ((userfont - curFontSize)/2);
	if (userfont >= 11) {
		for (i=0;i<ufd;i++) {
			fontSize(1);
		}	
	} else {
		fontSize(0);
	}	
}
// cookies
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate(date) {
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0) 
		date.setTime (date.getTime() - skew);
}

function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i=0;
	while (i < clen) {	
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
		}
	return null;
}

function SetCookie(name,value,expires,domain,secure) {
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((domain) ? "; domain=" + domain : "") +
	"; path=/" +
	((secure) ? "; secure" : "");
}
function setTextMode(flag)
{
	if(flag=='on')
	{
		var expdate = new Date();
		FixCookieDate (expdate);
		expdate.setTime (expdate.getTime() + (672*60*60*1000)); // 4 weeks
		SetCookie("textmode","on",expdate,thisDomain);
	}
	else
	{
		var expdate = new Date();
		FixCookieDate (expdate);
		expdate.setTime (expdate.getTime() + (672*60*60*1000)); // 4 weeks
		SetCookie("textmode","off",expdate,thisDomain);
	}
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function addbookmark(title,url)
{
	if (window.sidebar)
	{
		window.sidebar.addPanel(title, url,"");
	} 
	else if(document.all)
	{
		window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print)
	{
		return true;
	}
}
function popup(url,width,height)
{
	var left = 0; 
	var top = 0;
	if(width==null)
	{
		var width=640;
	}
	if(height==null)
	{
		var height=480;
	}
	
	if (typeof( window.innerWidth ) == 'number') {
	// non-IE...
		left = (window.innerWidth-width)/2;
		top = (window.innerHeight-height)/2;
	} else if (document.documentElement && 
			  ( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
	// IE 6+ in 'standards compliant mode'...
		left = (document.documentElement.clientWidth - width) / 2;
		top = (document.documentElement.clientHeight - width) / 2;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    // IE 4 compatible...
		left = (document.body.clientWidth - width) / 2;
		top = (document.body.clientHeight - width) / 2;
	}

	eval("var pup = window.open('"+url+"', 'pupwin', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left = "+left+",top = "+top+"');");
}
// end cookies
