var baseBox;
var blockBox;

$(document).ready(function(){
	baseBox = new InsBox({
		bg_class: 'boxLinkBg',
		front_class: 'boxLinkFront',
		link_class: 'boxLink',
		form_class: 'boxForm'
	});
	baseBox.init();

	blockBox = new InsBox({
		bg_class: 'boxLinkBg',
		front_class: 'boxLinkFront',
		link_class: 'blockBoxLink',
		form_class: 'blockBoxForm',
		block: true
	});
	blockBox.init();

	var icons_interval;
	var rotatorSponsors = new InsRotator('.fade_sponsors');
	var rotatorPartners = new InsRotator('.fade_partners');
	var rotatorMedia = new InsRotator('.fade_media');
	icons_interval = setInterval(function(){
		$("div.fade_container").fadeOut(2000, function(){
			if ($(this).parent().parent().hasClass('.fade_sponsors')) {
				if (rotatorSponsors.total > 1) {
					rotatorSponsors.icons_rotate();
				}

				if (rotatorSponsors.total_regular > 4) {
					rotatorSponsors.icons_rotate2();
				}
			}

			if ($(this).parent().parent().hasClass('.fade_partners')) {
				if (rotatorPartners.total > 1) {
					rotatorPartners.icons_rotate();
				}

				if (rotatorPartners.total_regular > 4) {
					rotatorPartners.icons_rotate2();
				}
			}

			if ($(this).parent().parent().hasClass('.fade_media')) {
				if (rotatorMedia.total > 1) {
					rotatorMedia.icons_rotate();
				}

				if (rotatorMedia.total_regular > 4) {
					rotatorMedia.icons_rotate2();
				}
			}
			$("div.fade_container").fadeIn(1500);
		});
	}, 4500);
});