$(document).ready(function(){
	
	$("#contactForm input").focus(function(){
		$("#contactForm").animate({
			height: '270px'
		});
	});
	
	
	//Form Field Fix
	var inputs = $("input[type='text'],textarea");
	$.each(inputs,function(i,e) {
		var placeholder = $(e).attr("placeholder");
			$(e).val(placeholder);	
			$(e).blur(function() {
				resetInput($(this));
			});
			$(e).focus(function() {
				if($(this).val() == placeholder) {
					$(this).val("");
				}
			});
		});

	function resetInput(elem) {
		if($(elem).val() == "") {
				var placeholder = $(elem).attr("placeholder");
				$(elem).val(placeholder);
			}
	}

	 $(function() {
		$('#officeLightbox a').lightBox();
	});
	 $(function() {
		$('#cerecLightbox a').lightBox();
	});

	$(function() {
		$("div#controller").jFlow({
			slides: "#slides",
			width: "530px",
			height: "360px"
		});
	});
	
	//Banner Rotation
	 setInterval( "bannerRotate()", 5000 );
});

function bannerRotate() {
	var $active = $('#banner IMG.active');

    if ( $active.length == 0 ) $active = $('#banner IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#banner IMG:first');


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}


