
$(document).ready(function(){
	
	$('#corp_mainNav li.two').hover(function(){
		$(this).children('a').addClass('aboutHover').next('ul').show();
	}, function(){
		$(this).children('a').removeClass('aboutHover').next('ul').hide();
	}); 
	
	$('#corp_mainNav li.three').hover(function(){
		$(this).children('a').addClass('servicesHover').next('ul').show();
	}, function(){
		$(this).children('a').removeClass('servicesHover').next('ul').hide();
	}); 
	
	$('#corp_mainNav li.four').hover(function(){
		$(this).children('a').addClass('showroomHover').next('ul').show();
	}, function(){
		$(this).children('a').removeClass('showroomHover').next('ul').hide();
	});



	
	$('.slideshow').each(function(){
		var $this = $(this);
		$this.cycle({
			fx:      'scrollHorz',
			timeout:  0,
			prev:    $this.next().children('.prev'),
			next:    $this.next().children('.next'),
			pager:   $this.next().children('.nav'),
			nowrap: 1,
			pagerAnchorBuilder: pagerFactory,
			before:  function(currSlideElement, nextSlideElement, options, forwardFlag)  {
				if ($(nextSlideElement).index() == $(nextSlideElement).parent().children().length - 1) {
					$('.next').addClass('disable');
				} else {
					$('.next').removeClass('disable');
				}
				
				if ($(nextSlideElement).index() == 0) {
					$('.prev').addClass('disable');
				} else {
					$('.prev').removeClass('disable');
				}        	
				
			}
		});	
	});
	
	

	function pagerFactory(idx, slide) {
			var s = idx > 1 ? ' style="display:none"' : '';
			return '<span'+s+'>'+(idx+1) +' of 2'+'</span>';
	};
	
	
});
