<!--
/*

This Script is copyrighted Web-design material by Gertex Hosiery Inc. and/or Planet networks.
Under no circumstances does any individual or entity have the right to distribute,
copy or modify this program without the exclusive written permission.
For information regarding this script or to report a bug please write to:
it@gertex.com
*/


var ua = window.navigator.userAgent
var TestedBrowsers = false
var IEver = 0
var NSver = 0
var FFver = 0
var IEmac

var msie = ua.indexOf("MSIE ")
if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
{ IEver = parseInt( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) ) 

if (ua.indexOf("Mac") > 0) { IEmac = true }
}


var Netscape = ua.indexOf("Netscape")

if (Netscape != -1) {
nss = ua.indexOf("/",Netscape)
NSver = parseInt(ua.substring(nss+1,nss+4))
}

var Firefox = ua.indexOf("Firefox")

if (Firefox != -1) {
ffs = ua.indexOf("/",Firefox)
FFver = parseInt(ua.substring(ffs+1,ffs+4))
}


if (IEver >= 4 || NSver >= 7 || FFver >= 1 || ua.indexOf("Safari") != -1) TestedBrowsers = true

var LastLinkObj, LastLink, LastKeyPress
function RestoreLink() { LastLinkObj.href = LastLink }


var wFeatures="toolbar=no,location=no,scrollbars=auto,channelmode=no,"+
"directories=no,status=no,menubar=no"

var sWidth, sHeight, left_point, top_point

if (window.screen) {
sWidth = window.screen.availWidth
sHeight = window.screen.availHeight
 } else {
sWidth = 800; sHeight = 600
 }



function getElementsByClass(className,SpecificField) {
if (!SpecificField) SpecificField = "*"

  var all = document.getElementsByTagName(SpecificField)
  var elements = new Array();
  for (var e = 0; e < all.length; e++)
    if (all[e].className == className)
      elements[elements.length] = all[e];
  return elements;
}



var PageLoaded = false

function Loader() {

PageLoaded = true
}




var tempImg, aRO = new Array()

function ImagesLoader() {

 for (x=0; x<document.images.length; x++) {

	if (document.images[x].name == "RO") {
document.images[x].title = document.images[x].alt

// Preload hover images for faster retrieval from cache:
aRO[x] = new Image()
aRO[x].src = document.images[x].src.replace(".gif","-hover.gif")
document.images[x].onmouseover = function() { this.src = this.src.replace(".gif","-hover.gif") }
document.images[x].onmouseout = function() { this.src = this.src.replace("-hover.gif",".gif") }

	} else if (document.images[x].name == "OE") {

document.images[x].onmouseover = function() {
this.style.opacity=0.5; if (IEver > 5) this.filters.alpha.opacity=50

tempImg = this; // shut it off bag to regular:
setTimeout("tempImg.style.opacity=1; if (IEver > 5) tempImg.filters.alpha.opacity=100",400)
 }

document.images[x].onmouseout = function() { this.style.opacity=1; if (IEver > 5) this.filters.alpha.opacity=100 }

	}
 }
}

window.addEventListener?window.addEventListener("load",ImagesLoader,false):window.attachEvent("onload",ImagesLoader);





function JSFormatNumber(Obj) { xNum = Obj.value

if (xNum && !isNaN(xNum)) { DecPos = xNum.indexOf(".")

if (DecPos != -1) {
xDecimals = xNum.substring(DecPos+1,xNum.length)
xNum = xNum.substring(0,DecPos)
xNum = Math.abs(xNum)
} else { xNum = Math.abs(xNum); xDecimals = "" }

switch(xDecimals.length) {
case 0:
Obj.value = xNum+".00"; break
case 1:
Obj.value = NewNum = xNum+"."+xDecimals+"0"; break
case 2:
Obj.value = xNum+"."+xDecimals; break
}}}


function FormatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (num + '.' + cents);
}



function STATEtoCOUNTRY(Obj,xField) {
n = Obj.selectedIndex
cObj = tf.Country

if (n > 2) { cObj.selectedIndex = 2 } else { cObj.selectedIndex = 1 }
}




function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function isDate(month,day,year) {

var today = new Date();
year = ((!year) ? y2k(today.getYear()):year);
month = ((!month) ? today.getMonth():month-1);

if (!day) return false
var test = new Date(year,month,day);

if ((y2k(test.getYear()) == year) &&
(month == test.getMonth()) &&
(day == test.getDate()) )

return true;
else
return false
}



// Context function:

