$(document).ready(function(){
	$('#topSlider').anythingSlider({
		easing: "easeInOutExpo",
		autoPlay: true,
		delay: 5000,
		startStopped: false,
		animationTime: 600,
		hashTags: false,
		buildNextPrevButtons: false,
		buildNavigation: true,
		pauseOnHover: true,
		startText: "Go",
		stopText: "Stop",
		navigationFormatter: formatText
    });
$('.anythingSlider:not("#topSlider")').each(function(i, slider) {
    // If any slider has less than 2 let members
    if ( $("ul li", slider).length < 2 ) {
        // don't apply the slider functionality
        return;
    }

    $(slider).anythingSlider({
        easing: "easeInOutExpo",
        autoPlay: false,
        delay: 3000,
        startStopped: false,
        animationTime: 600,
        hashTags: false,
        buildNextPrevButtons: true,
        buildNavigation: false
    });
});
	$("#slide-jump").click(function(){
		$('.anythingSlider').anythingSlider(6);
	});
	
	$(".grid .detailblock:last").addClass("last");
	
	$("a.contact").colorbox({width:"50%", inline:true, href:"#contact-form"});
	
	$('#contact-form form').submit(function(){
		$.post('ajax/contact.php',$(this).serialize(),function(data){
			$('#contact-form .message').empty();
			for(var i=0; i<data.length; i++){				
				if (data[i]=="Success"){
					$('#contact-form .message').addClass('success').text('Thanks, for contacting us!').show();
					$('#contact-form form').hide();
					setTimeout("$.fn.colorbox.close();",2500);
				} else {
					$('#contact-form .message').addClass('error').append(data[i]+'<br>').show();
				}
			}
		},'json');
		return false;
	});
});

function formatText(index, panel) {
	return index + "";
}
