//  Sub Menu

$(function() {

	var config = {
		over: function() { $(this).children('ul').stop(true, true).slideDown("slow"); },
		timeout: 300,
		out: function() { $(this).children('ul').stop(true, true).slideUp("fast"); },
	}
	$("#nav li").hoverIntent( config );

	/*$("#nav ul li").hoverIntent(function() {
		$(this).find("ul").slideDown();
	}, function() {
		$(this).find("ul").slideUp();
	});*/
	
});

// Footer Services Menu add span

$(function() {

	$("#services li a").wrapInner("<span />");

});

// Footer Remove Border from last list item

$(function() {

	$(".industries ul li a:last").css("border","none");
	$(".development ul li a:last").css("border","none");
	
});

// Selectbox

$(function() {

	$('#footer .products select').selectbox();
	$('#sidebar .menu select').selectbox();
	
});

// Home Page Slider

$(function() {
	
	$('#tabs li').featureList({
		output			:	'#output li',
		start_item		:	0
	});

});

// Current Product Page

$(function() {

	$cpp = $("#curpp").text();
	
	$(".menu li.post-" + $cpp).addClass("current_page_item");

});


// Remove Current Page from news

$(function() {

	if ($("body").hasClass("single-products")) {	// single-products is the name of my template page for the custom post type
		$("li.page-item-19").removeClass("current_page_parent");	// Removes the class current_page_parent from the <li> with the page-id of the Blog (News)
		$("li.page-item-11").addClass("current_page_parent");	// Adds the class current_page_parent to the <li> with the page-id of the Products page
	}

});


// Products Dropdowns 

$(function() {

	$("#search-industry li").click(function() {
	
		$id = $(this).attr("id");
		$value = $id.replace("_input_","");
		
		$("#sidebar .menu .sub-products").hide();
		$("." + $value).show();
	
	})

});


// Products 

$(function() {
	
	var products = $('.products-list li').length;
	var col_count = Math.floor(products/2);
	
	$('.products-list ul').after('<ul>');
	
	var count = 0;
	while (col_count > count) {
		$('.products-list ul:first li:last').prependTo('.products-list ul:last');	
		count++;
	}
	
})

$(function() {

	$('.products-list h3').next('div').hide();
	$('.products-list h3').click(function() {
	
		if ( $(this).next('div').is(':visible') ) {
			$('.products-list h3').removeClass('current');
			$('.products-list h3').next('div').hide();
		
		} else { 
			$('.products-list h3').removeClass('current');
			$('.products-list h3').next('div').hide();
			$(this).next('div').show();
			$(this).addClass('current');
		}
	});

})

// FAQ

$(function() {
	$('.faq dd').hide();
	$('.faq dt').click(function() {
		if ( $(this).next('dd').is(':visible') ) {
			$(this).next('dd').slideUp();
		} else {
			$('.faq dd').slideUp();
			$(this).next('dd').slideDown();
		}
	});
})

// Colorbox
$(function() {
	$(".table-a").colorbox({width: "50%", inline:true, href:"#table-a"});
	$(".table-b").colorbox({width: "50%", inline:true, href:"#table-b"});
	$(".table-c").colorbox({width: "50%", inline:true, href:"#table-c"});
	$(".table-d").colorbox({width: "50%", inline:true, href:"#table-d"});
	$(".table-e").colorbox({width: "50%", inline:true, href:"#table-e"});
})