function showMenu(e,DisplayObj,WW,HH) { var HorPos, VerPos, availRight, availBottom

if (e.clientX) { HorPos = e.clientX; VerPos = e.clientY }
else if (e.pageX) { HorPos = e.pageX; VerPos = e.pageY }

if (isNaN(HorPos)) return false

 if (document.body.clientWidth) {
availRight = document.body.clientWidth - HorPos
availBottom = document.body.clientHeight - VerPos
 } else {
availRight = window.innerWidth - HorPos
availBottom = window.innerHeight - VerPos
 }

  if (typeof(window.pageXOffset) != "undefined")
{ x = window.pageXOffset; y = window.pageYOffset }

  else if ((!document.compatMode || document.compatMode == "BackCompat") && 
document.body && typeof(document.body.scrollLeft) != "undefined")
{ x = document.body.scrollLeft; y = document.body.scrollTop }

  else if (document.compatMode == "CSS1Compat" && document.documentElement &&
typeof(document.documentElement.scrollLeft) != "undefined")

{ x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop }

 else { x = 0; y = 0 }

HorPos = HorPos + x; VerPos = VerPos + y

var pxWidth, pxHeight
DisplayObj.style.display = "block"

 if (DisplayObj.offsetHeight) 
 { pxWidth = DisplayObj.offsetWidth; pxHeight = DisplayObj.offsetHeight }
 else if (HH) { pxWidth = WW; pxHeight = HH }
 else if (DisplayObj.height) { pxWidth = DisplayObj.width; pxHeight = DisplayObj.height }
 else { pxWidth = 350; pxHeight = 200 }

if (availRight >= pxWidth) { DisplayObj.style.left = HorPos
 } else { DisplayObj.style.left = HorPos-pxWidth }
if (availBottom >= pxHeight) { DisplayObj.style.top = VerPos
 } else { DisplayObj.style.top = VerPos-pxHeight}


if (IEfrm && document.all && !IEmac) {
// display BG Iframe for IE based browsers (exept Mac) to cover <select> fields:
IEfrm.width = pxWidth; IEfrm.height = pxHeight
IEfrm.style.top = DisplayObj.style.top
IEfrm.style.left = DisplayObj.style.left
IEfrm.style.display = "block"
 }
}




function LocateOnMap() { f = document.r1

pbURL = "http://www.mapquest.com/maps/map.adp?formtype=address&addtohistory="+
"&address=9%20Densley%20Avenue&city=Toronto&state=ON&zipcode=M6M&country=CA&geodiff=1"

w = sWidth-150
h = sHeight-150

pbWinFeatures = "scrollbars=yes,resizable=yes,width="+w+",height="+h+"top=75,left=75"

pbWin = window.open(pbURL,"pbWin",pbWinFeatures)
if (pbWin) pbWin.focus()
}


function SearchSubmit(o) {
t = o.value

if (t.length < 2) {
alert("Please enter at least 2 characters for your search."); 
o.focus()
return false
 }
}


function InserText(o,t) {
if (o.innerText) { o.innerText = t }
else if (o.textContent) {  o.textContent = t }
}

function getInserText(o) { t = ""
if (o.innerText) { t = o.innerText }
else if (o.textContent) {  t = o.textContent }
return t
}


var TickObj, OrigTxt, TxtCount = 1

function TxtTick(htmlID) {
if   (htmlID) TickObj = document.getElementById(htmlID)
if (!OrigTxt) OrigTxt = getInserText(TickObj)
if (!OrigTxt) return false

t = OrigTxt.substring(0, TxtCount) + "_"

InserText(TickObj,t)
TxtCount++

if (TxtCount < OrigTxt.length) { setTimeout("TxtTick()", 80) } else { InserText(TickObj,OrigTxt) }
}


var ASopen = false;

function ShowAltSites(o) { if (ASopen) return false
VerPos = findPos(o)[1]

 if (typeof(VerPos) == "number") {
CloseH = o.offsetHeight
document.getElementById("AltSites").style.display = "";
OpenH = o.offsetHeight - CloseH

availBottom = (document.body.clientHeight) ? document.body.clientHeight : window.innerHeight
availBottom = availBottom - VerPos - CloseH
// alert(availBottom +" : "+ OpenH)

if (availBottom < OpenH) o.style.marginTop = "-" + OpenH + "px"
 }
ASopen = true;
}


function RemoveAltSites(e,o) { 
if (window.event) { e = window.event } // IE: event global is present, use window.e...
else if (arguments.length > 0)  { e = arguments[0] }  // orig mozilla & some others: event must be passed

var tg = (e.relatedTarget) ? e.relatedTarget : e.toElement;

 if (tg.className != "countryDD" && tg.parentNode.className != "countryDD" && 
tg.parentNode.parentNode.className != "countryDD" && tg.parentNode.parentNode.parentNode.className != "countryDD") {
document.getElementById("AltSites").style.display = "none"; // TD being the 1st parent element
o.style.marginTop = "2px";
ASopen = false;
 }
}


function findPos(obj) {
	var curleft = curtop = 0;
if (obj.offsetParent) {
	do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);

	return [curleft,curtop];
}}




// -->