// JavaScript Document
<!-- Begin
var isNetscape = navigator.appName=="Netscape";
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Global variables
var xMousePos = 0; // Horizontal position of the mouse on the screen
var yMousePos = 0; // Vertical position of the mouse on the screen
var xMousePosMax = 0; // Width of the page
var yMousePosMax = 0; // Height of the page
document.onmousemove=captureMousePosition;

function captureMousePosition(e) {
    if (document.layers) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }	
	if (xMousePos < 0){xMousePos = 0}
	if (yMousePos < 0){yMousePos = 0}
	if (xMousePosMax < 0){xMousePosMax = 0}
	if (yMousePosMax < 0){yMousePosMax = 0}
  
	return true;
}

function doNuhn(txt) {
	if (txt) window.status = txt;
}


function shohyde(id) {
	var tdiv = getRefToDiv(id); 
	if (tdiv.style.visibility == "visible") {
		tdiv.style.visibility = "hidden";
		tdiv.style.height = "2px";
		tdiv.style.overflow = "hidden";
		eval ("document." + id + "_btn.src='px/plus.gif'");
		eval ("document." + id + "_btn.alt='Open section'");
	}
	else {
		tdiv.style.visibility = "visible";
		tdiv.style.height = "auto"; // 272px
		tdiv.style.overflow = "visible";
		eval ("document." + id + "_btn.src='px/minus.gif'");
		eval ("document." + id + "_btn.alt='Close section'");
	}
}

function getRefToDiv(divID) {
	if( document.layers ) { return document.layers[divID+'C'].document.layers[divID]; };
	if( document.getElementById ) {return document.getElementById(divID); };
	if( document.all ) { return document.all[divID]; };
	if( document[divID+'C'] ) { return document[divID+'C'].document[divID]; };
	return false;
}

/*
function getRefToDiv(divID,oDoc) {
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) {
			return oDoc.layers[divID];
		} else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDiv(divID,oDoc.layers[x].document);
			}
			return y;
		}
	}
	return false;
}
*/

function showDiv(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.style ) { myReference.style.visibility = 'visible'; } else {
		if( myReference.visibility ) { myReference.visibility = 'show'; } else {
			window.alert('Nothing works in this browser'); return; } }
}

function hideDiv(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
		if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
			window.alert('Nothing works in this browser'); return; } }
}

function innerHtmlDiv(divID_as_a_string,txt) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = txt; } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write( txt );
			myReference.document.close();
		} else {
			window.alert('Browser error' + txt); return; }
    }
}

function moveDiv(divID_as_a_string,x,y) {
	myReference = getRefToDiv(divID_as_a_string);
	var noPx = document.childNodes ? 'px' : 0;
	if( !myReference ) {
		window.alert('Nothing works in this browser');
		return; //don't go any further
	}
	if( myReference.style ) { myReference = myReference.style; }
	myReference.left = parseInt(x) + noPx;
	myReference.top = parseInt(y)+ noPx;

}

function showballoon (txt) {
	innerHtmlDiv('InfoBalloon',txt)
	moveDiv ('InfoBalloon', xMousePos-40, yMousePos-50); 
	showDiv('InfoBalloon');
}

function hideballoon () {
	hideDiv('InfoBalloon');
}

function getkey(e) {
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}
function RComma(S) { S = String(S)
  var RgX = /^(.*\s)?([-+\u00A3\u20AC]?\d+)(\d{3}\b)/
  return S == (S=S.replace(RgX, "$1$2,$3")) ? S : RComma(S) 
 };
 
function tonum (num) { return (parseFloat(num.toString().replace(/\$|\,/g,''))); };
function tonum1 (num) { return (parseFloat('0'+num.toString().replace(/\D/g, '')));  };

