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 printWindow() {
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}

function PrintThisPage() 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById('contentstart').innerHTML; 
   
   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('&lt;html&gt;&lt;LINK href="Documents/TimeConti/Layout.css" rel=Stylesheet&gt;&lt;body&gt;'); 
       winprint.document.write(sWinHTML);          
       winprint.document.write('&lt;/body&gt;&lt;/html&gt;'); 
       winprint.document.close(); 
       winprint.focus(); 
}


var defaultFontSize13 = 13;
var defaultFontSize12 = 12;
var defaultFontSize11 = 11;


window.onload = setUserOptions;

function ChangeFontSize(amt) 
{
	var minSize = 8;
	var maxSize = 24;
	
	var currentSize = getClassProperty("content","fontSize");
	var currentSize2 = getClassProperty("subheader", "fontSize");
	var currentSize3 = getClassProperty("contentsmall", "fontSize");
	
	currentSize = currentSize.replace("px","");
	currentSize2 = currentSize2.replace("px","");
	currentSize3 = currentSize3.replace("px","");
	
	var newSize = parseInt(currentSize) + amt;
	var newSize2 = parseInt(currentSize2) + amt;
	var newSize3 = parseInt(currentSize3) + amt;
	
	if (newSize >= minSize && newSize <= maxSize)
	{
		changeClassProperty("content","fontSize",newSize + "px");
		changeClassProperty("contentred","fontSize",newSize + "px");
		changeClassProperty("contentgold","fontSize",newSize + "px");
		changeClassProperty("contentlink","fontSize",newSize + "px");
		changeClassProperty("contentlinkgreen","fontSize",newSize + "px");
	}
	
	if (newSize2 >= minSize && newSize2 <= maxSize)
	{
		changeClassProperty("subheader","fontSize",newSize2 + "px");
		changeClassProperty("subheadergold","fontSize",newSize2 + "px");
		changeClassProperty("redboxheader","fontSize",newSize2 + "px");
		changeClassProperty("redboxheaderlight","fontSize",newSize2 + "px");
	}
		
	if (newSize3 >= minSize && newSize3 <= maxSize)
	{
		changeClassProperty("contentsmall","fontSize",newSize3 + "px");
		changeClassProperty("contentsmallgold","fontSize",newSize3 + "px");
		changeClassProperty("contentsmallgoldlight","fontSize",newSize3 + "px");
		changeClassProperty("contentsmallred","fontSize",newSize3 + "px");
		changeClassProperty("redboxlink","fontSize",newSize3 + "px");
		changeClassProperty("redboxcontent","fontSize",newSize3 + "px");
		changeClassProperty("goldlinksmall","fontSize",newSize3 + "px");
	}
	
	setCookie("fontSize",newSize,180,"/");
	setCookie("fontSize2",newSize2,180,"/");
	setCookie("fontSize3",newSize3,180,"/");
}
  
// get the value of a property of a CSS Rule
function getClassProperty(sClassName,sProperty) 
{
	sClassName="."+sClassName;
	var sheets = document.styleSheets;
	var rules;
	var styleObj;
	for (i=0;i< sheets.length; i++) 
	{
		rules=sheets[i].cssRules || sheets[i].rules;
		for (var j=0; j<rules.length; j++) 
		{
			if (rules[j].selectorText && rules[j].selectorText==sClassName) 
			{
				styleObj=rules[j].style;

				return styleObj[sProperty];
			}
		}
	}
}

// set the value of a property of a CSS Rule
function changeClassProperty(sClassName,sProperty,sValue) 
{
	sClassName="."+sClassName;
	var sheets = document.styleSheets;
	var rules;
	var styleObj;
	for (i=0;i< sheets.length; i++)
	{
		rules=sheets[i].cssRules || sheets[i].rules;
		for (var j=0; j<rules.length; j++) 
		{
			if (rules[j].selectorText && rules[j].selectorText==sClassName) 
			{
				styleObj=rules[j].style;
				styleObj[sProperty]=sValue;
				break;
			}
		}
	}
}

function setCookie(name,value,days,path,domain,secure) 
{
  var expires, date;
  if (typeof days == "number") 
  {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(name) 
{
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) 
  {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

function setUserOptions()
{
	cookie = getCookie("fontSize");
	cookie2 = getCookie("fontSize2");
	cookie3 = getCookie("fontSize3");
	
	currentFontSize = cookie ? cookie : defaultFontSize13;
	currentFontSize2 = cookie2 ? cookie2 : defaultFontSize12;
	currentFontSize3 = cookie3 ? cookie3 : defaultFontSize11;
	
	changeClassProperty("content","fontSize",currentFontSize + "px");
	changeClassProperty("contentred", "fontSize",currentFontSize + "px");
	changeClassProperty("contentlink","fontSize",currentFontSize + "px");
	changeClassProperty("contentlinkgreen","fontSize",currentFontSize + "px");
	changeClassProperty("contentgold","fontSize",currentFontSize + "px");
	
	changeClassProperty("subheader","fontSize",currentFontSize2 + "px");
	changeClassProperty("subheadergold","fontSize",currentFontSize2 + "px");
	changeClassProperty("redboxheader","fontSize",currentFontSize2 + "px");
	changeClassProperty("redboxheaderlight","fontSize",currentFontSize2 + "px");
	
	changeClassProperty("contentsmall","fontSize",currentFontSize3 + "px");		
	changeClassProperty("contentsmallgold","fontSize",currentFontSize3 + "px");
	changeClassProperty("contentsmallgoldlight","fontSize",currentFontSize3 + "px");
	changeClassProperty("contentsmallred","fontSize",currentFontSize3 + "px");	
	changeClassProperty("redboxcontent","fontSize",currentFontSize3 + "px");
	changeClassProperty("redboxlink","fontSize",currentFontSize3 + "px");
	changeClassProperty("goldlinksmall","fontSize",currentFontSize3 + "px");
	
}

function preloadImages() 
	{
		var Pic = new Array();
		Pic[0] = "images/header/services_2.gif"
		Pic[1] = "images/header/facilities_2.gif"
		Pic[2] = "images/header/news_2.gif"
		Pic[3] = "images/header/environment_2.gif"

							
		var p = Pic.length;
		var preLoad = new Array();
		for (i = 0; i < p; i++) 
		{
			preLoad[i] = new Image();
			preLoad[i].src = Pic[i];
		}
		return preLoad;
	}
	
function MM_openBrWindow(theURL,winName,features) 
   { 
     window.open(theURL,winName,features); 
   }
