main.js 3.71 KB
jQuery(document).ready(function() {
    calculate();
	callBack();
	tabs();
	formValidate();
	sliderkit();
	scrollTo();
	blockCompleted();
	
});

function callBack() {
	
	if (jQuery(".callback a").length) {
		
		var order = jQuery(".dialog");
		
		// callback / now
		jQuery(".callback a").bind('click', function() {
			var title = jQuery(this).text();
			order.dialog("open");
			order.dialog("option", "position", { my: "center", at: "center", of: window});
			// order.dialog("option", "title", "Обратный звонок");
			return false;
		});
		
		// callback / dialog
		jQuery(".dialog").dialog({
			width: 490,
			minHeight: 50,
			modal: true,
			resizable: false,
			autoOpen: false,
			dialogClass: "callback-form"
		});
	};
	
}


function calculate() {

    if (jQuery(".calculate a").length) {

        var order = jQuery(".calculate-dialog");

        // callback / now
        jQuery(".calculate a").bind('click', function() {
            var title = jQuery(this).text();
            order.dialog("open");
            order.dialog("option", "position", { my: "center", at: "center", of: window});
            // order.dialog("option", "title", "Обратный звонок");
            return false;
        });

        // callback / dialog
        jQuery(".calculate-dialog").dialog({
            width: 940,
            minHeight: 570,
            modal: true,
            resizable: false,
            autoOpen: false,
            dialogClass: "calculate-form"
        });
    };

}





function tabs() {
	
	if ($(".tabs").length) {
		$(".tabs").tabs();
	}
	
}

function formValidate() {
	
	if (jQuery("form.validate").length) {
		jQuery("input.mask-phone").mask("+38(999) 999-9999");
		jQuery("form.validate").each(function() {
			jQuery(this).validate({
				rules: {
					audit_email: {
						email: true
					},
					contact_email: {
						email: true
					}
				}
			});
		});
	};
	
}

function sliderkit() {
	
	// slider / block-team
	if ($(".block-team .skit").length) {
		$(".block-team .skit").sliderkit({
			cssprefix: "skit",
			shownavitems: 5,
			auto: false,
			scroll: 1,
			circular: false,
			// freeheight: true,
			scrollspeed: 500
		});
	}
	
	// slider / block-reviews
	if ($(".block-reviews .skit").length) {
		$(".block-reviews .skit").sliderkit({
			cssprefix: "skit",
			auto: false,
			circular: true,
			tabs: true,
			// panelclick: true,
			panelfx: "sliding",
			panelfxspeed: 500
		});
	}
	
	// slider / block-clients
	if ($(".block-clients .skit").length) {
		$(".block-clients .skit").sliderkit({
			cssprefix: "skit",
			shownavitems: 5,
			auto: false,
			scroll: 1,
			circular: false,
			freeheight: true,
			scrollspeed: 500
		});
	}
	
}

function scrollTo() {
	
	// fixed / nav
	var offset = $("#nav").offset();
	jQuery(window).scroll(function() {
		if (jQuery(window).scrollTop() > offset.top) {
			$("#nav").addClass('nav-fixed');
		}
		else {
			jQuery("#nav").removeClass('nav-fixed');
		}
	});
	
	// scroll / top
	/*
	jQuery(".logo a").click(function() {
		jQuery('html, body').animate({
			scrollTop: 0
		}, 500);
		return false;
	});
	*/
	
	// scroll / nav
	jQuery("#nav li a").click(function() {
		jQuery("#nav li a").removeClass('active');
		jQuery(this).addClass('active');
		jQuery('html, body').animate({
			scrollTop: jQuery( jQuery(this).attr("href") ).offset().top - 41
		}, 500);
		return false;
	});
	
}

function blockCompleted() {
	
	if (jQuery(".block-completed").length) {
		var _height = jQuery(window).height() - 147;
		if (_height > 709) { _height = 709; }
		jQuery(".block-completed").css("min-height", _height);
	}
	
}