<!--
/*
This Script is copyrighted Web-design material by AMERISAGE.COM GROUP, LLC.
Under no circumstances does any individual or entity have the right to distribute,
copy or modify this program without the exclusive written permission.
*/

var ua = window.navigator.userAgent
var IEver = 0
var msie = ua.indexOf ( "MSIE " )
if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
{ IEver = parseInt( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) ) }


var LastLinkObj, LastLink, LastKeyPress
function RestoreLink() { LastLinkObj.href = LastLink }

var sWidth, sHeight, left_point, top_point, idbWin, IEfrm

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;
}


// Gets next field Index used in OnlyNumbers() below
// royalty free func. from: javascriptsource.com (needs further analisys if best method).
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}

function OnlyNumbers(obj,MaxL,CanBeZero,CanBeDec) { 

var qty = parseFloat(obj.value)
if (qty < 1 && CanBeZero != 0) { obj.value = "" }
if (isNaN(qty)) { obj.value = "" }
if (isNaN(obj.value)) { obj.value = qty }

xDec = obj.value.indexOf(".")
if (xDec != -1 && CanBeDec != ".") { obj.value = obj.value.slice(0, xDec) }

GoNext(obj,MaxL)
}

function GoNext(obj,MaxL,UCase) {
if (obj.maxLength > 0) { MaxL = obj.maxLength }

var StayKeys = false
if (IEver > 4) { k = event.keyCode;
if (k==9||k==35||k==36||k==37||k==39||k==16||k==46||k==8||event.shiftKey) { StayKeys = true 
  } else {
if (UCase == "U") { strVal = obj.value; strVal = strVal.toUpperCase(); obj.value = strVal }
  }
 }

if(obj.value.length >= MaxL && !StayKeys) {
xIndex = (getIndex(obj)+1) % obj.form.length

obj.form[xIndex].focus()
if (obj.form[xIndex].type == "text") { obj.form[xIndex].select() }
 }
}




function MenuHover(xEvent,xStatus) { IMGrowObj = document.all.ImagesRow

if (xStatus == "over") { 
xEvent.style.backgroundColor = "maroon"; xEvent.style.color = "white"
IMGrowObj.cells[xEvent.parentElement.cellIndex].bgColor = "#EEA793"
 } else {
xEvent.style.backgroundColor = "silver"; xEvent.style.color = "black"
IMGrowObj.cells[xEvent.parentElement.cellIndex].bgColor = "#FCF1C9"
 }
}


function TabHover(xEvent,xStatus) { 
linkObj = xEvent.parentElement

if (xStatus == "over") { 
xEvent.color = "black"
linkObj.parentElement.bgColor = "gold"
 } else {
xEvent.color = "white"
linkObj.parentElement.bgColor = "gray"
 }
}



function bbOver(o) {
document.body.style.cursor = "hand"

if (o.parentElement) { prnt = o.parentElement }
else if (o.parentNode) { prnt = o.parentNode }

if (prnt) prnt.vAlign = "bottom"

status=o.alt
}

function bbOut(o) {
document.body.style.cursor = "default"

if (o.parentElement) { prnt = o.parentElement }
else if (o.parentNode) { prnt = o.parentNode }

if (prnt) prnt.vAlign = "top"

status=""
}


function DoFocus(xEvent) { if (IEver >= 4) { var x, xLabel = xEvent.parentElement
if (xLabel.className == "xMain") {
xLabel.style.backgroundColor = "#6090A0"; xLabel.style.color = "beige"

 for (x=0 ; x < 6 ; x++) { xLabel = xLabel.parentElement
 if (xLabel.className == "xOuter") {
xLabel.children["MainQ"].style.backgroundColor = "#6090A0"
xLabel.children["MainQ"].style.color = "beige"
break }}}}
}


function DeFocus(xEvent) { if (IEver >= 4) { var x, xLabel = xEvent.parentElement
if (xLabel.className == "xMain") {
xLabel.style.backgroundColor = "beige"; xLabel.style.color = "#6090A0"

 for (x=0 ; x < 6 ; x++) { xLabel = xLabel.parentElement
 if (xLabel.className == "xOuter") {
xLabel.children["MainQ"].style.backgroundColor = "beige"
xLabel.children["MainQ"].style.color = "#6090A0"
break }}}

if (xEvent.type == "text" && xEvent.name.indexOf("n_") == 0 && xEvent.name.indexOf("_cur") > 0) 
{ JSFormatNumber(xEvent) }
 }
}


function InsertOption(OBJ,MaxLen) {
if (!MaxLen) { MaxLen = 20 }
var LastOption = OBJ.length-1
if (OBJ.selectedIndex == LastOption) {
var OtherOption = prompt("Since you selected 'Other...', please specify:","")

if (OtherOption != "" && OtherOption != null && OtherOption.indexOf("<") == -1) { 
OBJ.options[0].text = OtherOption.substring(0,MaxLen) }
OBJ.selectedIndex = 0
 }
}


