(function($) {
	$(document).ready(function() {

		$("#open-auth-form").click(function() {
			$("#transparent").show("fast").height($("#container").height());
			$("#auth-form").show("fast");
			return false;
		});

		$("#transparent").click(function() {
			$("#auth-form").slideUp("fast");
			$("#transparent").hide("fast");
			return false;
		});

	    $('#ss-images').cycle({fx:'fade', speed: 1000, timeout: 10000});

		$('.tooltips').cluetip({
		    showTitle: false,
		    cluezIndex: 9999,
			dropShadow: false, 
			positionBy: 'fixed',
			topOffset: '-82px',
			leftOffset: 20,
			sticky: true,
			closePosition: 'top',
			width: '392px',
			height: '193px',
			arrows: true,
			closeText: ''
		});

		$("#open-subscr-form").click(function() {
		    if ($(this).hasClass("opened")) {
				$("#subscr-form").slideUp("fast");
				$(this).removeClass("opened");
			} else {
				$(this).addClass("opened");
				$("#subscr-form").slideDown("fast");
			}
			return false;
		});

		$(".faq-title a").click(function() {
		    if ($(this).hasClass("opened")) {
				$("#" + $(this).parents("div.faq").attr("id") + " div.faq-answer").slideUp("fast");
				$(this).removeClass("opened");
			} else {
				$(this).addClass("opened");
				$("#" + $(this).parents("div.faq").attr("id") + " div.faq-answer").slideDown("fast");
			}
			return false;
		});

		$("#open-all a").click(function() {

			$('div.faq').each(function(i) {
			    $("#faq-" + i + "  div.faq-answer").slideDown("fast");
			    $("#faq-" + i + "  .faq-title a").addClass("opened");
			});
			$("#open-all").css("display", "none");
			$("#close-all").css("display", "block");

			return false;
		});

		$("#close-all a").click(function() {

			$('div.faq').each(function(i) {
			    $("#faq-" + i + "  div.faq-answer").slideUp("fast");
			    $("#faq-" + i + "  .faq-title a").removeClass("opened");
			});
			$("#close-all").css("display", "none");
			$("#open-all").css("display", "block");

			return false;
		});

		$(".class-auto ul li a").click(function() {

			if (!$(this).hasClass("active")) {
				$(".class-auto ul li a.active").removeClass("active");
				$(this).addClass("active");
			}

			return false;
		});

	});
})(jQuery);

