

var sudoSlider;

$(document).ready(function(){

// Sub Navigation

var subNavHeight = 0; 	
	$('#navigation > li').each(function(){
		$(this).find('ul').wrap('<div class="subMenu" />');
		$(this).find('.subMenu').attr('rel', $(this).find('ul').height()+ parseInt($(this).find('ul').css('paddingBottom'))+ parseInt($(this).find('ul').css('paddingTop')));
	});
	$('#navigation > li').hover(function(){
			$(this).find('.subMenu').css('height', '0px');
			$(this).find('.subMenu').css('display', 'block');
			$(this).find('ul').css('display', 'block');
			$(this).find('.subMenu').stop().animate({height: $(this).find('.subMenu').attr('rel')}, 400);
	},function(){
			$(this).find('.subMenu').stop().animate({height: 0}, 400, function(){
				  $(this).css('display', 'none');
				});
		});

// Last and first childs 

	$("#navigation li:last").addClass('lastItem');
	$(".prof-services-list li:last").addClass('lastItem');
	$(".content-block.partners:last").addClass('lastItem');

	
// Slider
	sudoSlider = $("#slider").sudoSlider({
		speed: '1000',
		auto:true,
		pause: '4100',
		fade: true,
		prevNext:false,
		numeric:false
	});  
	
// Clears search input
	$('.search-input').clearField("search");
	$('.clear-name').clearField("NAME");
	$('.clear-address').clearField("ADDRESS");
	$('.clear-email').clearField("E-MAIL");
	$('.clear-message').clearField("MESSAGE");
	


// Adds class to even elements
	$('.q-list ul li:even').addClass('even');
	
	

})





$(window).load(function() {

// Vertical centering
	$.fn.vendorsAlign = function() {
	return this.each(function(i){
	var ah = $(this).children().height();
	var ph = $(this).parent().parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('padding-top', mh);
	});
};

$('.moveElement').vendorsAlign();

	$.fn.vAlign = function() {
	return this.each(function(i){
	var zh = $(this).height();
	var xh = $(this).parent().height();
	var ch = (xh - zh) / 2;
	$(this).css('margin-top', ch);
	});
};

$('.partners .col2, .partners .col1').vAlign();

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

equalHeight($(".content-block.partners"));


// Running logos
	$(".vendors").smoothDivScroll({ autoScroll: "always", autoScrollDirection: "endlessloopright", autoScrollStep: 1, autoScrollInterval: 25 });

	// Logo parade event handlers
	$(".vendors").bind("mouseover", function() {
		$(this).smoothDivScroll("stopAutoScroll");
	}).bind("mouseout", function() {
		$(this).smoothDivScroll("startAutoScroll");
	});


});
