 $(document).ready(function(){
            
            document.ondragstart = function(e) { return false; }
            var mouseDown    = false;
            var mouseStartX  = 0;
            var prevLeftX    = 0;
            var lastLeftX    = 0;
            var diffABS      = 0;
            var numProducts  = $("#slider-content > div").size();
            var curProduct   = 1;
            var productWidth = 849;
            var loopDelay    = 12000; //milliseconden
            
            /*
			
			$('#slider-mask').bind({
                mousedown: function(e)
                {
                    mouseDown   = true;
                    diffABS     = 0;
                    
                    //set mouse starting position
                    mouseStartX = e.pageX;
                    
                    //save current x position
                    prevLeftX = lastLeftX;
                },
                mousemove: function(e)
                {
                    if(mouseDown)
                    {
                        //diff current position, starting position
                        var difference = e.pageX - mouseStartX;
                        
                        //get current slider content position
                        var leftX = $('#slider-content').css('left');
                        leftX.split('px').join('');
                        leftX = parseInt(leftX);
                        
                        //add difference to content position
                        leftX += difference;
                        
                        //save absolute difference value
                        diffABS += Math.abs(difference);
                        
                        //move content div to new position
                        $('#slider-content').css('left', leftX + 'px');
                        
                        //save new values
                        lastLeftX   = leftX;
                        mouseStartX = e.pageX;                       
                    }
                },
                mouseup: function()
                {
                    mouseDown = false;
                    
                    //if current left position is lower than last time, then go to next product
                    //only move if mouse moved more than 50 pixels                                        
                    if(lastLeftX < prevLeftX && diffABS > 50)
                    {
                        curProduct++;
                        if(curProduct > numProducts)
                            curProduct = numProducts;
                    }
                    //if current left position is greater than last time, then go to previous product
                    //only move if mouse moved more than 50 pixels                                        
                    else if(lastLeftX > prevLeftX && diffABS > 50)
                    {
                        curProduct--;
                        if(curProduct < 1)
                            curProduct = 1;
                    }    

                    //determine scroll to left position by numProduct times product width, then make it negative
                    var pos = (curProduct * productWidth) - productWidth;
                    var posABS = Math.abs(pos) * (-1);
                    
                    //animate content div to its position                    
                    $('#slider-content').animate({
                        left: posABS
                    }, 200, function() {});
                    
                    //remove all active classes
                    for(var i = 1; i <= numProducts; i++)
                        $('#nav-slide' + i).removeClass('active');
                    
                    //add new active class
                    $('#nav-slide' + curProduct).addClass('active');                      
                    
                }
            });
			
			*/
			
            
            $('#slider-nav a').click(function() {
                
                //get product number from elemId
                productId = this.id.split('nav-slide').join('');
                productId = parseInt(productId);

                //determine scroll to left position by numProduct times product width, then make it negative
                var pos = (productId * productWidth) - productWidth;
                var posABS = Math.abs(pos) * (-1);

                //animate content div to its position                    
                $('#slider-content').animate({
                    left: posABS
                }, 200, function() {});                
                
                //remove all active classes
                for(var i = 1; i <= numProducts; i++)
                    $('#nav-slide' + i).removeClass('active');
                
                //add new active class
                $('#nav-slide' + productId).addClass('active');

            });

            $('#slide-next').click(function() {
                
                //next product
                curProduct++;
                if(curProduct > numProducts)
                    curProduct = numProducts;
                
                //determine scroll to left position by numProduct times product width, then make it negative
                var pos = (curProduct * productWidth) - productWidth;
                var posABS = Math.abs(pos) * (-1);
                    
                //animate content div to its position                    
                $('#slider-content').animate({
                    left: posABS
                }, 200, function() {});                
                
            });
            
            $('#slide-previous').click(function() {
                  
                //previous product
                curProduct--;
                if(curProduct < 1)
                    curProduct = 1;                

                //determine scroll to left position by numProduct times product width, then make it negative
                var pos = (curProduct * productWidth) - productWidth;
                var posABS = Math.abs(pos) * (-1);

                //animate content div to its position                    
                $('#slider-content').animate({
                    left: posABS
                }, 200, function() {});   
                               
            });
            
            var myTimeout = null;
            $(document).bind("ready", function() {
                myTimeout = window.setInterval(function() 
                {
                    //alert('current: ' + curProduct + ' == total: ' + numProducts);
                    if(curProduct == numProducts)
                        curProduct = 0;
                    
                    //next product
                    curProduct++;
                    if(curProduct > numProducts)
                        curProduct = numProducts;
                    
                    //determine scroll to left position by numProduct times product width, then make it negative
                    var pos = (curProduct * productWidth) - productWidth;
                    var posABS = Math.abs(pos) * (-1);
                        
                    //animate content div to its position                    
                    $('#slider-content').animate({
                        left: posABS
                    }, 200, function() {}); 

                    //remove all active classes
                    for(var i = 1; i <= numProducts; i++)
                        $('#nav-slide' + i).removeClass('active');
                    
                    //add new active class
                    $('#nav-slide' + curProduct).addClass('active');                     

                }, loopDelay);  
            
            });            
                      
        });
