//this code is under licsense to "Stoughton Fire Protection".
//Unathorized reproduction or use is strickly prohibited.
//Internation copywrite laws protect this code from being
//  modified with out the owners consent.,
//
// Owned and created by Andrew Riley (C)2003
//	ariley@tooltime.ca
//
//
//
var ll = new Array();
var ln = new Array();

ll[0] = 'href="home.htm" target="inframe"';
ln[0] = 'Home';
ll[1] = 'href="history.htm" target="inframe"';
ln[1] = 'History';
ll[2] = 'onmouseover=staticTip.show("links"); name="menupos2" onmouseout="staticTip.hide();" href="services.htm" target="inframe" name="staticLink"';
ln[2] = 'Services';
ll[3] = 'href="contact.htm" target="inframe"';
ln[3] = 'Contact';
function ml(n,b) {
var txt;
if (b==1) {
	txt = '<a ' + ll[n] + '>' + ln[n] + '</a>';
}
if (b==0) {
	txt = '<font color=silver>' + ln[n] + '</font>';
}
document.write(txt);
}
function resizeFunction() {
  window.resizeTo(798,712);
}
resizeFunction();
document.writeln('<link href="main.css" rel="stylesheet" type="text/css">');
var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isWin=navigator.platform.indexOf('Win')!=-1?1:0;
var isDyn=isDOM||isIE||isNS4;
function getRef(id, par)
{
 par=!par?document:(par.navigator?par.document:par);
 return isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null));
}
function getSty(id, par)
{
 var r=getRef(id, par);
 return r?(isNS4?r:r.style):null;
}
if (!window.LayerObj) var LayerObj = new Function('id', 'par',
 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }
function LyrFn(fn, fc)
{
 LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; ' +
  'with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');
LyrFn('w','if (p) (isNS4?sty.clip:sty).width=p+px; ' +
 'else return (isNS4?ref.document.width:ref.offsetWidth)');
LyrFn('h','if (p) (isNS4?sty.clip:sty).height=p+px; ' +
 'else return (isNS4?ref.document.height:ref.offsetHeight)');
LyrFn('vis','sty.visibility=p');
LyrFn('write','if (isNS4) with (ref.document){write(p);close()} else ref.innerHTML=p');
LyrFn('alpha','var f=ref.filters,d=(p==null); if (f) {' +
 'if (!d&&sty.filter.indexOf("alpha")==-1) sty.filter+=" alpha(opacity="+p+")"; ' +
 'else if (f.length&&f.alpha) with(f.alpha){if(d)enabled=false;else{opacity=p;enabled=true}} }' +
 'else if (isDOM) sty.MozOpacity=d?"":p+"%"');
var CSSmode=document.compatMode;
CSSmode=(CSSmode&&CSSmode.indexOf('CSS')!=-1)||isDOM&&!isIE||isOp?1:0;
if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!isOp,
 db: CSSmode?'documentElement':'body' }