// Newer Version of InsertOption - Combo-box:

var LastSelectObj

function CustomOption(SelectObj,TxtMaxLen,TxtIDvalue,TxtCLASSvalue) {
 if (SelectObj.selectedIndex == SelectObj.length-1) { LastSelectObj = SelectObj;

if (!TxtMaxLen || isNaN(TxtMaxLen)) TxtMaxLen = 25; // default

TxtField = document.createElement("input");
TxtField.type = "text";
TxtField.value = "Please specify...";

if (TxtIDvalue) TxtField.id = TxtIDvalue;
if (TxtCLASSvalue) TxtField.className = TxtCLASSvalue;

	if (SelectObj.offsetWidth) { 
TxtField.style.width = SelectObj.offsetWidth + "px" ;
TxtField.style.height = SelectObj.offsetHeight + "px" ;
	}

SelectObj.style.display = "none";

SelectObj.parentNode.appendChild(TxtField);
TxtField.size = 20;
TxtField.maxLength = TxtMaxLen;

	TxtField.onblur = function() { UpdateOption(this) }

	TxtField.onclick = function() {
if (this.value == "Please specify...") this.value = "";
	}

	TxtField.onkeydown = function(event) { k = -1
if (window.event) { k = window.event.keyCode } // IE: event global is present, use window.e...
else if (arguments.length > 0)  { k = arguments[0].keyCode } // mozilla: event must be passed

if (k==38 || k==40) { // entered up / down (arrow)  k==27 esc key (different on Mac):
UpdateOption(this); return false }
	}

TxtField.focus()
TxtField.select()
 }
}

function UpdateOption(o) {
v = o.value;
LastSelectObj.parentNode.removeChild(o);
LastSelectObj.style.display = "";
if (v && v != " " && v != "Please specify...") LastSelectObj.options[0].text = v;
LastSelectObj.selectedIndex = 0;
LastSelectObj.focus()
}

// End Newer Version of InsertOption - Combo-box



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
}}}

// func. below called with timer: setTimeout("LoginWin()",1200000) = 20min in miliseconds

function LoginWin() { 
LogConf = confirm("Your login session is about to expire.\n"+
"Do you want to relogin to continue working?")

if (LogConf) { window.open("index.asp?JBox=Yes","login","width=450,height=400,scrollbars=yes") }
}


function STATEtoCOUNTRY(Obj,xField) {
n = Obj.selectedIndex

cObj = af.Country
status = n

if (n > 52) { cObj.selectedIndex = 2 } else { cObj.selectedIndex = 1 }
}


function ChangeTimeZone(o) { var SI
o = o.options[o.selectedIndex].value

PacificT = "BC,YT,CA,WA,OR,NV"
MountainT = "AB,NT,SK,MT,ID,WY,UT,CO,AZ,NM"
CentralT = "MB,NU,ND,SD,MN,WI,NE,IA,IL,IN,KS,MO,TN,OK,AR,MS,AL,TX,LA"
EasternT = "ON,PQ MI,OH,KY,GA,FL,WV,VA,NC,SC,PA,NY,NJ,VT,NH,ME,MA,CT,DE,MD,DC"
AtlanticT = "NB,NS,NF,PE"


if (PacificT.indexOf(o) != -1) SI = 0
if (MountainT.indexOf(o) != -1) SI = 1
if (CentralT.indexOf(o) != -1) SI = 2
if (EasternT.indexOf(o) != -1) SI = 3
if (AtlanticT.indexOf(o) != -1) SI = 4

tf.n_TimeZone.selectedIndex = SI
}


// 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 InserText(o,t) {
if (o.innerText) { o.innerText = t }
else if (o.textContent) {  o.textContent = t }
else { alert("Incompatible browser.") }
}





var aTAB, aTabCell, aTabLine

function MainLoader() {

aTAB = getElementsByClass("RowTab","TR")
aTabCell = getElementsByClass("TabCell","TD")
aTabLine = getElementsByClass("TabLine","TD")


}



function ChangeiTab(o,n) {
LastLinkObj = o; LastLink = o.href 

if (n == 1) {
aTAB[0].style.display = "none"
aTAB[1].style.display = ""

aTabCell[1].bgColor = "beige"
aTabLine[1].bgColor = "beige"
aTabCell[0].bgColor = "#E6E6E6" // very light silver: RGB: 230,230,230
aTabLine[0].bgColor = "#6090A0" // the blue theme used throughout the site

 } else {

aTAB[1].style.display = "none"
aTAB[0].style.display = ""

aTabCell[0].bgColor = "beige"
aTabLine[0].bgColor = "beige"
aTabCell[1].bgColor = "#E6E6E6"
aTabLine[1].bgColor = "#6090A0"
 }

o.href = "javascript:RestoreLink()"
o.blur()
}


// -->