function showLoader(loader) {
   $(loader).show();
}

function hideLoader(loader) {
   $(loader).hide();
}

//We're appending a unique key/value at the end of our url to prevent caching in 
//frickin Internet Exploiter (http://www.codestore.net/store.nsf/unid/BLOG-20071130)
function bogusQueryStringParam() {
	return '&_' + new Date().getTime();
}
<!-- Begin Drop Down Nav Menu Functions -->

//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 0, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}

}
<!-- End Drop Down Nav Menu Functions -->

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

<!-- Begin ARC Sub Menu Functions -->
function arcDrop(div) {
	if(document.getElementById(div).style.display == 'none') {
		document.getElementById(div).style.display = '';	
	}else {
		document.getElementById(div).style.display = 'none';	
	}
}
/*function ARCSubsHID() {
	if(document.getElementById('arc_subnav').style.display = '') {
		document.getElementById('arc_subnav').style.display = 'none';	
	}
}*/

<!-- End ARC Sub Menu Functions -->
///
//pop up code
<!--
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
		newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
	}
//-->
//pop up code end

/////////////////////////////////////////////////////////////////////////////
function formHandler(form){ //quick nav for arc
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	window.location.href = URL;
}
/////////////////////////////////////////////////////////////////////////////

<!-- Begin User Preferences Toolbar Functions -->
var min = 10;
var max = 14;

//function add by Calvin D. Hill
//this is our primary function for modifying the font-size 
//and saving user preference (if no arguments are passed in,
//we're loading our preference from the cookie							  
function changeFontSize() {
	var cookie = readCookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);

	/**********************************************************************************************
	if (arguments.length > 0) {
		var mode = arguments[0];
	 
		if (mode == 1) {
			var s = increaseFontSize();
		} else if (mode == 0) {
			var s = decreaseFontSize();
		} //if (mode == 1)
		
		//write our preferred size to our cookie
		//alert("Writing Our Cookie\nPreferred Font Size => " + s + "px");
		createCookie("fontSizePref",s,365); 	
	} else {
		//no arguments were passed in, so we're going to read from our cookie and see
		//what the user preference is		
		var fSize = readCookie("fontSizePref");
		//alert("Preferred Font Size (as stored in cookie) => " + fSize + "px"); //for testing
		
		if (fSize) {			
			//load our elements into an array and set the preferred font size
			var p = document.getElementsByTagName('*');   
		    for(i=0;i<p.length;i++) {
				//we're going to skip adjusting our product browse size
				if (p[i].id != "pbrowse") {  
					p[i].style.fontSize = fSize+"px";				
				}//if (p[i].id != "pbrowse")				
		    } //for(i=0;i<p.length;i++)			
		} //if (fSize)
	} //if (arguments.length > 0)
	**********************************************************************************************/

}//function changeFontSize()

function increaseFontSize() {
	var p = document.getElementsByTagName('*');   
	
	for (i = 0; i < p.length; i++) {
		if (p[i].style.fontSize && !(p[i].style.fontSize < min)) {		  
			var s = parseInt(p[i].style.fontSize.replace("px",""));
		} else {
			var s = max;
		}//if (p[i].style.fontSize && !(p[i].style.fontSize < min))
		
		if (s != max) {
			s += 1;
		}//if (s != max)

		//we're going to skip adjusting our product browse size
		if (p[i].id != "pbrowse") {
			p[i].style.fontSize = s+"px";		  
		}//if (p[i].id != "pbrowse")	
	}//for (i = 0; i < p.length; i++)
	
	//return our variable for storing the selected font-size   
	return s;
}//function increaseFontSize()

