$(document).ready(function() {
    var im0m = $(".home_im0_01 .im0 .pictxt:last");
    var im0m1 = $(".home_im0_02 .im0 .pictxt:last");
    im0m.removeClass("mr10");
    im0m1.removeClass("mr35");

    var aniSpeed = 500;
    var aniIndex = 0;
    var aniPageSize = 5;
    var listpic = $(".pic_content .pic_li");
    if(listpic.length<=0){
        return ;
    }
    var pic_content_ui = listpic[0].parentNode;
    var aniItemWidth = listpic[0].clientWidth;
    for (var i = 0; i < listpic.length; i++) {
        pic_content_ui.appendChild(listpic[i].cloneNode(true));
    }

    var aniItemCount = listpic.length;
    var turnPageIndexRight = parseInt(aniItemCount / aniPageSize);
    aniIndex = turnPageIndexRight;
    pic_content_ui.style.left = (-aniItemCount * aniItemWidth) + "px";
    $("#left_btn_off").mouseover(
		function() {
		    $("#left_btn_off").removeClass("left_btn_off");
		    $("#left_btn_off").addClass("left_btn_on");
		}
	)
    $("#left_btn_off").mouseout(
		function() {
		    $("#left_btn_off").removeClass("left_btn_on");
		    $("#left_btn_off").addClass("left_btn_off");
		}
	)
    $("#right_btn_off").mouseover(
		function() {
		    $("#right_btn_off").removeClass("right_btn_off");
		    $("#right_btn_off").addClass("right_btn_on");
		}
	)
    $("#right_btn_off").mouseout(
		function() {
		    $("#right_btn_off").removeClass("right_btn_on");
		    $("#right_btn_off").addClass("right_btn_off");
		}
	)

    $("#left_btn_off").click
    (
        function() {
            aniIndex--;
            if (aniIndex == -1) {
                aniIndex = turnPageIndexRight;
                pic_content_ui.style.left = (-aniIndex * aniPageSize * aniItemWidth) + "px";
                aniIndex--;
            }
            $(".pic_content .pic_ul").animate({ left: -aniIndex * aniPageSize * aniItemWidth }, aniSpeed);
        }
    );
    $("#right_btn_off").click
    (
        function() {
            aniIndex++;
            if (aniIndex == turnPageIndexRight * 2) {
                aniIndex = turnPageIndexRight - 1;
                pic_content_ui.style.left = (-aniIndex * aniPageSize * aniItemWidth) + "px";
                aniIndex++;
            }
            $(".pic_content .pic_ul").animate({ left: -aniIndex * aniPageSize * aniItemWidth }, aniSpeed);
        }
    );
        
    });

    jQuery(function() {
        var $lis = $("#lttabs>.mem_cont .pic_li"); //所有的标题li
        
        var $cos = $("#lttabs .con_text"); //li对应的内容

        $lis.each(function(i) {
            var $li = $(this), mytimer;

            $li.mouseover(function() {
                var self = this;

                mytimer = window.setTimeout(function() {
                    //if (!$(self).hasClass('expect')) {
                        $lis.removeClass("on");
                        $lis.addClass("off");
                        $('.expect').removeClass("off");
                        self.className = 'on';
                        $cos.addClass("none");
                        $cos.each(function(j) {
                            if (j === i) {
                                var $c = $(this);

                                $c.removeClass('none');
                            }
                        });
                    //}
                }, 100)
            });
            $li.mouseout(function() {
                window.clearTimeout(mytimer);
            });
        });
    });  
