﻿        function initViewby(){
           
            $("#alp").bind('click', function () {
                   $("#holder1").hide();
                   $("#holder2").show();
                   return false;
            });
            $("#ind").bind('click', function () {
                   $("#holder1").show();
                   $("#holder2").hide();
                   return false;
            });
        }
        function initMbSlider(prcss, subcss,mianid, movelang,showCon,toBegin){  
            var container = $(prcss);
            var locations=$(subcss,container);
            var count=locations.length;
            if(subcss=='td'){
            locations.css("width",movelang);
            $.each( locations, function(i, n){
              var tba =$('a',$(n)).html();
              if(tba=='1'){
                $(n).hide();
              }
            });
                container.css("position","relative");
                count=count/$("tr",container).length;
            }
            container.attr('indexNum',0)
            container.css("width",count*movelang);
            container.css("left",0);
            $(mianid+' .prev').eq(0).bind('click', function () {
                    
                    sliderMove(container,'r',movelang,showCon,toBegin);
                    return false;
            });
            $(mianid+' .next').eq(0).bind('click', function () {
                    sliderMove(container,'l',movelang,showCon,toBegin);
                    return false;
            });
        }
        function sliderMove(prcss,moveto,movelang,showCon,toBegin){
            var pleft=prcss.attr('indexNum');
            if(moveto=='l'){
                var repleft=pleft-showCon*movelang;
                if((-pleft+showCon*movelang) < prcss.width()){
                    prcss.attr('indexNum',repleft)
                    prcss.animate({left:repleft+'px'});
                }
                else
                {
                    if(toBegin)
                    {
                        prcss.attr('indexNum',0)
                        prcss.animate({left:'0px'});
                    }   
                }
            }else{
                if(pleft < 0){
                    var repleft=parseInt(pleft)+showCon*movelang;
                    //alert(parseInt(pleft));
                    prcss.attr('indexNum',repleft)
                    prcss.animate({left:repleft+'px'});
                }else if(pleft == 0)
                {
                    if(toBegin)
                    {
                        var yushu=(prcss.width()/movelang)%showCon;
                        var templeft=(yushu==0?showCon:yushu)*movelang-prcss.width();
                        prcss.attr('indexNum',templeft)
                        prcss.animate({left:templeft+'px'});
                        //alert(showCon*movelang-prcss.width());
                    }   
                }
            }
        }  
