/*
	--------------------------------------------------------------
	jquery js by fencl web design -- http://www.fenclwebdesign.com
	--------------------------------------------------------------
	sitecore.js 6/23/2011
	--------------------------------------------------------------
*/

$(document).ready(function() {
	/* image rollover functions */
	$('img[data-hover]').hover(function() {
		$(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
	}).each(function() {
		$('<img />').attr('src', $(this).attr('data-hover'));
	});
	
	$('input[data-hover]').hover(function() {
		$(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
	}).each(function() {
		$('<img />').attr('src', $(this).attr('data-hover'));
	});
	
    $('form.uniForm').uniform({
        prevent_submit : true
      });
});

function slideSwitch() {
    var $active = $('#slider img.active');

    if ( $active.length == 0 ) $active = $('#slider img:first');

    var $next =  $active.next().length ? $active.next() : $('#slider img:first');
    $active.addClass('last-active');

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

$(function() {
    setInterval( "slideSwitch()", 7000 );
});
