<!-- 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=8;
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() {
	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("Preferred 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('div', 'td', 'tr', 'table');
		    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('div', 'td', 'tr', 'table');
   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(s!=max) {
         s += 1;
      }

	  //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")
	  
   }
   
   //return our variable for storing the selected font-size   
   return s;
}//function increaseFontSize()

function decreaseFontSize() {
   var p = document.getElementsByTagName('div', 'td', 'tr', 'table');
   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(s!=min) {
         s -= 1;
      }
	  //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")
	  
   }   
   
  //return our variable for storing the selected font-size   
  return s;
}//function decreaseFontSize()

//test function to toggle menu
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('toolbar-contain')) {document.getElementById('toolbar-contain').style.width = "798px";}
		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.padding = "10px";}
		//if (document.getElementById('right-pane')){document.getElementById('right-pane').style.width = "980px";}
		if (document.getElementById('files-container')){ document.getElementById('files-container').style.width = "593px";}
		
		//adjust our map details and google maps div back to original width
		if ($('map') && $('mapDetails')) {
			if ($('map')) {$('map').setStyle({width: '345px'});}
			if ($('mapDetails')) {$('mapDetails').setStyle({width: '425px'});}
		}//if ($('map') ||$('mapDetails'))	
	} else if (mode == 1) {
		if(document.getElementById('toolbar-contain')) {document.getElementById('toolbar-contain').style.width = "100%";}
		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.padding = "10px 10px 10px 210px";}
		//if (document.getElementById('right-pane')){document.getElementById('right-pane').style.width = "780px";}
		if (document.getElementById('files-container')){ document.getElementById('files-container').style.width = "350px";}
		
		//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: '275px'});}
			if ($('mapDetails')) {$('mapDetails').setStyle({width: '300px'});}
		}//if ($('map') ||$('mapDetails'))	
	}//if (mode == 0)
	
	//only update our cookie when specified
	if (save) {
		//update our cookie
		saveProductBrowsePreference(mode);	
	} //if (save)
}

//test 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); 	
}

//test 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 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) {
	if ($(divRef)) {
		//get our nav and div elements for setting current item visibility, etc.
		var navContainerArray = $('products-nav').getElementsByTagName('a');
		var divContainerArray = $('files-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].className != 'highslide-html-content') {
				divContainerArray[i].style.display = "none";
			}//if (divContainerArray[i].id != '')
		}//for (i = 0; i < divContainerArray.length; i++)
		
		//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++)
	
	//set our active tab
	$(tab+'Tab').className = "active";	
	//show our content for this tab
	showContent(tab);	
} //function setActiveTab(tab)

function showContent(div) {
	var productContentArray = $('product-content').immediateDescendants();
	
	//hide all our other divs
	for (var i = 0; i < productContentArray.length;i++) {	
		if (!(productContentArray[i].className == 'clear')) {
			productContentArray[i].style.display = "none";		
		}//if (!(contentDivContainerArray[i].className == 'clear'))
	} //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 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) {	
	if (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++)				
	}//if (parentDivID)	
} //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)

function breadCrumbs(text){
	if ($('bread-crumbs')) { //ensure we have a valid object
		$('bread-crumbs').innerHTML = '<b>' + text + '</b>';
	}
}