
    function slideIt(column){
        if(($(".roller").width()-30)<=($(".form").width())){
                 //$(".arrowleft").hide();
                 //$(".arrowright").hide();
                 $(".nav").each(function(){ $(this).hide();});
        }
   var lastglowed = null;
   var slideglowed = null;
   $(".container").eq(0).find(".image").eq(0).each(function(){
            $(this).css({  
                display: "none"
            }).next().css({
                display: "block"
            });
            lastglowed = $(this);
        });
    var visiblecolcount = Math.round($(".form").width()/$(".container").width());
    var glowUP = function(){
        if($(".roller").data("current")==null){
            $(".roller").data("current",0); current= 0; 
        }else{
            current = $(".roller").data("current");        
        }
        var imgnum = $(".container").eq(current).find(".image").length;
        var imgNumber = Math.floor(Math.random( ) * (imgnum))
        var colNum =  Math.floor(Math.random( ) * (visiblecolcount))
        if(lastglowed!=null){
            $(lastglowed).css({
                display: "block"
            }).next().css({
                display: "none"
            });
        }
         if(slideglowed!=null){
            $(slideglowed).css({
                display: "block"
            }).next().css({
                display: "none"
            });
        }
        $(".container").eq(current+colNum).find(".image").eq(imgNumber).each(function(){
            $(this).css({  
                display: "none"
            }).next().css({
                display: "block"
            });
            lastglowed = $(this);
        });
        
      
    }
    var glower =  setInterval(glowUP,2000);  
            var noanimate = 1;
        
            $("#left").click(function(){
                if($(".roller").data("current")==null){
                    $(".roller").data("current",0); current= 0; 
                }else{
                    current = $(".roller").data("current");        
                }
            if(noanimate==1){
                noanimate = 0; 
                clearInterval(glower);
                $(".lol").remove();
                $(".container").eq(current-1).css({
                    borderRight: "1px dotted #939393"
                });
                var tdwidth =  $(".container").eq(current).position().left-$(".container").eq(current-1).position().left;
                var position = (parseInt($(".roller").css("left"))+tdwidth);
                var tablewidth= $(".tableform").width();
                if(parseInt($(".roller").css("left"))< -($(".container").width())){
                    current -= 1;
                    $(".roller").data("current",current);
                        $(".roller").animate({"left": position}, 150,"swing",function(){
                            $(".container").eq(current-1).css({
                                borderRight: "1px dotted #303030"
                            });
                            
                            slideglowed = $(".container").eq(current).find(".image");
                            if(lastglowed!=null){
                                $(lastglowed).css({
                                    display: "block"
                                }).next().css({
                                    display: "none"
                                });
                            }
                             $(".container").eq(current).find(".image").first().css({  //for better times
                                display: "none"
                            }).next().css({
                                display: "block"
                            });
                         
                            $(".container").eq(current+1).find(".image").first().css({
                                display: "block"
                            }).next().css({
                                display: "none"
                            });
                            glower =  setInterval(glowUP,2000);
                            noanimate = 1;
                        });
             
               }else{
                    
                    noanimate = 1;
                      
               } 
            }
            });
        
        
            $("#right").click(function(){
                if($(".roller").data("current")==null){
                    $(".roller").data("current",0); current= 0; 
                }else{
                    current = $(".roller").data("current");        
                }
                $(".container").eq(current).css({
                        borderRight: "1px dotted #939393"
                });
                if(noanimate==1){
                clearInterval(glower);
                noanimate = 0; 
                $(".lol").remove();
                 var tdwidth =  $(".container").eq(current+1).position().left-$(".container").eq(current).position().left;
                 var position = (parseInt($(".roller").css("left"))-tdwidth);
                var tablewidth=$(".roller").width() - $(".form").width();
                if(-(tablewidth)<position){
                    current += 1;
                        $(".roller").data("current",current);
                    $(".roller").animate({"left": position},150,"swing",function(){
                        $(".container").eq(current-1).css({
                                    borderRight: "1px dotted #303030"
                        });
                        
                            slideglowed = $(".container").eq(current).find(".image");  
                            if(lastglowed!=null){
                                $(lastglowed).css({
                                    display: "block"
                                }).next().css({
                                    display: "none"
                                });
                            }    
                            $(".container").eq(current).find(".image").first().css({
                                display: "none"
                            }).next().css({
                                display: "block"
                            });
                            $(".container").eq(current+1).find(".image").first().css({
                                display: "block"
                            }).next().css({
                                display: "none"
                            });
                            noanimate = 1;
                            glower =  setInterval(glowUP,2000);
                        });
                }else{
                   
                   noanimate = 1;
              }
              }
             });       
               $(".photo").each(function(){
                $(this).hover(function(){
                        if(lastglowed!=null){
                            $(lastglowed).css({
                                display: "block"
                            }).next().css({
                                display: "none"
                            });
                        }
                        $(this).find(".image").css("display","none").next().css("display","block");clearInterval(glower);},
                    function(){
                        $(this).find(".image").css("display","block").next().css("display","none"); glower =  setInterval(glowUP,2000);});
                });

    }
    $(slideIt);
