/**
 * Read the JavaScript cookies tutorial at:
 *   http://www.netspade.com/articles/javascript/cookies.xml
 */

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
 
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
 
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
    document.cookie = name + "=" + 
    	((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

/* my own scripts - this section is NOT free! */

/*
put this in the BODY section of the page:
<a href="javascript:addValue();window.location.reload();">&nbsp;&nbsp;+&nbsp;&nbsp;</a> <a href="javascript:decreaseValue(); window.location.reload();">&nbsp;&nbsp;-&nbsp;&nbsp;</a>
*/

function testSizeValue() // tests, if the cookie, which set the size of the font exists, if it doesn't exist set the size of font as '2' (max 7)
{
if (getCookie("sizeValue")!=null)
sizeValue=parseInt(getCookie("sizeValue"));
else sizeValue=2
return sizeValue;
}

function addValue() // adds the font size as one step
{
sizeValue=testSizeValue();
if(sizeValue<5)
	{		
	sizeValue=sizeValue+1;
	setCookie("sizeValue", sizeValue);
	}
}

function decreaseValue() // decreases the font size as one step
{
sizeValue=testSizeValue();
if(sizeValue>1)
	{		
	sizeValue=sizeValue-1;
	setCookie("sizeValue", sizeValue);
	}
}

sizeValue=testSizeValue();

switch(sizeValue)
	{
	case 1:
	size=9;
	break;
	case 2:
	size=11;
	break;
	case 3:
	size=13;
	break;
	case 4:
	size=15;
	break;
	case 5:
	size=17;
	break;
	case 6:
	size=19;
	break;
	case 7:
	size=21;
	break;
	}	
	
/* font-size for the content */	
document.write("<style type=\"text/css\" media=\"screen, projection, handheld\">p.bodytext, p.csc-searchResult, li, blockquote, li div, .csc-sitemap a, h4, h5, h6, h3.csc-searchResultHeader a {font-size:"+size+"px !important}</style>"); /* put to this list elements, which size you want to change; only 'body, td, th, li, blockquote' are necessary and you can remove unnecessary elements from this list; for other you can set either fixed pixel values (for elements, which font-size values you don't want change) or use em-values (for elements, which can scale on the base of the font-size for the body element); note that in this list is elements, which you can use as nested; if you would put 0.8em for li then li li would be 0.6em etc.; values are in pixels because browsers handle differently relative font-size values (xx-small - xx-large) */

/* font-size for the navigation; the font-size swither works in limited scale */
if(sizeValue<=2)
	document.write("<style type=\"text/css\" media=\"screen, projection, handheld\">td.menu #menu_1 *, .changeSize, .changeSize *, div#path, div#path *, #colLeft .csc-header-n2 h3 {font-size:"+size+"px !important}</style>"); // if the main menu is inside another element, change the value of the id; other CSS-rules are for the path menu and font-size change text; delete unnecessy rules and/or change rules as you like
else
	document.write("<style type=\"text/css\" media=\"screen, projection, handheld\">td.menu #menu_1 *, .changeSize, .changeSize *, div#path, div#path *, #colLeft .csc-header-n2 h3 {font-size:13px !important}</style>");
	
