$(function(){
	$('html').removeClass('no-js').addClass('js');
    
    /*
    var our_clients_height = $('#home-our-clients ul').height();
    var latest_news_height = $('#home-latest-news-slider').height();
    
    if (our_clients_height && latest_news_height)
    {
        if (our_clients_height > latest_news_height)
        {
            $("#home-latest-news-slider").height(our_clients_height);
        }
        else
        {
            $("#home-our-clients ul").height(latest_news_height);
        }
    }
    */
    
	$('#featurebanner').append('<div class="cycle-nav"></div>').cycle({
		fx: 'scrollHorz',
		slideExpr: '.slide',
		timeout: 5000,
		speed: 1000,
		pause: 1,
		pager: '#featurebanner .cycle-nav',
        pagerAnchorBuilder: function(index, DOMElement)
        {
            return '<a href="#"><span>' + index + '</span></a>';
        }
	});
    
	$('#home-latest-news-slider').after('<div class="cycle-nav"></div>').cycle({
		fx: 'scrollVertUp',
		slideExpr: 'article',
		timeout: 0,
		speed: 1000,
		pause: 1,
		pager: '#home-latest-news .cycle-nav',
        pagerAnchorBuilder: function(index, DOMElement)
        {
            return '<a href="#"><span>' + index + '</span></a>';
        }
	});
    
	$('#home-our-clients ul').after('<div class="cycle-nav"></div>').cycle({
		fx: 'fade',
		slideExpr: 'li',
		timeout: 3000,
		speed: 1000,
		pause: 1,
		pager: '#home-our-clients .cycle-nav',
        pagerAnchorBuilder: function(index, DOMElement)
        {
            return '<a href="#"><span>' + index + '</span></a>';
        }
	});
    
    $("#content hr").replaceWith('<div class="hr"></div>');
    
    $('#left nav li.active').parent('ul').show().addClass('no-collapse');
    $('#left nav li.active ul:first').addClass('no-collapse');
    
    $('#left nav ul li').mouseenter(function() {
        $('ul', this).stop(true,true).slideDown(500);
    }).mouseleave(function() {
        $('ul:not(ul.no-collapse)', this).stop().slideUp(500, function() {
            $(this).height('auto');
        });
    });
    
    $("#solution-tabs li:eq(0), #solution-tabs li:eq(4)").css({
        'marginLeft': 0
    });
    
});

$.fn.cycle.transitions.scrollVertUp = function($cont, $slides, opts) {
        $cont.css('overflow','hidden');
        opts.before.push(function(curr, next, opts, fwd) {
                $.fn.cycle.commonReset(curr,next,opts);
                opts.cssBefore.top = fwd ? (next.cycleH-1) : (1-next.cycleH);
                opts.animOut.top = fwd ? -curr.cycleH : curr.cycleH;
        });
        opts.cssFirst = { top: 0 };
        opts.cssBefore= { left: 0 };
        opts.animIn   = { top: 0 };
        opts.animOut  = { left: 0 };
};

