﻿// This function is called on each page to make the CSS dropdown menus work in IE6
showPrimaryNavList = function() {								
	if (document.all&&document.getElementById) {
									
		navRoot = document.getElementById("DropDownList");
						
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
							
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}				
		}					
	}
}


// This function is used to toggle the visibility of divs when a link is clicked (e.g. for the quote images);
function showElement(theElement, theLink) {
    var elementHolder = document.getElementById("hiddenElements").getElementsByTagName("DIV");
    var activeLink = document.getElementById("elementLinks").getElementsByTagName("A");  
    
		for (var i=0; i<elementHolder.length; i++) {
			if (i !=theElement){
				elementHolder[i].className="contentHidden";
			}
	    }
	    
	    for (var k=0; k<activeLink.length; k++) {
			if (k !=theLink){
				activeLink[k].className="";
				
			}
	    }
	   
		elementHolder[theElement].className="contentVisible";	
		activeLink[theLink].className = "active";
}


// This function works the same as showElement, except is cycles through a second div on a page
//(e.g. on "How TradeCard Helps Service Providers" to toggle the blurbs under the heading: "What Service Do You Provide?"
function showElement2(theElement) {
    var elementHolder = document.getElementById("hiddenElements2").getElementsByTagName("DIV");  
    
		for (var i=0; i<elementHolder.length; i++) {
			if (i !=theElement){
				elementHolder[i].className="contentHidden";
			}
	    }
	    
	    elementHolder[theElement].className="contentVisible";	
		
}

//This function is used for the logo rollover effects on the Case Studies page under "What We Do" 
function changeImage(imageName,newImageSource) {
	if (document.images) {
		document.images[imageName].src = newImageSource;
	}
}

//This function clears the search box when a user clicks in it
function ClearInput(value, id){ // This calls our function ClearInput, and the two variables we will need for it to function the original value and the id.
var input = document.getElementById('SearchBox'); // Gets the input field based on its id.

	if(value == input.value){ // If the default value is equal to the current value.
		input.value = ''; // Empty It.
	}else{ // Else the value is not equal to the current input field value.
		input.value = input.value; // Leave it the same.
	}
}

// Called when the "TradeCard in 90 seconds" button is clicked to unhide the div containing the video and play the flash
function showVideo() {
	// Show the div holding the Sizzle Reel
    var unhide;
	unhide = document.getElementById("VideoHolder");
    unhide.className = 'VideoHolder';
   
	var so = new SWFObject("http://209.242.151.8/tradecard/sizzle.swf", "TradeCard", "575", "462", "6", "Transparent");
	so.addParam("menu", "false");
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
   	so.write("SizzleReelPlayer"); 
   
}

// Called when the "Close" button is clicked in the video holder to hide it
function hideVideo() {
	// Hide the div holding the Sizzle Reel
    var hide;
	hide = document.getElementById("VideoHolder");
    hide.className = 'contentHidden';
}