// SMCrunch2 Version 2.0.1, Copyright (C) Smart Media Ltd 2001-2005. All Rights Reserved.
//
// !!! Note: JScript by default
//
var textSize = "Normal";
function getSize()
{
var sRE = "(?:; )?" + "TextSize" + "=([^;]*);?";
var oRE = new RegExp(sRE);
if(oRE.test(document.cookie))
{
textSize = decodeURIComponent(RegExp["$1"]);
}
}
function increaseSize()
{
getSize();
if(textSize == "Large") textSize="Largest";
if(textSize == "Normal" ) textSize="Large";
activeCSS();
setCookie();
}
function dicreaseSize()
{
getSize();
if(textSize == "Large") textSize="Normal";
if(textSize == "Largest") textSize="Large";
activeCSS();
setCookie();
}
function setCookie()
{
var date = new Date();
date.setTime(date.getTime()+24*60*60*1000);
document.cookie = "TextSize="+textSize+"; expires="+date.toGMTString();
}
function activeCSS()
{
var i, oneLink;
for( i = 0; (oneLink = document.getElementsByTagName("link")[i]); i++)
{
if(oneLink.getAttribute("title") && findWord("stylesheet", oneLink.getAttribute("rel")))
{
if (oneLink.getAttribute("title") == textSize) oneLink.disabled = false;
else oneLink.disabled = true;
}
}
}
function findWord(needle, haystack)
{
return haystack.match(needle + "\\b");
}
function checkSearchForm()
{
if( document.searchform.qu.value == null || document.searchform.qu.value.length == 0 )
{
alert("Please enter a search term.");
document.searchform.qu.focus();
return false;
}
else return true;
}
window.onload = function(e)
{
}
function setDocumentCookie(title,val)
{
document.cookie = title+"="+val+";";
}
function useCookie()
{
if(document.cookie != null)
{
if(document.cookie.indexOf("contrast=true") != -1)
changeStylesheet('contrast', true);
else
changeStylesheet('contrast', false);
var t = document.cookie.match(/fontSize=(\d+)_(\d+(?:[.]\d+)?(?:em|px|%))/);
if( t!= null && t[1] != null && t[2] != null)
{
fontSizeChange(t[1], t[2]);
}
}
}
function changeStylesheet(titleStyle, bool)
{
var links = document.getElementsByTagName("link");
for(var i=0; i<links.length;i++)
{
var l = links[i];
if(l.getAttribute("rel").indexOf("stylesheet") !=-1 )
{
if(l.getAttribute("title"))
{
l.disabled = bool;
if(l.getAttribute("title") == titleStyle)
{
l.disabled = !bool;
changeStyleContrastIcon(bool);
setDocumentCookie(titleStyle,""+bool);
}
}
}
}
}
function changeFontSizeIcon(nbicon)
{
var s = document.getElementById('smalltext');
var m = document.getElementById('medtext');
var l = document.getElementById('largetext');
var arr = new Array(s,m,l);
for(var i=0;i<3;i++)
{
if(nbicon==i)
{
if(arr[i] != null && typeof(arr[i]) != 'undefined')
arr[i].className = 'fontsizeselected';
}
else
{
if(arr[i] != null && typeof(arr[i]) != 'undefined')
arr[i].className = '';
}
}
}
function changeStyleContrastIcon(nbicon)
{
var c = document.getElementById('contrast');
var n = document.getElementById('nocontrast');
if(c != null && typeof(c) != 'undefined')
c.className = (nbicon==true?'stylesheetselected':'');
if(n != null && typeof(n) != 'undefined')
n.className = (nbicon==false?'stylesheetselected':'');
}
function fontSizeChange(opt, size)
{
setDocumentCookie("fontSize",""+opt+"_"+size);
document.body.style.fontSize=size;
changeFontSizeIcon(opt);
}
