// date stuff used in cached pages
dayofweek= new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
dayofmonth= new Array("","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
months= new Array("January","February","March","April","May","June","July","August","September","October","November","December");

// returns todays date as a formated string
function theDate(){
	var mydate=new Date();
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	var hrs=mydate.getHours();
	var mins=mydate.getMinutes();
	todaysDate="  "+dayofweek[day]+" "+dayofmonth[daym]+" "+months[month]+" "+hrs+":"+mins;
	return todaysDate;
}

var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x) {return(x<0||x>9?"":"0")+x}
function formatDate(date,format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=date.getYear()+"";
	var M=date.getMonth()+1;
	var d=date.getDate();
	var E=date.getDay();
	var H=date.getHours();
	var m=date.getMinutes();
	var s=date.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {y=""+(y-0+1900);}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=LZ(M);
	value["MMM"]=MONTH_NAMES[M+11];
	value["MMMM"]=MONTH_NAMES[M-1];
	value["d"]=d;
	value["dd"]=LZ(d);
	value["E"]=DAY_NAMES[E+7];
	value["EE"]=DAY_NAMES[E];
	value["H"]=H;
	value["HH"]=LZ(H);
	if (H==0){value["h"]=12;}
	else if (H>12){value["h"]=H-12;}
	else {value["h"]=H;}
	value["hh"]=LZ(value["h"]);
	if (H>11){value["K"]=H-12;} else {value["K"]=H;}
	value["k"]=H+1;
	value["KK"]=LZ(value["K"]);
	value["kk"]=LZ(value["k"]);
	if (H > 11) { value["a"]="PM"; }
	else { value["a"]="AM"; }
	value["m"]=m;
	value["mm"]=LZ(m);
	value["s"]=s;
	value["ss"]=LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		if (value[token] != null) { result=result + value[token]; }
		else { result=result + token; }
		}
	return result;
}

// Search box validation used for both the search box and the main search page
function searchpagevalidate(ref) {
	var searchTextBox=document.getElementById("keyword");

	if (searchTextBox.value != '')
		{
		return true;
		}
	else
		{
		alert('Need a keyword to \nsearch on!');
		return false;
		}		
}
function gotoarticle(sel)
	{
		artID=sel.options[sel.selectedIndex].value;
		if (artID.length > 0){
			aURL="index.jsp?articleid="+artID;
			window.location.href = aURL;
		}
	}
	
//scripts used in the forum template
// check all fields have been entered.
function  _forum_checkThreadForm(_forum_this){
    if  (_forum_this.forum_topic.value.length ==0){
		alert("You must enter a Title.");
		return false;
	}
    if  (_forum_this.forum_username.value.length ==0){
		alert("You must enter your name to post to the forum.");
		return false;
	}
    if  (_forum_this.forum_body.value.length ==0){
		alert("In order to post you need to enter text into the message.");
		return false;
	}
	return true;
} 
//variables and functions used in the calendar template
var Days_in_Month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
function monthchange(sel){

	var daySelector=document.getElementById("aday");
	var mnth=sel.options[sel.selectedIndex].value;
	var aform=sel.form;
	if(aform.aday != null){
		// If the month is February:
		if (mnth == 1){
			var theYear=aform.ayear.options[aform.ayear.selectedIndex].value;
			Days_in_Month[1] = ((theYear % 400 == 0) || ((theYear % 4 == 0) && (theYear % 100 !=0))) ? 29 : 28;
		}
		var i;
		var CurrentDaysInSelection=daySelector.options.length;
		var DaysForThisSelection=Days_in_Month[mnth]
		if (CurrentDaysInSelection > DaysForThisSelection)
		{
		    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
		    {
		      daySelector.options[daySelector.options.length - 1] = null
		    }
		}
		if (DaysForThisSelection > CurrentDaysInSelection)
		{
		    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
		    {
		      NewOption = new Option(daySelector.options.length + 1);
		      daySelector.options.add(NewOption);
		    }
		}
		checkday(aform);
	}
	changer(sel);	
}

function checkday(aform){
	if (aform.aday.options[aform.aday.selectedIndex].text==''){
		aform.aday.options[eval(Days_in_Month[aform.amonth.selectedIndex]-1)].selected=true;
		aform.aday.focus();
	}
}

