var stop_interval_slideMoveLeft;
var stop_interval_slideMoveRight;

function slideMoveRight() {
    var currentRight = parseInt($(".product_slider_contener").css('left'));
    var maxRight = parseInt($(".product_slider_contener").css('width'));
    //alert("currentRight=" + currentRight + "; maxRight=" + maxRight);
    if (currentRight < 0)
    {
        currentRight = currentRight + 1;
        $(".product_slider_contener").css('left', currentRight + "px");
        //$(".product_slider_left").css('opacity', "1");
    }
    else
    {
        //$(".product_slider_right").css('opacity', "0.4");
        clearInterval(stop_interval_slideMoveRight);
    }
    return false;
}

function slideMoveLeft() {
    var currentRight = parseInt($(".product_slider_contener").css('left'));
    var maxRight = parseInt($(".product_slider_contener").css('width'));
    var contenerWidth = parseInt($(".product_slider").css('width'));
    //alert("currentRight=" + currentRight + "; maxRight=" + maxRight);
    if (currentRight > -maxRight + contenerWidth)
    {
        currentRight = currentRight - 1;
        $(".product_slider_contener").css('left', currentRight + "px");
        //$(".product_slider_right").css('opacity', "1");
    }   
    else
    {
        //$(".product_slider_left").css('opacity', "0.4");
        clearInterval(stop_interval_slideMoveLeft);
    }
    return false;
}

$(function() {
    $(".product_slider_right").mouseover(function() {
        clearInterval(stop_interval_slideMoveLeft);
        stop_interval_slideMoveRight = setInterval("slideMoveRight()", 10);
        return false;
    });

    $(".product_slider_right").mouseout(function() {
        clearInterval(stop_interval_slideMoveRight);
        clearInterval(stop_interval_slideMoveLeft);
        return false;
    });

    $(".product_slider_right").click(function() {
        return false;
    });

    $(".product_slider_left").mouseover(function() {
        clearInterval(stop_interval_slideMoveRight);
        stop_interval_slideMoveLeft = setInterval("slideMoveLeft()", 10);
        return false;
    });

    $(".product_slider_left").mouseout(function() {
        clearInterval(stop_interval_slideMoveLeft);
        clearInterval(stop_interval_slideMoveRight);
        return false;
    });

    $(".product_slider_left").click(function() {
        return false;
    });
    

});

$(document).ready(function() {
    stop_interval_slideMoveLeft = setInterval("slideMoveLeft()", 20);
});

