function accordian() {

	var togglers = $('.faqlist li h2');
	var elements = ".faqlist li div";

	$(elements).hide();
	togglers.click(
	function() {
		var checkElement = $(this).next();
			if((checkElement.is(elements)) && (checkElement.is(':visible'))) {
			$(this).parent('li').removeClass('active');
			$(elements + ':visible').slideUp(500);
			return false;
		}
		if((checkElement.is(elements)) && (!checkElement.is(':visible'))) {
			$(elements + ':visible').slideUp(500);
			$(this).parent('li').addClass('active');
			checkElement.slideDown(500);
			return false;
		}
	});
	
}

function dropDown() {
	
	$("#nav > li").hover(function() {
		$(this).addClass('active');
	},
	function () {
		$(this).removeClass('active');
		}
	);
	
	$(".exhibitorList div").remove();
	$(".register div").remove();
}

function smoothScroll() {
	$('.scroll').click(function() {
	  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	  && location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target
		|| $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
		  var targetOffset = $target.offset().top;
		  $('html,body')
		  .animate({scrollTop: targetOffset}, 1000);
		 return false;
		}
	  }
	});
}

$(document).ready(function(){
						   
	Shadowbox.init({ overlayOpacity: 0.7 });
	dropDown();
	smoothScroll();
	accordian();	

	//Exhibitors List
	$("#exhibitorsList").carousel({
		autoSlide: true,
		loop: true,
		autoSlide: true,
		autoSlideInterval: 1200,
		delayAutoSlide: 1000
	});
	
	//Zebra
	$("tr:even:not(:first-child)").addClass("even");
	
	//Highlight first cells on each row
	$("tr td:first-child").addClass("name");
	
	//Highlight each row on hover
	$("tr").hover(function() { $(this).addClass("hover"); }, function() { $(this).removeClass("hover");});
		
	// Opens links in new window
	$("a[rel*='external']").attr({ target: "_blank" });
	
	//Removes value from input on click if it is same as title	
	var volatile = $(".newsletterPod input[type='text']");
	    volatile.focus(function(){
        if ($(this).val() == $(this).attr("title") ){        
            $(this).val("");
        }}, volatile.blur(function(){
            if ($(this).val() == "" ){        
                $(this).val($(this).attr("title"));
            }
        }
    ));

	//Register Flash
	$('#register').flash({
		src: '/_images/flash/register-now.swf',
		wmode: 'transparent',
		width: 225,
		height: 50
	});

	// Countdown
	$('#countDown').flash({
		src: '/_images/flash/countdown.swf',
		wmode: 'transparent',
		width: 225,
		height: 100
	});
	// gallery
	$('#flashBanner').flash({
		src: '/_images/flash/homepage-images.swf',
		wmode: 'transparent',
		width: 464,
		height: 234
	});
	
	$('#overlay a').click(function(e){
		e.preventDefault();
		$('#overlay').fadeOut('normal');						   
	});

});