function changer(sel) 
{
	aform=sel.form;
	if(aform.ayearmonthday!=null)
	{
		yearmnth=aform.ayearmonthday.options[aform.ayearmonthday.selectedIndex].value;
		aid=aform.articleid.value;
		aURL="index.jsp?articleid="+aid+"&ayearmonthday="+yearmnth;
	}
	else
	{
		dy=(aform.aday != null)?aform.aday.options[aform.aday.selectedIndex].value:1;
		mnth=aform.amonth.options[aform.amonth.selectedIndex].value;
		yer=aform.ayear.options[aform.ayear.selectedIndex].value;
		aid=aform.articleid.value;
		aURL="index.jsp?articleid="+aid+"&ayear="+yer+"&amonth="+mnth+"&aday="+dy;
	}
	window.location.href = aURL;
}

// automatic print function
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print();
}

//Functions Used by the commerce templates
function checkNum(id){	<!--- Check that the quantity is a positive integer --->
	var checkstr = /^[1-9][0-9]*$/;
	if  ( checkstr.test(id.value) ){ 
		id.value = id.value;	
	}else{
		alert ('You must specify a valid quantity');	
		id.value = 1;
	}
}

function showProductStatus(f,itemAttribs,ProductStatus){<!--- Search the stock array for  an itemAttribs and get it's price/availability info to the form --->
	qty = f.Quantity.value;
	if( (qty == '') || (isNaN(parseInt(qty))) ){
		qty = 0;  
	}else{
		qty = parseInt(qty);
		if (isNaN(qty)){
			qty = 1;
		}else if (qty < 0){
			qty = 0-qty;
		}
		f.Quantity.value = qty;
	}
	selectAttribs=""; <!--- Variable to hold Attributes selected by the user in a CSV string --->
	for(i = 0; i < f.length; i++)<!--- Scan the form and get product ProductStatus into PID --->
	{
		e = f.elements[i];
		if(e.name !=null && e.name.substr(0,7) == "Attrib_"){<!--- Get the selection from the form's DROP DOWN lists --->
			if(e.type == "select-one") selectAttribs=selectAttribs+e.options[e.selectedIndex].value+",";
			if(e.type == "hidden") selectAttribs=selectAttribs+e.value+",";
		}
	}
	selectAttribs = selectAttribs.substr(0,selectAttribs.length-1); 		<!--- Loose that final comma! --->
	for(i = 1; i < itemAttribs.length-1; i++){ 	<!--- Search the itemAttribs array for the Selected Attributes --->
		if(itemAttribs[i] == selectAttribs){break;}
	}<!--- If we get to here without a 'break' it's Out of Stock in that config. --->
	<!--- Put the details on to the form display ---> 
	if(ProductStatus[i].STK == 0 || ProductStatus[i].STK == -1){
		Avail = 'Unavailable';
	}else{
		Avail = ProductStatus[i].STK ;
	}
	f.Availability.value = Avail;
	if (Avail != 'Unavailable'){
		// the following may or may not exist
		if (f.PriceIncVAT != null)f.PriceIncVAT.value = formatNum(ProductStatus[i].PRCinc);
		if (f.PriceExVAT != null)f.PriceExVAT.value = formatNum(ProductStatus[i].PRCex);
		if (f.VAT != null)f.VAT.value = formatNum(ProductStatus[i].VAT);
		if (f.TotalIncVAT != null)f.TotalIncVAT.value = formatNum(f.PriceIncVAT.value * qty);
		//these always exist
		f.Code.value = ProductStatus[i].CID;
		f.ProductOptionID.value = ProductStatus[i].PID;
	}else{
		// the following may or may not exist
		if (f.PriceIncVAT != null)f.PriceIncVAT.value = "N/A";
		if (f.PriceExVAT != null)f.PriceExVAT.value = "N/A";
		if (f.VAT != null)f.VAT.value = "N/A";
		if (f.TotalIncVAT != null)f.TotalIncVAT.value = "N/A";
		//these always exist
		f.Code.value = "N/A"; 
		f.ProductOptionID.value = "N/A";
	}
} 	

function checkAvail(f){
	if(f.Availability.value == "" || f.Availability.value == "Unavailable"){
		alert("   Sorry, this item is not\navailable with the options\n    you have selected.");
		return false;
	}else{
		return true;
	}
}

function formatNum(value){
	value = "" + value <!--- convert value to string --->
	precision = 2; <!--- Decimal places --->
	width = 13; <!--- Formatted width in characters --->
	padding = "";
	for(p=0;p<width;p++) padding+=" "; <!--- Make a padding string --->      
	var whole = "" + Math.round(value * Math.pow(10, precision));
	var decPoint = whole.length - precision;
	if(decPoint != 0){
		result = whole.substring(0, decPoint);
		result += ".";
		result += whole.substring(decPoint, whole.length);
	}else{
		result = whole;
	}
	result = padding+result;<!--- Left pad numbers so they line up --->
	result = result.substring(result.length-width, result.length);		   
	return result;
}

