/* StartList is used for IE6 Dropdown menus */

	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("nav_main");
			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", "");
					}
				}
			}
		}
	}
	window.onload=startList;

/* JQuery Calls */	
			
		/* Set up Slides */
		
		$(function(){
				   
			/* Jquery Image Zoom Plugin - Apply to any product image */
			$(".zoom_image").imageZoom();

			$('#slider1').anythingSlider({
				hashTags        : false, // Should links change the hashtag in the URL
				pauseOnHover    : false,      // If true & the slideshow is active, the slideshow will pause on hover
				delay           : 13000,  // How long between slideshow transitions in AutoPlay mode (in milliseconds)
  				animationTime   : 250,   // How long the slideshow transition takes (in milliseconds)
				onSlideComplete : function(slider){
					// alert('Welcome to Slide #' + slider.currentPage);
				}
			});
	
	
		$("#expand_nav").click(function () {
			$("#nav_main ul").toggle('slow');
			
			if($("#expand_nav a").text() == "Site Navigation [+]")
			{
				$("#expand_nav a").text("Hide Navigation [-]");
			}
			else
			{
				$("#expand_nav a").text("Site Navigation [+]");
			}
			
			return false;
		});
		
		$("#expand_cat").click(function () {
			$("#left_cat ul").toggle('slow');
			
			if($("#expand_cat a").text() == "+")
			{
				$("#expand_cat a").text("-");
			}
			else
			{
				$("#expand_cat a").text("+");
			}
			
			return false;
		});
	
	
			   
	// Adds a little something extra to dropdowns	
	function mainmenu(){		
		$(" #nav_main li").hover(function(){
				$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(350);
         		},function(){
				$(this).find('ul:first').fadeOut(300);
				});
		}		
		 $(document).ready(function(){
			mainmenu();	
	
		
	// Removes backround image from last item in breadcrumb trail
		$("#breadcrumb li:last").addClass("last");
	
	// Pushes first right nav item up
		$("#right_sect div:first-child[class=right_info]").css("margin-top", "-10px");
	
	// Removes margin on last item of related products section - applications
		$("#left_sect div:nth-child(3n+1)[class=app_rel_sect]").css("margin-right", "0");
	
	// Table elements
		$("table.detail_specs tr:nth-child(2n)").addClass("alt_highlight2");
		$("table.results_reps.catalog tr:odd").addClass("alt_highlight2");        
		$("table#resources tr:odd").addClass("alt_highlight2");
        	
		
		
	// Evens out footer sections
		$("#footer_top div:nth-child(2)[class=footer_section omega]").css("width", "195px");
		$("#footer_top div:last[class=footer_section omega]").css("margin-right", "0px");
		
	// Reveals the title of related products	
		
  		$("span.title").hover(
			function(){
        $(this).fadeTo('slow',0.2);
    },
    function(){
        $(this).fadeTo('slow', 1.0);
    });
					
	
	// Adds bottom-border to the second <h4> on left nav of product browse page		
		$("#left_cat h4").css("padding-top", "6px");
		$("#left_cat h4:first").css("border", "0");
		$("#left_cat ul:last").css("border", "0");			
	});
			
			/* Call StartList function when window loaded */
			startList();
	});	
	
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor			
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p class='tooltip_info'>"+ this.t +"</p>");
		$(".tooltip_info")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(700);		
    },
	function(){
		this.title = this.t;		
		$(".tooltip_info").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$(".tooltip_info")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

