$(document).ready(function(){
	if ($('.secondMenu').text().length < 10) $('.secondMenu').remove();
	
	if($(".slideme").length>0){
            $(".slideme").jCarouselLite({
                btnNext: ".arrR",
                btnPrev: ".arrL",
                visible: 1
            });
	}
	
	if($(".sliderLarge").length>0){
            $("#sliderLarge").jCarouselLite({
                btnNext: "#arr1r",
                btnPrev: "#arr1l",
                visible: 3
            });
            $("#sliderLarge2").jCarouselLite({
                btnNext: "#arr2r",
                btnPrev: "#arr2l",
                visible: 3
            });
            $("#sliderLarge3").jCarouselLite({
                btnNext: "#arr3r",
                btnPrev: "#arr3l",
                visible: 3
            });
	}	
	
	if($(".preBottomL").length>0){
		$(".preBottomL").jCarouselLite({
                    visible: 1,
                    btnGo:
                            [".pimp1", ".pimp2",".pimp3", ".pimp4"]
                    });
                    $(".preBottomTop div a").click(function(){
                            $(".preBottomTop div .a").removeClass("a");
                            $(this).addClass("a");
		});
	}
	
	
	$(".fancy").fancybox({
		'hideOnContentClick' : false,
		'overlayOpacity' : 0.8,
		'overlayColor' : '#ffffff',
		'centerOnScroll' : true,
                'padding' : 0
	});
        $(".photosContent .fancy:odd").remove();
	
	$(".pop").live('click',function(){
		$(".popme").addClass("hidden");
		$(".popme").html($(""+$(this).attr("href")).html());
		$(".popme").removeClass("hidden");	
	});
	
	$(".type input:radio").live('click',function(){
		if($(this).val()=="Физическое лицо"){
			$(".juri").addClass("hidden");			
		} else {
			$(".juri").removeClass("hidden");
		}
	});

    $(".contentWT a span").live('click',function(){
        $(this).addClass('hov');
        return false;
    });
    
    $("table tr").hover(function(){
        $(this).toggleClass('hov');
        return false;
    });

	$('.questBlock').live('click', function(){
		$('.questBlock').removeClass('act');
		$(this).addClass('act');
	});
	
	$('.letterBlocks:not(:first)').hide();
	$('.alf a:first').addClass('sel');
	$('.alf a').click(function(){
		$('.alf a').removeClass('sel');
		$(this).addClass('sel');
		var at = $(this).attr('data-id');
		$('.letterBlocks').hide();
		$('.letterBlocks[data-id='+at+']').slideDown('slow');	
	});

	$('.dashTabs a').live('click', function(){
		$('.dashContent').slideToggle('fast','swing');
		$('.dashTabs li').toggleClass('act');
		
		$(this).replaceWith( "<span>" + $(this).text() + "</span>" );
		var el = $('.dashTabs li:not(.act) span');
		el.replaceWith("<a href=\"javascript:void(0);\">" + el.text() + "</a>" );

	});
    
    if($("#reviews-main").length>0)
    {
        $('#reviews-main').cycle({
            fx:    'fade', 
            speed:  500,
            timeout: 8000,
            pause: true 
        });
    }
    
    //menu
    $(".innerClass").hide();
    $(".outerClass li.a ul.innerClass").show();
    $(".innerClass li.a").parent().show();
    $(".secondMenu a").live('click',function(){
        
        var chUl = $(this).parent().find("ul");
        if(chUl.length>0 && !$(this).hasClass('active') && !($(this).parent().find("ul li.a").length>0))
        {
            $(this).addClass('active');
            chUl.slideDown('fast');
            return false;
        }
    });
    // end menu
    
    //reg form
    if($('input[name="typeEvent"]').length>0)
    {
        var inputShowClass = $('input[name="typeEvent"]:checked').attr('class');
        var inputHideClass = $('input[name="typeEvent"]:checked').attr('hide');
        $("option."+inputHideClass).hide();
        
        $('input[name="typeEvent"]').change(function(){
            inputShowClass = $('input[name="typeEvent"]:checked').attr('class');
            inputHideClass = $('input[name="typeEvent"]:checked').attr('hide');
            
            $("option."+inputShowClass+":first").attr('selected', 'selected');
            $("option."+inputShowClass).show();
            $("option."+inputHideClass).hide();
        });
    }
    //end reg form
    
    $(".program_link").live('click',function(){
        $(".program_text").slideToggle('fast');
        return false;
    });
	

	
});


/* loading images after content */
/*
$(function () {
	$('.speakBlockIn img:not(.spAbs), .preBottomImg img:not(.preAbs)').hide();//hide all the images on the page
});
	
var i = 0;//initialize
var int=0;//Internet Explorer Fix

$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var int = setInterval("doThis(i)",300);//500 is the fade in speed in milliseconds
});
	

function doThis() {
	
	var images = $('.speakBlockIn img:not(.spAbs), .preBottomImg img:not(.preAbs)').length;//count the number of images on the page
	
	if (i >= images) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
	}
	
	$('.speakBlockIn img:hidden:not(.spAbs), .preBottomImg img:hidden:not(.preAbs)').eq(0).fadeIn(300);//fades in the hidden images one by one
	i++;//add 1 to the count		
}	
*/
/* loading images after content */