function decreaseFontSize() {
	var p = document.getElementsByTagName('*'); 

	for (i = 0; i < p.length; i++) {
		if (p[i].style.fontSize) {		  		
			var s = parseInt(p[i].style.fontSize.replace("px",""));
		} else {
			var s = min;		 
		}//if (p[i].style.fontSize)
		
		if (s != min) {
			s -= 1;
		}//if (s != min)
		
		//we're going to skip adjusting our product browse size
		if (p[i].id != "pbrowse") {
			p[i].style.fontSize = s+"px";		  
		}//if (p[i].id != "pbrowse")
	
	}//for (i = 0; i < p.length; i++)   

	//return our variable for storing the selected font-size   
	return s;
}//function decreaseFontSize()

function toggleMenu(mode,save) {
	//check to see if save is defined, if not set default value (true)
	save = typeof(save) != 'undefined' ? save : true;
	if (mode == 0) {
		if (document.getElementById('left-side')) {document.getElementById('left-side').style.display = "none";}		
		if (document.getElementById('hiding')) {document.getElementById('hiding').style.display = "none";}
		if (document.getElementById('show')) {document.getElementById('show').style.display = "";}	
		if (document.getElementById('right-pane')) {document.getElementById('right-pane').style.width = "782px";}	
		if (document.getElementById('products-container')){ document.getElementById('products-container').style.width = "620px";}
		
		//adjust our map details and google maps div back to original width
		if ($('map') && $('mapDetails')) {
			if ($('map')) {$('map').setStyle({width: '370px'});}
			if ($('mapDetails')) {$('mapDetails').setStyle({width: '367px'});}
		}//if ($('map') ||$('mapDetails'))	
	} else if (mode == 1) {
		if (document.getElementById('left-side')){document.getElementById('left-side').style.display = "";}	
		if (document.getElementById('show')){document.getElementById('show').style.display = "none";}
		if (document.getElementById('hiding')){document.getElementById('hiding').style.display = "";}	
		if (document.getElementById('right-pane')){document.getElementById('right-pane').style.width = "590px";}
		if (document.getElementById('products-container')){ document.getElementById('products-container').style.width = "400px";}

		//adjust our map details and google maps div to fit with the product browse/attribute search menu showing
		if ($('map') && $('mapDetails')) {
			if ($('map')) {$('map').setStyle({width: '290px'});}
			if ($('mapDetails')) {$('mapDetails').setStyle({width: '285px'});}
		}//if ($('map') ||$('mapDetails'))		
	}//if (mode == 0)

	//only update our cookie when specified
	if (save) {
		//update our cookie
		saveProductBrowsePreference(mode);	
	} //if (save)
}

//function to save product browse menu preference
function saveProductBrowsePreference(mode) {
	//let's create our cookie with their product browse menu preference
	createCookie("pBrowsePref",mode,365); 	
}//function saveProductBrowsePreference(mode)

//function to get product browse menu preference (reads from cookie)
//and set's the style property of our product-menu element
function getProductBrowsePreference() {
	//let's retrieve our product browse menu preference
	var pref = readCookie("pBrowsePref");	
	toggleMenu(pref);
}//function getProductBrowsePreference()

//-- Begin StyleSwitcher Functions --//