/**
 * This is used to ensure that links are XHTML compliant
 * the target="_blank" has been removed from links and replaced
 * with rel="Your own value" which we will use external.
 */
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
 

} 
  /**
   * This is used on the home page to navigate to
   * a new page when a nearby location has been
   * selected.
   */
 function go2Location(document)
 {
	var selector=document.nearby_location_form.nearby_location;
	 var url=selector.options[selector.selectedIndex].value;
	if(selector.selectedIndex!=0)
	{
	 window.location=url;
	}
 }
//Functions Used by the commerce templates end

//This is used to enable the viewer download buttons.
function setVisibility(objId, sVisibility) 
{
       var obj = document.getElementById(objId);
       if(obj!=null)
       {
	       try
	        {
		        obj.style.visibility = sVisibility;
	    		obj.style.height = 'auto';
	        }
	        catch(e)
	        {
	        }         
	   }
}

//This is used to set the stylesheet
window.onload = init;
var fontControl;

function init()
{
	fontControl = new FontSizer(50,10); 
	var arrExcludesTags = new Array ('div'); 
	fontControl.SetRestrictionsTags(arrExcludesTags);
	//Make the links XHTML compliant
	externalLinks();
}

//load a high contrast style sheet if required
var cookie = readCookie("style"); 
var title = cookie!=null? cookie : 'style'; 
setActiveStyleSheet(title); 
		
function setActiveStyleSheet(title) { 
var i, a, main; 
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { 
	if(a.getAttribute("rel").indexOf("style")!= -1 && a.getAttribute("title")) 
	{ 
		a.disabled = true; 
		if(a.getAttribute("title") == title)
		{
			a.disabled = false;
		}
	} 
} 

} 

function getActiveStyleSheet() { 
var i, a; 
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { 
if(a.getAttribute("rel").indexOf("style")!= -1 && a.getAttribute("title") &&!a.disabled) return a.getAttribute("title"); 
} 
return null; 
} 


function createCookie(name,value,days) { 
if (days) { 
var date = new Date(); 
date.setTime(date.getTime()+(days*24*60*60*1000)); 
var expires = "; expires="+date.toGMTString(); 
} 
else expires = ""; 
document.cookie = name+"="+value+expires+"; path=/"; 
} 

function readCookie(name) { 
var nameEQ = name + "="; 
var ca = document.cookie.split(';'); 
for(var i=0;i < ca.length;i++) { 
var c = ca[i]; 
while (c.charAt(0)==' ') c = c.substring(1,c.length); 
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 
} 
return null; 
} 


