jQuery(document).ready(function() {
	// drop down navigation
	jQuery('.drop-down-trigger').click(function() {
	var navElement = jQuery(this).parent().parent();
	navElement.toggleClass('active');
	navElement.hover(
		function(){},
		function(){
		jQuery(this).removeClass('active');
	});
	 return false;
	});
	
	jQuery('li.with-submenu > a').click(function(){
	if (jQuery(this).attr("href") == "#"){
		var navElement = jQuery(this).parent().find('.drop-down-trigger').click();       
	}
	});
	
	// make adverts clickable
	jQuery('.advert').click(function(event){ 
     	window.location=jQuery(this).find("a").attr("href");
     	return false;
     });
	
	// Marketo Buttons
	jQuery("#mktFrmSubmit").addClass("btn");
	
	// validate forms
	jQuery("form#white-papers-gateway").validate();
	jQuery("form#contactform").validate();
	jQuery("form#footerform").validate();
	
	// modal windows
	jQuery("a.zoom").fancybox();
	
	// wrap ampersands
    jQuery("*:contains('&')", document.body)
        .contents()
        .each(function() {
			if( this.nodeType == 3 ) {
				jQuery(this).replaceWith( this.nodeValue.replace( /&/g, '<span class="ampersand">&amp;</span>' ));
			};
		});
	
	// was docs.js file
	jQuery('#index-dialog-toggle').click(function(){
		jQuery('#index-dialog').toggle();
		return false;
	});
});


// was docs.js file
jQuery(function() {
    jQuery('.open-feedback').click(jQuery('#fdbk_tab'));
});
