$(document).ready(function(){ 
	
	$(document).pngFix();
	
	$('ul.sf-menu').superfish();
	
	$( "#tabs" ).tabs();
	
	setInterval( "slideSwitch('.slideshow')", 5000 );
	setInterval( "slideSwitch('.affiliates')", 6050 );
		
	$('.webform').validate({
		rules: {
			errorPlacement: function(error, element) {
				if(element.is(":radio"))
					error.appendTo(element.parent().next().next());
				else if(element.is(":checkbox"))
					error.appendTo (element.next());
				else
					error.appendTo(element.parent().next());
			},
			success: function(label) {
				label.html("&nbsp;").addClass("checked");
			}
		}
	});		
	
});
function slideSwitch(className) {	
	var $active = $(className + ' span.active');
	if ( $active.length == 0 ) $active = $(className + ' span:last');
	
	var $next =  $active.next().length ? $active.next()
		: $(className + ' span:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
	});
};