page.winW=function()
 { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function()
 { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }
page.scrollY=function()
 { with (this) return MS?win.document[db].scrollTop:win.pageYOffset }
page.scrollX=function()
 { with (this) return MS?win.document[db].scrollLeft:win.pageXOffset }
function tipTrack(evt, always) { with (this)
{
 evt=evt?evt:window.event;
 sX = page.scrollX();
 sY = page.scrollY();
 mX = isNS4 ? evt.pageX : sX + evt.clientX;
 mY = isNS4 ? evt.pageY : sY + evt.clientY;
 if (tipStick == 1) position();
}}
function tipPosition(forcePos) { with (this)
{
 if (!actTip) return;
 var wW = page.winW()-(isIE?0:15), wH = page.winH()-(isIE?0:15);
 var t=tips[actTip], tipX=eval(t[0]), tipY=eval(t[1]), tipW=div.w(), tipH=div.h(), adjY = 1;
 if (typeof(t[0])=='number') tipX += mX;
 if (typeof(t[1])=='number') tipY += mY;
 if (tipX + tipW + 5 > sX + wW) { tipX = sX + wW - tipW - 5; adjY = 2 }
 if (tipY + tipH + 5 > sY + wH) tipY = sY + wH - (adjY*tipH) - 5;
 if (tipX < sX+ 5) tipX = sX + 5;
 if (tipY < sY + 5) tipY = sY + 5;
 if ((!showTip && (doFades ? !alpha : true)) || forcePos)
 {
  xPos = tipX;
  yPos = tipY;
 }
 xPos += (tipX - xPos) * tipStick;
 yPos += (tipY - yPos) * tipStick;
 div.x(xPos);
 div.y(yPos);
}}
function tipShow(tipN) { with (this)
{
 if (!isDyn) return;
 if (tips[tipN].parentObj) tips[tipN].parentObj.show(tips[tipN].parentTip);
 if (!div) div = getLyr(myName + 'Layer');
 if (isDOM) div.sty.width = 'auto';
 if (actTip != tipN)
 {
  actTip = tipN;
  if (tipStick == 0)
  {
   if (isNS4) div.ref.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
   div.ref.onmouseover = new Function('evt', myName + '.show("' + tipN + '"); ' +
    'if (isNS4) return this.routeEvent(evt)');
   div.ref.onmouseout = new Function('evt', myName + '.hide(); ' +
   'if (isNS4) return this.routeEvent(evt)');
  }
  position(true);
  var str = template;
  for (var i=0; i<tips[tipN].length; i++) str = str.replace('%'+i+'%', tips[tipN][i]);
  div.write(str + ((document.all && !isWin) ? '<small><br></small>' : ''));
 }
 clearInterval(trackTimer);
 if (tipStick != parseInt(tipStick)) trackTimer = setInterval(myName+'.position()', 50);
 clearTimeout(fadeTimer);
 if (showDelay || isNS4)
  fadeTimer = setTimeout('with ('+myName+') { showTip = true; fade() }', showDelay + 10);
 else { showTip = true; fade() }
}}
function tipHide() { with (this)
{
 if (!isDyn || !actTip) return;
 if (isNS4 && tipStick==0 && xPos<=mX && mX<=xPos+div.w() && yPos<=mY && mY<=yPos+div.h())
  return;
 if (tips[actTip].parentObj) tips[actTip].parentObj.hide();
 clearTimeout(fadeTimer);
 fadeTimer = setTimeout('with (' + myName + ') { showTip=false; fade() }', hideDelay);
}}
function tipFade() { with (this)
{
 clearTimeout(fadeTimer);
 if (showTip)
 {
  div.vis('visible');
  if (doFades)
  {
   alpha += fadeSpeed;
   if (alpha > maxAlpha) alpha = maxAlpha;
   div.alpha(alpha);
   if (alpha < maxAlpha) fadeTimer = setTimeout(myName + '.fade()', 50);
  }
 }
 else
 {
  if (doFades && alpha > minAlpha)
  {
   alpha -= fadeSpeed;
   if (alpha < minAlpha) alpha = minAlpha;
   div.alpha(alpha);
   fadeTimer = setTimeout(myName + '.fade()', 50);
   return;
  }
  div.vis('hidden');
  actTip = '';
  clearInterval(trackTimer);
 }
}}
function TipObj(myName)
{
 this.myName = myName;
 this.tips = new Array();
 this.template = '';
 this.actTip = '';
 this.showTip = false;
 this.tipStick = 1;
 this.showDelay = 50;
 this.hideDelay = 250;
 this.xPos = this.yPos = this.sX = this.sY = this.mX = this.mY = 0;
 this.track = tipTrack;
 this.position = tipPosition;
 this.show = tipShow;
 this.hide = tipHide;
 this.fade = tipFade;
 this.div = null;
 this.trackTimer = this.fadeTimer = 0;
 this.alpha = 0;
 this.doFades = true;
 this.minAlpha = 0;
 this.maxAlpha = 100;
 this.fadeSpeed = 10;
}

var docTips = new TipObj('docTips');
with (docTips)
{
 tips.mysite = new Array(-75, 15, 150, '');
 tips.welcome = new Array(5, 5, 100, '');
 tips.useful = new Array(5, 5, 150, '');
 tips.formulae = new Array('page.scrollX() + page.winW() - 110', -20, 100,
  '');
 tips.format = new Array(5, 5, 150, '');
 template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
  '<tr><td><table bgcolor="#6699CC" cellpadding="3" cellspacing="0" width="100%" border="0">' +
  '<tr><td class="tipClass">%3%</td></tr></table></td></tr></table>';
}
var staticTip = new TipObj('staticTip');
with (staticTip)
{
//
//
//
// MAIN MENU DROP DOWNS 					#############################
//
//
 tips.links = new Array(-50, '97', 100, '',
  '<table cellpadding="0" cellspacing="1">' + 
  '<tr><td align=right id="menulinkpop" valign=middle  background="images/menu16.gif"><span ><a href="services.htm#l1"  target="inframe" name="nest1trig"> ' +
 
//, , , and 

 'Design&nbsp;&nbsp;</a></span></td></tr>' +
  '<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="services.htm#l2"  target="inframe" name="nest2trig"> ' +

  'Inspection&nbsp;&nbsp;</a></td></tr>' +
'<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="services.htm#l3"  target="inframe" name="nest3trig"> ' +

  'Maintenance&nbsp;&nbsp;</a></td></tr>' +
'<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="services.htm#l4"  target="inframe" name="nest4trig"> ' +

  'Installation&nbsp;&nbsp;</a></td></tr>' +
  
  '</table>');





tips.links2 = new Array(-50, '97', 100, '',
  '<table cellpadding="0" cellspacing="1">' + 
  '<tr><td align=right id="menulinkpop" valign=middle  background="images/menu16.gif"><span ><a href="projects.htm#l1"  target="inframe" name="nest1trig2" >' +
  
'Commercial&nbsp;&nbsp;</a></span></td></tr>' +
  '<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="projects.htm#l2"  target="inframe" name="nest2trig2">' +

  'Industrial&nbsp;&nbsp;</a></td></tr>' +
'<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="projects.htm#l3"  target="inframe" name="nest3trig2" >' +

  'Residential&nbsp;&nbsp;</a></td></tr>' +
'<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="projects.htm#l4"  target="inframe" name="nest4trig2" >' +

  'Institutional&nbsp;&nbsp;</a></td></tr>' +
'<tr><td id=menulinkpop align=right valign=middle  background="images/menu16.gif"> <a href="projects.htm#l5"  target="inframe" name="nest5trig2" >' +

  'Custom&nbsp;&nbsp;</a></td></tr>' +
  
  '</table>');




 template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="%2%" border="0">' +
  '<tr><td><table cellpadding="0" cellspacing="0" width="102px" border="0">' +
  '<tr><td bgcolor="#fefefe" align="center" height="*" class="tipClass">%4%</td></tr>' +
  '</table></td></tr></table>';

 tipStick = 0;
}




var nestTip = new TipObj('nestTip');
with (nestTip)
{
 tips.nest1 = new Array('staticTip.xPos + 101', 'staticTip.yPos + 4', 100,
  '<table cellpadding="0" cellspacing="1">' + 
 
  '<tr><td align=left valign=middle style="width:111px;height:24px;" background="images/menu2.gif"><span id="menulinkpop"><a href="#" name="nest1trig" onmouseover="nestTip.show(\'nest1\')" onmouseout="nestTip.hide()">' +
  '&nbsp;&nbsp;Link1</a></span></td></tr>' + 
  

  '</table>');
 // If you're using nested tips, for each tip you have to tell the script its parent tip
 // object and tip name within that object, so it knows to sync their showing and hiding.
 tips.nest1.parentObj = staticTip;
 tips.nest1.parentTip = 'links';

 // This tip is positioned via formulae based on its parent tip's position...
 tips.nest2 = new Array('staticTip.xPos + 95', 'staticTip.yPos + 50', 120,
  '');
 tips.nest2.parentObj = staticTip;
 tips.nest2.parentTip = 'links';



 template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="%2%" border="0">' +
  '<tr><td><table bgcolor="#fefefe" cellpadding="0" cellspacing="0" width="102px" border="0">' +
  '<tr><td class="tipClass">%3%</td></tr></table></td></tr></table>';

 tipStick = 0;
}


// Here's one illustrating a decimal tipStick value so it tags along behind the cursor.
var stickyTip = new TipObj('stickyTip');
with (stickyTip)
{
 tips.floating = new Array(5, 5, 100, 'Floating tips can have extra effect!');

 template = '<table bgcolor="#000000" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
  '<tr><td><table bgcolor="#339966" cellpadding="4" cellspacing="0" width="102px" border="0">' +
  '<tr><td align="center" class="tipClass">%3%</td></tr></table></td></tr></table>';

 tipStick = 0.2;
}



// Capture the onmousemove event so tips can follow the mouse. Add in all your tip objects here
// and also any functions from other scripts that need this event (e.g. my DHTML Scroller) too.
if (isNS4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = function(evt)
{

 // Add or remove all your tip objects from here!
 docTips.track(evt);
 staticTip.track(evt);
 nestTip.track(evt);
 stickyTip.track(evt);

 if (isNS4) return document.routeEvent(evt);
}


// A small function that refreshes NS4 on horizontal resize.
var nsWinW = window.innerWidth, nsWinH = window.innerHeight;
function ns4BugCheck()
{
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) location.reload()
}


window.onresize = function()
{

 ns4BugCheck();
}



var CSSmode=document.compatMode;
CSSmode=(CSSmode&&CSSmode.indexOf('CSS')!=-1)||isDOM&&!isIE||isOp?1:0;

if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!isOp,
 db: CSSmode?'documentElement':'body' }

// Get the current area of the visible window, check against minima.
page.winW=function()
 { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function()
 { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }

// Get the scroll position of the window. No real minima needed here.
page.scrollX=function()
 { with (this) return MS?win.document[db].scrollLeft:win.pageXOffset }
page.scrollY=function()
 { with (this) return MS?win.document[db].scrollTop:win.pageYOffset }

// Get the current document size, check versus minimum dimensions.
page.docW=function()
 { with (this) return Math.max(minW, isNS4?win.document.width:win.document.offsetWidth) }
page.docH=function()
 { with (this) return Math.max(minH, isNS4?win.document.height:win.document.offsetHeight) }

//var myw1 = page.winW();
