$(document).ready(function(){

$("#list_works").jCarouselLite({
		btnNext: ".footer_next",
		btnPrev: ".footer_prev",
		visible: 12,
		circular:true
				});
	



/**/
/*
	var i = 0;
	$("#list_works ul li").each(function(i){
		var width_img = $(this).find("img").width();
		var width_ul = (38*i)+(i*width_img);
		
	});
	var list_ul_f = $("#list_works ul");
	var list_w = $("#list_works").width();
	var list_ul_f_w = list_ul_f.width();
	var width_img = list_ul_f.find("li").find("img").width();
	$(".footer_next").click(function(){
		var poz = list_ul_f.position();
		if(poz.left<list_ul_f_w-((list_ul_f_w*2)-list_w)){ 
			list_ul_f.animate({ left: '0px' });
		} else {
			list_ul_f.animate({ left: '-='+width_img+'px' }, 500);
		}
	});
	$(".footer_prev").click(function(){
		var poz = list_ul_f.position();
		if(poz.left>=0){
			list_ul_f.animate({ left: '0px' }, 500);	
		} else {
			list_ul_f.animate({ left: '+='+width_img+'px' }, 500);
		}
	});
	*/
/**/
	$(".form_inputZ table td:last").css({ paddingRight:'0'});
/**/
	$(".menu_top li").each(function(i){ 
		i = i+1;
		if($(this).find("a").hasClass("act")){ 
			$(".menu_top").append("<div class='menu_top_act"+i+" ie6png'>&nbsp;</div>");
		}
		$(this).find("a").attr('rel',i); 
	});
	$(".menu_top li a").mouseover(function(){
		var rel = $(this).attr('rel');
		$(".menu_top .mouseover").html("<div class='menu_top_act"+rel+" ie6png'>&nbsp;</div>");
	});
	$(".menu_top li a").mouseout(function(){ $(".menu_top .mouseover").html(""); });
/**/
	$("#mail_icq").click(function () {
                var mail_icq = $("#mail_icq i").html();
                var phone_me = $("#phone_me").html();
                if ($("#mail_icq i").length > 0) {
                    $(this).find("i").remove();
                    $(this).html(mail_icq);
                    $("#phone_me").html("<i>" + phone_me + "</i>");
                    $(".form_zakaz .form_inputZ table td strong").html("E-mail/ICQ");
                }
            });

            $("#phone_me").click(function () {
                var mail_icq = $("#mail_icq").html();
                var phone_me = $("#phone_me i").html();
                if ($("#phone_me i").length > 0) {
                    $(this).find("i").remove();
                    $(this).html(phone_me);
                    $("#mail_icq").html("<i>" + mail_icq + "</i>");
                    $(".form_zakaz .form_inputZ table td strong").html("+7");
                }
            });
	$("#calck").click(function(){
		$(".plashka_2, .window").fadeIn(500);
	});
	$("#close").click(function(){
		$(".plashka_2, .window").fadeOut(500);
	});
	$("#loginC").click(function(){ $(".shadow_bgs, .block_login_client").fadeIn(500); });
	$(".close_but").click(function(){ $(".shadow_bgs, .block_login_client").fadeOut(500); });
	
	$(document.body).click(function(e) {
                var p = $(".window");
                var offset = p.offset();
                var w = parseInt(p.css("width"), 10);
                var h = parseInt(p.css("height"), 10);
                if (p.css("display") != 'none' && (
                        e.pageX < offset.left ||
                        e.pageX > offset.left + w ||
                        e.pageY < offset.top ||
                        e.pageY > offset.top + h )
                    )
                   $(".plashka_2, .window").fadeOut(500); 
                   
                var p1 = $(".block_login_client");
                var offset1 = p1.offset();
                var w1 = parseInt(p1.css("width"), 10);
                var h1 = parseInt(p1.css("height"), 10);
                if (p1.css("display") != 'none' && (
                        e.pageX < offset1.left ||
                        e.pageX > offset1.left + w1 ||
                        e.pageY < offset1.top ||
                        e.pageY > offset1.top + h1 )
                    )
                    $(".shadow_bgs, .block_login_client").fadeOut(500);
            });
			/*
           $(".footer_next").click();	 
           $(".footer_prev").click();     
		   */
});
