var delay = 4000;
var timeSlide = 2000;

jQuery(document).ready(function(){
	
	/*jQuery("#rotator").carousel( { 
		loop: true, 
		autoSlide: true, 
		autoSlideInterval: 6000, 
		effect: "fade",
		animSpeed: 2000,
		delayAutoSlide: 3000 
	} );*/
	
	if (!(jQuery('#header UL LI.current_page_item').length > 0) && !(jQuery('#header UL LI.current_item_parent').length > 0)) {
		jQuery('#header UL LI.home-page').addClass('current_page_item');
	}
	
	if (jQuery('.wpcf7-form').length > 0) {
		jQuery('div.wpcf7-response-output').replaceWith('');
		jQuery('.wpcf7').prepend('<div class="wpcf7-response-output wpcf7-display-none"></div>');
	};
	
	jQuery('A[rel="external"]').attr('target', '_blank');
	
	/* Home page rotate */
	jQuery('#rotator UL LI').fadeOut(1);
	jQuery('#rotator UL LI.active').addClass('current').fadeIn(1);
	setTimeout('rotate_images('+ delay + ');', delay);
	

});

function rotate_images(delay){
	
	var currObj = jQuery('#rotator UL LI.current');
	var nextObj = null;
	if(jQuery('#rotator UL LI:last').hasClass('current')){ 
		nextObj = $('#rotator UL LI:first');
	} else nextObj = currObj.next();
	
	currObj.removeClass('current').fadeOut(timeSlide);
	nextObj.addClass('current').fadeIn(timeSlide);
	
	setTimeout('rotate_images('+ delay + ');', delay);
	
}