function setActiveStyleSheet(title) { 
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

//-- End StyleSwitcher Functions (http://www.alistapart.com/articles/alternate/) --//

//function to create our cookie
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

//function to read our cookie (by passed in name)
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
<!-- End User Preferences Toolbar Functions -->

<!-- Begin Product Page Functions -->
function openProductDownload(url){
	var winName = 'downloads';
	var features = 'resizable=no,width=425,height=245,scrollbars=no';
	window.open(url,winName,features);
}
function openLarge(imageref){
	var url = 'images/large_image.php?imageref=' + imageref;
	var winName = 'large';
	var features = 'resizable=no,width=600,height=450,scrollbars=yes';
	window.open(url,winName,features);
}

function showImage(showImage, numImages){
	//hide all images
	for (i=1; i<=numImages; i++){
		document.getElementById("prod" + i).style.display = 'none';
	}
	//show new main Image
	document.getElementById(showImage).style.display = 'block';
}

function changeImg(id) {
	if ($(id).className == "expand") {
		$(id).className = "collapse";
	} else {
		$(id).className = "expand";
	}	
	return;
} //function changeImg(id)

//used on our products index
function showDiv(divRef) {
	//get our nav and div elements for setting current item visibility, etc.
	var navContainerArray = $('products-nav').getElementsByTagName('a');
	var divContainerArray = $('products-container').getElementsByTagName('div');

	//reset our other nav links
	for (j = 0; j < navContainerArray.length; j++) {
		navContainerArray[j].className = " ";
	}//for (j = 0; j < navContainerArray; j++)
	
	//hide all our other divs	
	for (i = 0; i < divContainerArray.length; i++) {
		if (divContainerArray[i].id != '') {
			divContainerArray[i].style.display = "none";
		}//if (divContainerArray[i].id != '')
	}//for (i = 0; i < divContainerArray.length; i++)
	
	//attempt to show our div and set our current link
	if ($(divRef)) {
		//set our active nav link
		$('nav-' + divRef).className = "current";
		
		//show our div
		$(divRef).style.display = "block";		
	}//if ($(divRef))		
	
}//function showDiv(divRef)

/******* Begin Product Page Tab Functions *******/
function setActiveTab(tab) {
	//inactivate our previously active tab
	for (var i = 0; i < $('tabNav').getElementsByTagName('li').length;i++) {
		$('tabNav').getElementsByTagName('li')[i].className = "";
	} //for (var i = 0; i < $('tabnav').getElementsByTagName('a').length;i++)
	
	if ($(tab+'Tab')) {
		//set our active tab
		$(tab+'Tab').className = "active";		
	
		//show our content for this tab
		showContent(tab);			
	}//if ($(tab+'Tab'))
	
}//function setActiveTab(tab)

function showContent(div) {
	var contentDivContainerArray = $('ContentDivContainer').immediateDescendants();
	//hide all our other divs
	for (var i = 0; i < contentDivContainerArray.length;i++) {	
			contentDivContainerArray[i].style.display = "none";		
	} //for (var i = 0; i < contentDivContainerArray.length;i++)

	//reset our ex/col images
	resetExColImg(div);
			
	//show our div
	if ($(div+'Content')) { $(div+'Content').style.display = "block"; } //if ($(div+'Content'))	
} //function showContent(div)

//function to reset our expand/collapse images
//images weren't preserving status when switching tabs 
//(because we're changing the class name, instead of setting the image src)
function resetExColImg(parentDivID) {
	var spanArray = $(parentDivID+'Content').getElementsByTagName('span');
	var divArray = $(parentDivID+'Content').getElementsByTagName('div');

	//reset our defacto configurator, only on our elements page
	if (parentDivID == 'elements') {
		var tArray = $(parentDivID+'Content').immediateDescendants();				
		for (k = 0; k < tArray.length; k++) {	
				if (tArray[k].id != '') {				
					activateAll(tArray[k].id);
				}//if (typeof(tArray[k]) == "[object HTMLDivElement]")
		}//for (k = 0; k < tArray.length; k++)
	}//if (parentDivID == 'elements')	

	//need to iterate through the divs as well (since we're doing some funky stuff for this site's product pages)
	for (j = 0; j < divArray.length; j++) {		
		if (divArray[j].className == "ex-col-content") {
			divArray[j].style.display = "none";
		}//if (divArray[j].id != '')		
	}//for (j = 0; j < divArray.length; j++)
		
	//iterate through our span tags within the ContentDivContainer
	for (var i = 0; i < spanArray.length;i++) {
		//only reset our spans with "excol" in them (these are our expand/collapse image span tags)
		if (spanArray[i].id.indexOf('excol') != -1) {			
			spanArray[i].className = "expand";
		} //if (spanArray[i].id.indexOf('excol') != -1)
	} //for (var i = 0; i < spanArray.length;i++)	
} //function resetExColImg(parentDivID)
<!-- End Product Page Functions -->

<!-- Begin Search Functions -->
function searchFocus(searchBox){
	if (searchBox.value == 'Quick Search'){
		searchBox.value = '';
	}
	searchBox.className = 'input';
}
<!-- End Search Functions -->

//get specified url parameter
function gup(name) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
	var regexS = "[\\?&]"+name+"=([^&#]*)";  
	var regex = new RegExp( regexS );  
	var results = regex.exec( window.location.href );  
	
	if (results == null) {
		return "";  
	} else {
		return results[1];
	}//if (results == null)
}//function gup(name)

