/*
Copyright (c) 2010 Pascal Hagen - http://www.thinkcbyer.com

*/
jQuery(document).ready(function(){	
	jQuery("#slider").easySlider({
		auto: true,
		continuous: true,
		controlsFade:true,
		pause: 4000,
		numeric: true
	});
	closetimer = 0;

	if(jQuery("#nav")) {

		jQuery("#nav li div").each(function(i) {
		eheight = jQuery(this).height();
		jQuery(this).children().css("top",-eheight+"px");
		});

		jQuery("#nav li.nosub").mouseover(function() {
			eheight = jQuery("#nav strong.clicked").next().children().height()+20;
			jQuery("#nav strong.clicked").next().children().animate({"top":-eheight+"px"}, {queue:false,duration:(300)});
			jQuery("#nav strong.clicked").next().slideUp(500);
			jQuery("#nav b").removeClass("clicked");
		});

		jQuery("#nav strong").mouseover(function() {
		clearTimeout(closetimer);
			if(this.className.indexOf("clicked") != -1) {
				eheight = jQuery(this).next().children().height()+20;
				jQuery(this).next().children().animate({"top": -eheight+"px"}, {queue:false,duration:(300)}, "swing");
				jQuery(this).next().slideUp(500);
				jQuery(this).removeClass("clicked");
			}
			else {
				eheight = jQuery("#nav strong.clicked").next().children().height()+20;
				jQuery("#nav strong.clicked").next().children().animate({"top": -eheight+"px"}, {queue:false,duration:(300)}, "swing");
				jQuery("#nav strong.clicked").next().slideUp(500);
				jQuery("#nav strong").removeClass();
				jQuery(this).addClass("clicked");
				jQuery(this).next().slideDown(100);
				eheight = jQuery("#nav strong.clicked").next().children().height();
				jQuery(this).next().children().animate({"top":"0px"}, {queue:false,duration:(300)}, "swing");
			}
		});
		jQuery("#nav").mouseover(function() {
		clearTimeout(closetimer);
		});
		jQuery("#nav").mouseout(function() {
			closetimer = window.setTimeout(function(){
			eheight = jQuery("#nav strong.clicked").next().children().height()+20;
			jQuery("#nav strong.clicked").next().children().animate({"top":-eheight+"px"}, {queue:false,duration:(300)}, "swing");
			jQuery("#nav strong.clicked").next().slideUp(500);
			jQuery("#nav b").removeClass("clicked");
			}, 2000);
		}); 
	}

	jQuery('ul#faqList').simpleFAQ({
	  data: null,
	  allowSearch: true,
	  searchNode: '#faqSearch',
	  minSearchScore: 0.5
})
	jQuery('#simpleFAQSearch').keyup(function(jQEvent, results) {
	  // If the user has no search query, show all results
	  if (this.value.length < 1) {
		jQuery('ul#faqList li').show();
	  }
});
	jQuery('ul#faqList li').show();
	jQuery('.more-views a').lightBox(); // Select all links that contains gallery in the attribute rel
	
});