//This is used to change the font.
String.prototype.DropAlpha=function(){var strRetVal=new String();var strValidChars="0123456789.";for(var i=0;i<this.length;i++){if(strValidChars.indexOf(this.charAt(i))>-1){strRetVal+=this.charAt(i);}
else
{break;}}
return strRetVal;}
String.prototype.GetNAN=function(){var rubbish=new String();rubbish=this.DropAlpha();if(rubbish.length>0)return this.substr(rubbish.length);else return this;}
Array.prototype.FindIndex=function(val){var found=new Boolean;found=false;for(y=0;y<this.length;y++){if(this[y]==val){found=true;break;}}
if(found==true)return y;else return-1;}
function FontSizer(nMaxIncrease,nChangePercent){this.nFontChangePercent=nChangePercent;this.nMaxUp=nMaxIncrease;this.nMaxDown=0;this.bDisplayExceptions=new Boolean(false);this.bDisableAfterException=new Boolean(true);this.bEnabled=new Boolean(true);this.bPersist=new Boolean(true);this.dontUpdate=new Boolean(false);this.FirstTagBase="";this.FirstTagCurrent="";this.bFirstExecute=new Boolean(true);this.nPerFactor=0;this.Scope=new iScope();this.RestoreState();}
function iScope(){this.scopeMethod="all";this.arrScopeVars=new Array();this.arrRestrictionID=new Array();this.arrRestrictionTag=new Array();this.arrRestrictionClass=new Array();}
iScope.prototype.IsRestricted=function(strType,strVal){var bRestricted=new Boolean(false);switch(strType){case"tag":{if(this.arrRestrictionTag.FindIndex(strVal)>-1){bRestricted=true;}
break;}
case"class":{if(this.arrRestrictionClass.FindIndex(strVal)>-1){bRestricted=true;}
break;}
case"id":{if(this.arrRestrictionID.FindIndex(strVal)>-1){bRestricted=true;}
break;}
default:{myException=new Exception("(IsRestricted) Parameter strType is not of valid type.");throw myException;break;}}
return bRestricted}
iScope.prototype.IsInScope=function(strVal){if(arrScopeVars.FindIndex(strVal))return true;else return false;}
FontSizer.prototype.SetRestrictionsID=function(arrVals){try
{this.Scope.arrRestrictionID=arrVals;}
catch(e){myException=new Exception("(SetRestrictionsID) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetRestrictionsClass=function(arrVals){try
{this.Scope.arrRestrictionClass=arrVals;}
catch(e){myException=new Exception("(SetRestrictionsClass) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetRestrictionsTags=function(arrVals){try
{this.Scope.arrRestrictionTag=arrVals;}
catch(e){myException=new Exception("(SetRestrictionsTags) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetRestrictionsNone=function(){try
{this.Scope.arrRestrictionTag=new Array();this.Scope.arrRestrictionClass=new Array();this.Scope.arrRestrictionID=new Array();}
catch(e){myException=new Exception("(SetRestrictionsNone) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetScopeID=function(arrVals){try
{this.Scope.arrScopeVars=arrVals;this.scopeMethod="id";}
catch(e){myException=new Exception("(SetScopeID) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetScopeClass=function(arrVals){try
{this.Scope.arrScopeVars=arrVals;this.scopeMethod="class";}
catch(e){myException=new Exception("(SetScopeClass) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetScopeTags=function(arrVals){try
{this.Scope.arrScopeVars=arrVals;this.scopeMethod="tags";}
catch(e){myException=new Exception("(SetScopeTags) Exception raised - "+e.message);throw myException;}}
FontSizer.prototype.SetScopeAll=function(){this.Scope.scopeMethod="all";}
FontSizer.prototype.IncreaseFont=function(){if((this.nPerFactor<this.nMaxUp)&&(this.bEnabled==true)||this.dontUpdate==true){try
{switch(this.Scope.scopeMethod){case"all":{this.ResizeFontAll("up");break;}
case'tags':{this.ResizeFontTags("up");break;}
case'class':{this.ResizeFontClass("up");break;}
case'id':{this.ResizeFontID("up");break;}
default:{myException=new Exception("(IncreaseFont) ScopeMethod is not valid : "+this.Scope.scopeMethod);throw myException;}}
if(this.dontUpdate==false){this.PreserveState();}}
catch(e){if(this.bDisplayExceptions==true){var strMessage=new String();strMessage="An exception has been caught : "+e.name+" : "+e.message;alert(strMessage);}
if(this.bDisableAfterException==true){this.bEnabled=false;}}}}
FontSizer.prototype.DecreaseFont=function(){if(this.nPerFactor>0&&this.bEnabled==true){try
{var oldVal=this.nFontChangePercent;if(this.nPerFactor-this.nFontChangePercent<0){this.nFontChangePercent=this.nPerFactor;}
switch(this.Scope.scopeMethod){case"all":{this.ResizeFontAll("down");break;}
case"tags":{this.ResizeFontTags("down");break;}
case"class":{this.ResizeFontClass("down");break;}
case"id":{this.ResizeFontID("down");break;}
default:{this.nFontChangePercent=oldVal;myException=new Exception("(DecreaseFont) ScopeMethod is not valid : "+this.Scope.scopeMethod);throw myException;}}
this.nFontChangePercent=oldVal;if(this.dontUpdate==false){this.PreserveState();}}
catch(e){if(this.bDisplayExceptions==true){var strMessage=new String();strMessage="An exception has been caught : "+e.name+" : "+e.message;alert(strMessage);}
if(this.bDisableAfterException==true){this.bEnabled=false;}}}}
FontSizer.prototype.ResizeFontAll=function(strDirection){var bFirstTag=new Boolean(true);if(document.getElementsByTagName){try
{tags=new Array('body');for(j=0;j<tags.length;j++){if(this.Scope.IsRestricted("tag",tags[j])==false){var tagElements=document.getElementsByTagName(tags[j]);for(i=0;i<tagElements.length;i++){var objElement=tagElements[i];if(this.Scope.IsRestricted("class",objElement.className)==false&&this.Scope.IsRestricted("id",objElement.id)==false){if(objElement.innerHTML!=""){var fontSize=this.GetCurrentSize(objElement);if(fontSize!="disable"&&fontSize!="undefined"){if(this.bFirstExecute==true){this.FirstTagBase=fontSize.DropAlpha();this.bFirstExecute=false;}
if(strDirection=="up"){var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal+this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
else
{var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal-this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
if(bFirstTag==true){this.FirstTagCurrent=newFontSize;this.nPerFactor=((this.FirstTagCurrent-this.FirstTagBase)/(this.FirstTagBase))*100;bFirstTag=false;}}}}}}}}
catch(e){myException=new Exception("(ResizeFontAll) Exception thrown - "+e.message);throw myException;}}
else
{myException=new Exception("Browser is not compatible with getElementsByTagName");throw myException;}}
FontSizer.prototype.ResizeFontClass=function(strDirection){if(document.getElementsByTagName){try
{tags=new Array('body','div','span','p','h1','h2','h3','h4','h5','h6','strong','em','abbr','acronym','address','bdo','blockquote','cite','q','code','ins','del','dfn','kbd','pre','samp','var','br','a','base','ul','ol','li','dl','dt','dd','table','tr','td','th','tbody','thead','tfoot','col','colgroup','caption','form','input','textarea','select','option','optgroup','button','label','fieldset','legend');for(j=0;j<tags.length;j++){if(this.Scope.IsRestricted("tag",tags[j])==false){var tagElements=document.getElementsByTagName(tags[j]);for(i=0;i<tagElements.length;i++){var objElement=tagElements[i];if(this.Scope.IsInScope(objElement.className)==true){if(this.Scope.IsRestricted("class",objElement.className)==false&&this.Scope.IsRestricted("id",objElement.id)==false){if(objElement.innerHTML!=""){var fontSize=this.GetCurrentSize(objElement);if(fontSize!="disable"&&fontSize!="undefined"){if(this.bFirstExecute==true){this.FirstTagBase=fontSize.DropAlpha();this.bFirstExecute=false;}
if(strDirection=="up"){var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal+this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
else
{var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal-this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
if(bFirstTag==true){this.FirstTagCurrent=newFontSize;this.nPerFactor=((this.FirstTagCurrent-this.FirstTagBase)/(this.FirstTagBase))*100;bFirstTag=false;}}}}}}}}}
catch(e){myException=new Exception("(ResizeFontAll) Exception thrown - "+e.message);throw myException;}}
else
{myException=new Exception("Browser is not compatible with getElementsByTagName");throw myException;}}
FontSizer.prototype.ResizeFontTags=function(strDirection){if(document.getElementsByTagName){try
{tags=this.Scope.arrScopeVars;for(j=0;j<tags.length;j++){if(this.Scope.IsRestricted("tag",tags[j])==false){var tagElements=document.getElementsByTagName(tags[j]);for(i=0;i<tagElements.length;i++){var objElement=tagElements[i];if(this.Scope.IsRestricted("class",objElement.className)==false&&this.Scope.IsRestricted("id",objElement.id)==false){if(objElement.innerHTML!=""){var fontSize=this.GetCurrentSize(objElement);if(fontSize!="disable"&&fontSize!="undefined"){if(this.bFirstExecute==true){this.FirstTagBase=fontSize.DropAlpha();this.bFirstExecute=false;}
if(strDirection=="up"){var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal+this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
else
{var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal-this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
if(bFirstTag==true){this.FirstTagCurrent=newFontSize;this.nPerFactor=((this.FirstTagCurrent-this.FirstTagBase)/(this.FirstTagBase))*100;bFirstTag=false;}}}}}}}}
catch(e){myException=new Exception("(ResizeFontAll) Exception thrown - "+e.message);throw myException;}}
else
{myException=new Exception("Browser is not compatible with getElementsByTagName");throw myException;}}
FontSizer.prototype.ResizeFontID=function(strDirection){if(document.getElementsByTagName){try
{tags=new Array('body','div','span','p','h1','h2','h3','h4','h5','h6','strong','em','abbr','acronym','address','bdo','blockquote','cite','q','code','ins','del','dfn','kbd','pre','samp','var','br','a','base','ul','ol','li','dl','dt','dd','table','tr','td','th','tbody','thead','tfoot','col','colgroup','caption','form','input','textarea','select','option','optgroup','button','label','fieldset','legend');for(j=0;j<tags.length;j++){if(this.Scope.IsRestricted("tag",tags[j])==false){var tagElements=document.getElementsByTagName(tags[j]);for(i=0;i<tagElements.length;i++){var objElement=tagElements[i];if(this.Scope.IsInScope(objElement.id)==true){if(this.Scope.IsRestricted("class",objElement.className)==false&&this.Scope.IsRestricted("id",objElement.id)==false){if(objElement.innerHTML!=""){var fontSize=this.GetCurrentSize(objElement);if(fontSize!="disable"&&fontSize!="undefined"){if(this.bFirstExecute==true){this.FirstTagBase=fontSize.DropAlpha();this.bFirstExecute=false;}
if(strDirection=="up"){var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal+this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
else
{var pxVal=parseInt(fontSize.DropAlpha());var newFontSize=pxVal-this.GetPercentageFromPX(pxVal);objElement.style.fontSize=newFontSize+fontSize.GetNAN();}
if(bFirstTag==true){this.FirstTagCurrent=newFontSize;this.nPerFactor=((this.FirstTagCurrent-this.FirstTagBase)/(this.FirstTagBase))*100;bFirstTag=false;}}}}}}}}}
catch(e){myException=new Exception("(ResizeFontAll) Exception thrown - "+e.message);throw myException;}}
else
{myException=new Exception("Browser is not compatible with getElementsByTagName");throw myException;}}
FontSizer.prototype.GetCurrentSize=function(objElement){try
{if(objElement.currentStyle){fontSize=objElement.currentStyle['fontSize'];}
else if(window.getComputedStyle){fontSize=document.defaultView.getComputedStyle(objElement,null).getPropertyValue('font-Size');}
else
{return"disable";}
return fontSize;}
catch(e){return"undefined";}}
FontSizer.prototype.GetPercentageFromPX=function(pxSize){return(this.nFontChangePercent/100)*pxSize;}
FontSizer.prototype.PreserveState=function(){try
{if(this.bPersist==true){CreateCookie("scopemethod",this.Scope.scopeMethod,null);CreateCookie("displayexceptions",this.bDisplayExceptions,null);CreateCookie("disableafterexception",this.bDisableAfterException,null);CreateCookie("fontchangepercent",this.nFontChangePercent,null);CreateCookie("maxincrease",this.nMaxIncrease,null);CreateCookie("maxdecrease",this.nMaxDecrease,null);CreateCookie("enabled",this.bEnabled,null);CreateCookie("perFactor",this.nPerFactor,null);if(this.Scope.arrScopeVars.length>0){CreateCookie("scopevars",this.Scope.arrScopeVars.join(','),null);}
if(this.Scope.arrRestrictionID.length>0){CreateCookie("restrictionid",this.Scope.arrRestrictionID.join(','),null);}
if(this.Scope.arrRestrictionTag.length>0){CreateCookie("restrictiontags",this.Scope.arrRestrictionTag.join(','),null);}
if(this.Scope.arrRestrictionClass.length>0){CreateCookie("restrictionclass",this.Scope.arrRestrictionClass.join(','),null);}}}
catch(e){}}
FontSizer.prototype.RestoreState=function(){try
{if(ReadCookie("scopemethod")!=null){this.Scope.scopeMethod=ReadCookie("scopemethod");this.bDisplayExceptions=new Boolean(ReadCookie("displayexceptions"));this.bDisableAfterException=new Boolean(ReadCookie("disableafterexception"));this.nFontChangePercent=ReadCookie("fontchangepercent");this.nMaxIncrease=ReadCookie("maxincrease");this.nMaxDecrease=ReadCookie("maxdecrease");this.bEnabled=new Boolean(ReadCookie("enabled"));this.nPerFactor=ReadCookie("perFactor");if(ReadCookie("scopevars")!=null){this.Scope.arrScopeVars=new Array(ReadCookie("scopevars"));}
if(ReadCookie("restrictionid")!=null){this.Scope.arrRestrictionID=new Array(ReadCookie("restrictionid"));}
if(ReadCookie("restrictiontags")!=null){this.Scope.arrRestrictionTag=new Array(ReadCookie("restrictiontags"));}
if(ReadCookie("restrictionclass")!=null){this.Scope.arrRestrictionClass=new Array(ReadCookie("restrictionclass"));}
if(this.nPerFactor>0){this.dontUpdate=true;var temp=this.nFontChangePercent;this.nFontChangePercent=this.nPerFactor;this.IncreaseFont();this.nFontChangePercent=temp;this.dontUpdate=false;}}}
catch(e){}}
function Exception(message){this.message=message;this.name="A user defined exception has been caught";}
function CreateCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function ReadCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){CreateCookie(name,"",-1);}