//-- Begin Elements De-Facto Configurator Functions --//
function activateAll(parentDivID) {
	var cDivArray = $(parentDivID).immediateDescendants();
	
	//hide our other items
	for (i = 0; i < cDivArray.length; i++) {					
		//these have sub-sections, so we need to get those children as well
		if (cDivArray[i].id == 'method' || cDivArray[i].id == 'length') {
			sCDivArray = $(cDivArray[i].id).immediateDescendants();			
			for (f = 0; f < sCDivArray.length; f++) {
				if (sCDivArray[f].id != '' && sCDivArray[f].readAttribute('href') == 'javascript:;') {			
					//set className
					sCDivArray[f].className = "activeSelection";			
					
					//activate our selection
					sCDivArray[f].setStyle({opacity: 1.0});
				}//if (sCDivArray[f].id != '')							
			}//for (f = 0; f < sCDivArray.length; f++)
		} else {
			if (cDivArray[i].id != '' && cDivArray[i].readAttribute('href') == 'javascript:;') {			
				//set className
				cDivArray[i].className = "activeSelection";			
				
				//activate our selection
				cDivArray[i].setStyle({opacity: 1.0});
			}//if (cDivArray[i].id != '')			
		}//if (cDivArray[i].id == 'method' || cDivArray[i].id == 'length')	
	}//for (i = 0; i < cDivArray.length; i++)
}//function activateAll(parentDivID)

function applySelection(parentDivID,userSelectedID) {		
	var parentDivArray = $(parentDivID).immediateDescendants()
	
	//hide our other items
	for (i = 0; i < parentDivArray.length; i++) {	
		if (parentDivArray[i].id != "" && parentDivArray[i].id != userSelectedID) {			
			//we need to ensure our element has 'layout' for friggin' internet exploiter
			//see the following on setting opacity for elements, remarks section --> (http://msdn2.microsoft.com/en-us/library/ms532967.aspx)		
			if (parentDivID == "length" && BrowserDetect.browser == "Explorer") {
				parentDivArray[i].setStyle({height: '1%'});				
			}//if (parentDivID == "length")
			
			//de-activate this item
			parentDivArray[i].setStyle({opacity: 0.2});								
			
			//set className
			parentDivArray[i].className = "";									
		}//if (parentDivArray[i].id != userSelectedID)
	}//for (i = 0; i < parentDivArray.length; i++)
	
	//activate our selection
	$(userSelectedID).setStyle({opacity: 1.0});
		
	//set className
	$(userSelectedID).className = "activeSelection";
}//function applySelection(parentDivID,userSelectedID)

function preActivateSelection(userSelectedID) {
	//only activate if the className is not "activeSelection"
	if ($(userSelectedID).className != 'activeSelection') {
		$(userSelectedID).setStyle({opacity: 1.0});
	}//if ($(userSelectedID).className != 'activeSelection')
}//function preActivateSelection(userSelectedID)

function deActivateSelection(userSelectedID) {
	//only deactivate if the className is not "activeSelection"
	if ($(userSelectedID).className != 'activeSelection') {
		$(userSelectedID).setStyle({opacity: 0.2});		
		$(userSelectedID).className = "";
	}//if ($(userSelectedID).className != 'activeSelection')	
}//function deActivateSelection(userSelectedID)

//-- End Elements De-Facto Configurator Functions (http://www.alistapart.com/articles/alternate/) --//

//-- Begin File Download Disclaimer Functions --//

