/* Author:


*/

function initMenu() {
  // Hide the sub menu items first
  $("ul#menu > li > ul").hide();

  // On click
  $('ul#menu > li > a').click(function() {
      if($('ul', $(this).parent()).children().length) {
          $('ul', $(this).parent()).slideToggle("normal");
          return false;
      } else {
          return true;
      }
  });
  $('ul#menu > li').click(function(e) {
      // If there are sub items toggle them & prevent default click action
      if ($(e.target).is("li")) {
          // or (e.target == this) if you don't want child li's to toggle
          $('ul', this).slideToggle("normal");
          return false;
      } else {
          return true;
      }

  });
}



$(document).ready( function(){
  
	//cache nav  
	var nav = $("#topNav");  

	//add indicators and hovers to submenu parents  
	nav.find("li").each(function() {  
		if ($(this).find("ul").length > 0) {  

			//show subnav on hover  
			$(this).mouseenter(function() {  
				$(this).find("ul").stop(true, true).slideDown(305);  
			});  

			//hide submenus on exit  
			$(this).mouseleave(function() {  
				$(this).find("ul").stop(true, true).slideUp(305);  
			});  
		}  
	});
	
	$('#slider').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed: 500, // Slide transition speed
        pauseTime: 3000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: false, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
	
	
	//initMenu();
   
   //scroll testimonial
   if($('#testimonials_slide')){
     $('#testimonials_slide').cycle({
            cleartype:  1 ,
            timeout:  6000,
            speed: 900,
            fx: 'scrollLeft'
    });
   }   
});  