function formatCurrency(num,quant) {
	num = tonum(num) * tonum(quant);
	if (isNaN(num)) num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if (cents < 10)	cents = "0" + cents;
	for (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 (((sign)?'':'-') + '$' + num + '.' + cents);
}

function checkMail(xmail) {
	filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(xmail)) return true;
	else return false;
}
function checkPhone(xphone) {
    xphone = xphone.toString().replace(/\D/g, '');
	filter  = /^(\d{10,20})$/;
	if (filter.test(xphone)) return true;
	else return false;
}
function checkZip (xzip) {
	xzip = xzip.toString().replace(/\D/g, '');
	filter  = /^(\d{5,9})$/;
	if (filter.test(xzip)) return true;
	else return false;
};


function copyit(theField) {
  var tempval=eval("document."+theField);
  tempval.focus();
  tempval.select();
  therange=tempval.createTextRange();
  therange.execCommand("Copy");
}

function getwinmax() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  xMousePosMax = myWidth;
  yMousePosMax = myHeight;
}

getwinmax();

var slideinaction = { showAni: 1000, //animate speed
	msgb4: "", qnxt: 0,
	hideAni: 750, pauseani: 2000, timer:null, timer2:null, point:null,init:function(ID)
{
el=document.getElementById(ID);
this.showMult=el.offsetWidth/this.showAni/this.showAni;
this.hideMult=el.offsetWidth/this.hideAni/this.hideAni;
el.style.visibility="visible";
}
,showit:function(msg,e,ID)
{
	if (this.timer2) { // check if already have one out
		this.qnxt = 1;
	}
	if (msg != this.msgb4) {
		this.msgb4 = msg;
		if(this.timer2) // new - av - 11-26-07
			{clearTimeout(this.timer2); // new - av - 11-26-07
			this.timer2=0; // new - av - 11-26-07
		} // new - av - 11-26-07
		if(this.timer)
			{clearTimeout(this.timer);
			this.timer=0;
		}
		this.point=document.getElementById(ID);
		this.stuffid = document.getElementById(msg);
		this.movTo(0,528);
		this.writeTip();
		this.w=this.point.offsetWidth;
		this.h=this.point.offsetHeight;
		this.startTime=(new Date()).getTime();
		this.timer=setInterval("slideinaction.rollOut()",10);
	} // end if new msg txt div
}
,rollOut:function()
{var elapsed=(new Date()).getTime()-this.startTime;
if(elapsed<this.showAni)
{var cv=this.w-Math.round(Math.pow(this.showAni-elapsed,2)*this.showMult);
this.movTo(0,528-cv);
}
else
{this.movTo(0,0);
clearInterval(this.timer);
this.timer=0;
}
}
,pauseit:function()
{
	if(this.timer2)
		{clearTimeout(this.timer2);
		this.timer2=0;
	}
}
,hydit:function()
{
	if(this.timer2)
		{clearTimeout(this.timer2);
		this.timer2=0;
	}
	this.timer2 = setTimeout("slideinaction.slideout()",this.pauseani);  // new - av - 11-26-07
}
,slideout:function(){
	 this.msgb4 = "";
if(this.timer2) // new - av - 11-26-07
{clearTimeout(this.timer2); // new - av - 11-26-07
this.timer2=0; // new - av - 11-26-07
} // new - av - 11-26-07
	if(this.timer)
{clearTimeout(this.timer);
this.timer=0;
}
this.startTime=(new Date()).getTime();
this.timer=setInterval("slideinaction.rollUp()",10);
}
,rollUp:function()
{var elapsed=(new Date()).getTime()-this.startTime;
if(elapsed<this.hideAni)
{var cv=Math.round(Math.pow(this.hideAni-elapsed,2)*this.hideMult);
this.movTo(0,528-cv);
}
else
{this.movTo(0,528);
clearInterval(this.timer);
this.timer=0;
this.point=null;
}
}
,writeTip:function()
{if(this.point&&typeof this.point.innerHTML!="undefined")this.point.innerHTML=this.stuffid.innerHTML;}
,movTo:function(top,lft)
{if(this.point&&this.point.style){this.point.style.top=top+"px";this.point.style.left=lft+"px";}}
};

// End -->