function showHideTerms(mode) {
	mode = typeof(mode) != 'undefined' ? mode : 'hide';	
	
	if (mode == 'show') {
		if ($('terms-agreement').getStyle('display') == 'none') {
			$('terms-agreement').show();
		}//if ($('terms-agreement').getStyle('display') == 'none')
	} else {
		$('terms-agreement').hide();
	}//if (mode == 'show')
}//function showHideTerms(mode)

function validateAgreement() {
	if (!($('agreement').checked)) {
		alert('You must agree to the terms of use agreement in order to download this file.');
		return false;

	} else {
		return true;
	}//if (!($('agreement').checked))
}//function validateAgreement()

//-- End File Download Disclaimer Functions --//

//-- Begin Miscellaneous Functions --//

function explodeArray(item,delimiter) {
  var tempArray=new Array(1);
  var Count=0;
  var tempString=new String(item);

  while (tempString.indexOf(delimiter)>0) {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
    tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
    Count=Count+1
  }//while (tempString.indexOf(delimiter)>0)

  tempArray[Count]=tempString;
  return tempArray;
}//function explodeArray(item,delimiter)

function IsNumeric(sText) {
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
   
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
	}		
	return IsNumber;
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
} 

//used by products/index.php
function openDiv(pid, total){
	accessCSS(pid).display = 'block';
	for (i=1; i <= total; i++){
		if ('d' + i != pid)
			accessCSS('d' + i).display = 'none';
	}
}

function breadCrumbs(text){
	if ($('bread-crumbs')) { //ensure we have a valid object
		$('bread-crumbs').innerHTML = '<b>' + text + '</b>';
	}
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
//-- End Miscellaneous Functions --//

BrowserDetect.init();

//-- Functions copied from our initial core forms --//
/******* Begin Form Validation Routines *******/

function validate_form(the_form) {	
	var str = '', form_action = '', field_hash = new Hash();
	the_form = $(the_form);

	//default, all fields are required
	for (i = 0; i < the_form.length; i++) {
		//set our form action
		if (the_form[i].id == 'form_action') {form_action = the_form[i].value;}
		if (the_form[i].id != '' && the_form[i].type != 'hidden') {
			if (the_form[i].type == 'select-one') {
				if (Element.readAttribute(the_form[i], 'required') == 'required' && !the_form[i].selectedIndex > 0) {
					alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' is required.');
					the_form[i].focus();
					return false;
				}
			} else if (the_form[i].type == 'radio' || the_form[i].type == 'checkbox' && Element.readAttribute(the_form[i], 'required') == 'required') {
				var radio_group = the_form[i].name;	 
				var checked = the_form.getInputs('radio', radio_group).find(
					function(rb) {return rb.checked;}
				);				
				if (!checked) {
					alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' is required.');
					the_form[i].focus();
					return false;
				}
			} else {
				if (Element.readAttribute(the_form[i], 'required') == 'required') {
					switch (Element.readAttribute(the_form[i], 'datatype')) {
						case 'integer':
							if (the_form[i].value.strip() == '' || !is_integer($F(the_form[i].value))) {
								alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' must be an integer value.');
								the_form[i].focus();
								return false;
							}						
							break;
						case 'float':
							if (the_form[i].value.strip() == '' || !is_float($F(the_form[i].value))) {
								alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' must be a float value.');
								the_form[i].focus();
								return false;
							}
							break;
						case 'currency':
							if (the_form[i].value.strip() == '' || !is_currency($F(the_form[i].value))) {
								alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' must be a currency value.');
								the_form[i].focus();
								return false;
							}	
							break;
						case 'email':
							if (the_form[i].value.strip() == '' || !is_email($F(the_form[i].id))) {
								alert('Please enter a valid email address for ' + ($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + '.');
								the_form[i].focus();
								return false;
							}						
							break;
						case 'date':
							if (the_form[i].value.strip() == '' || !is_date($F(the_form[i].value))) {
								alert('Please enter a valid date for ' + ($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' in the format (mm/dd/yyy).');
								the_form[i].focus();
								return false;
							}						
							break;
						case 'zip_code':
							if (the_form[i].value.strip() == '' || !is_postalcode($F(the_form[i].id))) {
								alert('Please enter a valid postal code for ' + ($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + '.');
								the_form[i].focus();
								return false;
							}
							break;
						case 'phone':
							if (the_form[i].value.strip() == '' || !is_phone($F(the_form[i].id))) {
								alert('Please enter a valid phone number for ' + ($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + '.');
								the_form[i].focus();
								return false;
							}
							break;
						case 'string':
						default:
							if (the_form[i].value.strip() == '' || !is_string($F(the_form[i].id))) {
								alert(($('lbl_' + the_form[i].id) ? $('lbl_' + the_form[i].id).innerHTML : the_form[i].id) + ' is required.');
								the_form[i].focus();
								return false;
							}						
							break;
					}//switch (Element.readAttribute(the_form[i], 'datatype'))
				}//if (Element.readAttribute(the_form[i], 'required') == 'required')
			}//if (the_form[i].type == 'select-one')
		}//if (the_form[i].id != '' && the_form[i].type != 'hidden')

		if (the_form[i].id != '' && the_form[i].type != 'reset' && the_form[i].type != 'submit') {
			var field_object = new Object;		
			field_object.id = the_form[i].id;
			field_object.label = ($('lbl_' + the_form[i].id) ? escape($('lbl_' + the_form[i].id).innerHTML) : '');
			field_object.value = escape(the_form[i].value);			
			field_object.required = Element.readAttribute(the_form[i], 'required');
			field_object.datatype = Element.readAttribute(the_form[i], 'datatype');			
			field_object.type = the_form[i].type;
			field_hash.set(field_object.id, field_object);
		}
	}//for (i = 0; i < the_form.length; i++)

	new Ajax.Request('../../includes/form_processor.php?' + bogusQueryStringParam(), {
		method: 'post',
		parameters: { fnc: 'process_form_submission', data: Object.toJSON(field_hash)},
		onCreate: function() {showLoader('aspb-loader');},
		onComplete: function(response) {
			if (response.responseText != 1) {
				alert(response.responseText);
			} else {
				$('form-results').innerHTML = '<p>Thank you for your questions/comments.<br/>You will receive a reply from our respective department very soon.</p>';
				$('form-contents-div').hide();
			}
			hideLoader('aspb-loader');
		}
	});

	return false;
}

function is_string(mixed_var) {
    return (typeof(mixed_var) == 'string');
}

function is_integer(mixed_var) {
	var regex = /^[-+]?[1-9]\d*$/;
	return (regex.test(mixed_var) ? true : false);
}

function is_float(mixed_var) {
	var regex = /^[-+]?\d*\.?\d*$/;
	return (regex.text(mixed_var) ? true : false);
}

function is_currency(mixed_var) {
	var regex =/^\$?(\d{1,3},?(\d{3},?)*\d{3}(\.\d{0,2})?|\d{1,3}(\.\d{0,2})?|\.\d{1,2}?)$/;
	return (regex.test(mixed_var) ? true : false);
}

function is_email(mixed_var) {
	var regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	return (regex.test(mixed_var) ? true : false);
}

function is_date(mixed_var) {
	var regex=/^\d{1,2}\/\d{1,2}\/\d{4}$/;
	return (regex.test(mixed_var) ? true : false);
}

function is_postalcode(mixed_var) {
	var regex=/^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z] \d[A-Z]\d$/;
	return (regex.test(mixed_var) ? true : false);
}

function is_phone(mixed_var) {
	var regex=/^([a-zA-Z,#\/ \.\(\)\-\+\*]*[0-9]){7}[0-9a-zA-Z,#\/ \.\(\)\-\+\*]*$/;
	return (regex.test(mixed_var) ? true : false);
}

/******* End Form Validation Routines *******/