/* Minification failed. Returning unminified contents.
(2,1): run-time error CSS1019: Unexpected token, found '$'
(2,2): run-time error CSS1019: Unexpected token, found '('
(2,11): run-time error CSS1031: Expected selector, found ')'
(2,11): run-time error CSS1025: Expected comma or open brace, found ')'
(4,2): run-time error CSS1019: Unexpected token, found ')'
(6,21): run-time error CSS1031: Expected selector, found '='
(6,21): run-time error CSS1025: Expected comma or open brace, found '='
(8,10): run-time error CSS1031: Expected selector, found 'GetProductDetails('
(8,10): run-time error CSS1025: Expected comma or open brace, found 'GetProductDetails('
(64,10): run-time error CSS1031: Expected selector, found 'goto_context('
(64,10): run-time error CSS1025: Expected comma or open brace, found 'goto_context('
(69,10): run-time error CSS1031: Expected selector, found 'Get3DPhotoByProductAndColorCode('
(69,10): run-time error CSS1025: Expected comma or open brace, found 'Get3DPhotoByProductAndColorCode('
(101,10): run-time error CSS1031: Expected selector, found 'Set_3D_Photo_From_Load('
(101,10): run-time error CSS1025: Expected comma or open brace, found 'Set_3D_Photo_From_Load('
(110,8): run-time error CSS1030: Expected identifier, found 'addEventListener('
(110,8): run-time error CSS1031: Expected selector, found 'addEventListener('
(110,8): run-time error CSS1025: Expected comma or open brace, found 'addEventListener('
(122,2): run-time error CSS1019: Unexpected token, found ')'
(123,10): run-time error CSS1031: Expected selector, found 'show_hide_small_bar_product('
(123,10): run-time error CSS1025: Expected comma or open brace, found 'show_hide_small_bar_product('
(128,10): run-time error CSS1031: Expected selector, found '='
(128,10): run-time error CSS1025: Expected comma or open brace, found '='
(129,15): run-time error CSS1031: Expected selector, found '='
(129,15): run-time error CSS1025: Expected comma or open brace, found '='
(130,16): run-time error CSS1031: Expected selector, found '='
(130,16): run-time error CSS1025: Expected comma or open brace, found '='
(132,10): run-time error CSS1031: Expected selector, found 'top_banner_move('
(132,10): run-time error CSS1025: Expected comma or open brace, found 'top_banner_move('
(169,10): run-time error CSS1031: Expected selector, found 'top_banner_previus('
(169,10): run-time error CSS1025: Expected comma or open brace, found 'top_banner_previus('
(210,10): run-time error CSS1031: Expected selector, found '='
(210,10): run-time error CSS1025: Expected comma or open brace, found '='
(211,15): run-time error CSS1031: Expected selector, found '='
(211,15): run-time error CSS1025: Expected comma or open brace, found '='
(212,16): run-time error CSS1031: Expected selector, found '='
(212,16): run-time error CSS1025: Expected comma or open brace, found '='
(214,10): run-time error CSS1031: Expected selector, found 'mid_banner_move('
(214,10): run-time error CSS1025: Expected comma or open brace, found 'mid_banner_move('
(246,10): run-time error CSS1031: Expected selector, found 'mid_banner_previus('
(246,10): run-time error CSS1025: Expected comma or open brace, found 'mid_banner_previus('
(284,22): run-time error CSS1031: Expected selector, found '='
(284,22): run-time error CSS1025: Expected comma or open brace, found '='
(286,2): run-time error CSS1019: Unexpected token, found ','
(286,4): run-time error CSS1019: Unexpected token, found '7000'
(286,8): run-time error CSS1019: Unexpected token, found ')'
(288,22): run-time error CSS1031: Expected selector, found '='
(288,22): run-time error CSS1025: Expected comma or open brace, found '='
(290,2): run-time error CSS1019: Unexpected token, found ','
(290,4): run-time error CSS1019: Unexpected token, found '7000'
(290,8): run-time error CSS1019: Unexpected token, found ')'
(292,10): run-time error CSS1031: Expected selector, found 'previus_top_button('
(292,10): run-time error CSS1025: Expected comma or open brace, found 'previus_top_button('
(297,10): run-time error CSS1031: Expected selector, found 'next_top_button('
(297,10): run-time error CSS1025: Expected comma or open brace, found 'next_top_button('
(303,10): run-time error CSS1031: Expected selector, found 'previus_mid_button('
(303,10): run-time error CSS1025: Expected comma or open brace, found 'previus_mid_button('
(308,10): run-time error CSS1031: Expected selector, found 'next_mid_button('
(308,10): run-time error CSS1025: Expected comma or open brace, found 'next_mid_button('
(314,1): run-time error CSS1019: Unexpected token, found '$'
(314,2): run-time error CSS1019: Unexpected token, found '('
(314,9): run-time error CSS1031: Expected selector, found ')'
(314,9): run-time error CSS1025: Expected comma or open brace, found ')'
(327,2): run-time error CSS1019: Unexpected token, found ')'
(330,15): run-time error CSS1031: Expected selector, found '='
(330,15): run-time error CSS1025: Expected comma or open brace, found '='
(331,10): run-time error CSS1031: Expected selector, found '='
(331,10): run-time error CSS1025: Expected comma or open brace, found '='
(332,15): run-time error CSS1031: Expected selector, found '='
(332,15): run-time error CSS1025: Expected comma or open brace, found '='
(333,9): run-time error CSS1031: Expected selector, found '='
(333,9): run-time error CSS1025: Expected comma or open brace, found '='
(335,21): run-time error CSS1031: Expected selector, found '='
(335,21): run-time error CSS1025: Expected comma or open brace, found '='
(402,10): run-time error CSS1030: Expected identifier, found 'getElementById('
(402,10): run-time error CSS1031: Expected selector, found 'getElementById('
(402,10): run-time error CSS1025: Expected comma or open brace, found 'getElementById('
(404,2): run-time error CSS1019: Unexpected token, found ')'
(406,10): run-time error CSS1030: Expected identifier, found 'getElementById('
(406,10): run-time error CSS1031: Expected selector, found 'getElementById('
(406,10): run-time error CSS1025: Expected comma or open brace, found 'getElementById('
(408,2): run-time error CSS1019: Unexpected token, found ')'
(410,10): run-time error CSS1031: Expected selector, found 'autoloop('
(410,10): run-time error CSS1025: Expected comma or open brace, found 'autoloop('
(456,12): run-time error CSS1031: Expected selector, found '='
(456,12): run-time error CSS1025: Expected comma or open brace, found '='
(456,53): run-time error CSS1019: Unexpected token, found ','
(456,55): run-time error CSS1019: Unexpected token, found '1000'
(456,59): run-time error CSS1019: Unexpected token, found ')'
(458,1): run-time error CSS1019: Unexpected token, found '$'
(458,2): run-time error CSS1019: Unexpected token, found '('
(458,3): run-time error CSS1019: Unexpected token, found '"#imgmain_3d"'
(458,16): run-time error CSS1019: Unexpected token, found ')'
(458,18): run-time error CSS1030: Expected identifier, found 'mouseover('
(458,18): run-time error CSS1019: Unexpected token, found 'mouseover('
(458,37): run-time error CSS1031: Expected selector, found '('
(458,37): run-time error CSS1025: Expected comma or open brace, found '('
(460,2): run-time error CSS1019: Unexpected token, found ')'
(461,1): run-time error CSS1019: Unexpected token, found '$'
(461,2): run-time error CSS1019: Unexpected token, found '('
(461,3): run-time error CSS1019: Unexpected token, found '"#imgmain_3d"'
(461,16): run-time error CSS1019: Unexpected token, found ')'
(461,18): run-time error CSS1030: Expected identifier, found 'mouseout('
(461,18): run-time error CSS1019: Unexpected token, found 'mouseout('
(461,36): run-time error CSS1031: Expected selector, found '('
(461,36): run-time error CSS1025: Expected comma or open brace, found '('
(463,2): run-time error CSS1019: Unexpected token, found ')'
(466,13): run-time error CSS1031: Expected selector, found '='
(466,13): run-time error CSS1025: Expected comma or open brace, found '='
(467,18): run-time error CSS1031: Expected selector, found ';'
(467,18): run-time error CSS1025: Expected comma or open brace, found ';'
(468,12): run-time error CSS1031: Expected selector, found '='
(468,12): run-time error CSS1025: Expected comma or open brace, found '='
(469,12): run-time error CSS1031: Expected selector, found '='
(469,12): run-time error CSS1025: Expected comma or open brace, found '='
(471,10): run-time error CSS1031: Expected selector, found 'set_move_id('
(471,10): run-time error CSS1025: Expected comma or open brace, found 'set_move_id('
(484,10): run-time error CSS1030: Expected identifier, found 'addEventListener('
(484,10): run-time error CSS1031: Expected selector, found 'addEventListener('
(484,10): run-time error CSS1025: Expected comma or open brace, found 'addEventListener('
(486,2): run-time error CSS1019: Unexpected token, found ','
(486,8): run-time error CSS1031: Expected selector, found ')'
(486,8): run-time error CSS1025: Expected comma or open brace, found ')'
(488,10): run-time error CSS1030: Expected identifier, found 'addEventListener('
(488,10): run-time error CSS1031: Expected selector, found 'addEventListener('
(488,10): run-time error CSS1025: Expected comma or open brace, found 'addEventListener('
(500,2): run-time error CSS1019: Unexpected token, found ','
(500,8): run-time error CSS1031: Expected selector, found ')'
(500,8): run-time error CSS1025: Expected comma or open brace, found ')'
 */

$(document).ready(function () {
    document.getElementById("small_call").outerHTML = document.getElementById("small_call").outerHTML.replace("8801887900800", "8801931777444");
});

var previus_feature = "";

function GetProductDetails(bikeFeatureCode) {
    document.getElementById("left_context").innerHTML = document.getElementById("left_context").innerHTML.replace("active", "");
    $("#btn_" + bikeFeatureCode).addClass("active");
    document.getElementById("BikeFeatureCode").value = bikeFeatureCode;
    var productCode = document.getElementById("Code").value;

    var innerwidth = window.innerWidth;

    if (innerwidth <= 767) {
        if (previus_feature != "") {
            document.getElementById("details_" + previus_feature).innerHTML = "";
            document.getElementById("btn_" + previus_feature).innerHTML = document.getElementById("btn_" + previus_feature).innerHTML.replace("fa-minus", "fa-plus");
        }
    }

    $.ajax({
        type: "POST",
        url: "/BikeProduct/GetProductDetails",
        data: JSON.stringify({ productCode: productCode, bikeFeatureCode: bikeFeatureCode }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            var BikeSpecifications = data.BikeSpecifications;
            var BikeProductDetails = data.BikeProductDetails;
            $("#trProductDetailsBody").empty();
            $.each(BikeSpecifications, function (key, value) {
                var SpecificationName = "<td><div class='title'>" + value.Name + "</div></td>";
                var textContext = "";
                $.each(BikeProductDetails, function (key, valued) {
                    if (valued.BikeSpecificationCode == value.Code) {
                        textContext = "<td>" + valued.Details + "</td>";
                    }
                });
                var trData = "<tr>" + SpecificationName + textContext + "</tr>";
                $("#trProductDetailsBody").append(trData);
            });

            if (innerwidth <= 767) {
                if (bikeFeatureCode == previus_feature) {
                    document.getElementById("details_" + previus_feature).innerHTML = "";
                    document.getElementById("btn_" + bikeFeatureCode).innerHTML = document.getElementById("btn_" + bikeFeatureCode).innerHTML.replace("fa-minus", "fa-plus");
                    previus_feature = "";
                }
                else {
                    document.getElementById("details_" + bikeFeatureCode).innerHTML = document.getElementById("feature_right").outerHTML;
                    document.getElementById("btn_" + bikeFeatureCode).innerHTML = document.getElementById("btn_" + bikeFeatureCode).innerHTML.replace("fa-plus", "fa-minus");
                    previus_feature = bikeFeatureCode;
                }
            }
        },
        error: function (response) {
            alert_error("Failed !");
        }
    });
}

function goto_context(id) {
    $('html,body').animate({ scrollTop: $("#" + id).offset().top - 100 }, 'slow');
    $("#small_top_bar_product").hide(300);
}

function Get3DPhotoByProductAndColorCode(ColorCode, ProductCode) {
    document.getElementById("3d_layer").style.visibility = "visible";
    document.getElementById("imgmain_3d").style.pointerEvents = "none";
    clearInterval(_timer);
    $.ajax({
        type: "POST",
        url: "/BikeProduct/Get3DPhotoByProductAndColorCode",
        data: JSON.stringify({ ProductCode: ProductCode, ColorCode: ColorCode }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            $("#3d_image_context").empty();
            var p3dc = 1;
            var innerHtml = "";
            $.each(data, function (key, value) {
                if (p3dc == 1) {
                    document.getElementById("imgmain_3d").src = value.PhotoPath;
                    document.getElementById("color_name").innerText = value.Color.Name;
                }
                innerHtml += "<img src='" + value.PhotoPath + "' class='img-3d hidden' id='img_3d_" + p3dc + "' />";
                p3dc++;
            });
            $("#3d_image_context").append(innerHtml);
        }
    }).done(function () {
        _timer = setInterval(function () { autoloop(); }, 1000);
        document.getElementById("3d_layer").style.visibility = "hidden";
        document.getElementById("imgmain_3d").style.pointerEvents = "unset";
    });
}


function Set_3D_Photo_From_Load(ColorCode, BikeProductPhoto3D) {
    $.each(BikeProductPhoto3D, function (key, value) {
        if (ColorCode != value.ColorCode && value.Color.Status == "Active") {
            var img_3D = "<img src='" + value.PhotoPath + "' class='hidden' />";
            $("#3d_image_context").append(img_3D);
        }
    });
}

window.addEventListener('scroll', function () {
    var doc = document.documentElement;
    var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
    if (top > 100) {
        document.getElementById("product_top_bar").style.display = "inherit";
        document.getElementById("menu_top_bar").style.display = "none";
    }
    else {
        document.getElementById("product_top_bar").style.display = "none";
        document.getElementById("small_top_bar_product").style.display = "none";
        document.getElementById("menu_top_bar").style.display = "inherit";
    }
});
function show_hide_small_bar_product() {
    $("#small_top_bar_product").toggle(300);
}


var phsc = 1;
var prehphoto = 0;
var totalhslid = document.getElementsByClassName("top-banner").length;

function top_banner_move() {    
    if (totalhslid > 1) {
        prehphoto = phsc;
        phsc++;

        if (phsc >= totalhslid) {
            phsc = 0;
            document.getElementById("hpc_" + prehphoto).classList.remove("active2");
            document.getElementById("hpc_" + phsc).classList.remove("inactive2");
            document.getElementById("hpc_" + prehphoto).classList.remove("active");
            document.getElementById("hpc_" + prehphoto).classList.add("inactive");
            document.getElementById("hpc_" + phsc).classList.remove("inactive");
            document.getElementById("hpc_" + phsc).classList.add("active");

            document.getElementById("hpd_" + phsc).classList.remove("text-inactive");
            document.getElementById("hpd_" + phsc).classList.add("text-active");
            document.getElementById("hpd_" + prehphoto).classList.remove("text-active");
            document.getElementById("hpd_" + prehphoto).classList.add("text-inactive");
        }
        else {
            document.getElementById("hpc_" + prehphoto).classList.remove("hidden");
            document.getElementById("hpc_" + phsc).classList.remove("hidden");
            document.getElementById("hpc_" + prehphoto).classList.remove("active2");
            document.getElementById("hpc_" + phsc).classList.remove("inactive2");
            document.getElementById("hpc_" + prehphoto).classList.remove("active");
            document.getElementById("hpc_" + prehphoto).classList.add("inactive");
            document.getElementById("hpc_" + phsc).classList.remove("inactive");
            document.getElementById("hpc_" + phsc).classList.add("active");

            document.getElementById("hpd_" + phsc).classList.remove("text-inactive");
            document.getElementById("hpd_" + phsc).classList.add("text-active");
            document.getElementById("hpd_" + prehphoto).classList.remove("text-active");
            document.getElementById("hpd_" + prehphoto).classList.add("text-inactive");
        }
    }
}

function top_banner_previus() {
    if (totalhslid > 1) {
        prehphoto = phsc;
        phsc = phsc - 1;

        if (phsc < 0) {
            phsc = totalhslid - 1;
        }
        if (phsc >= totalhslid) {
            phsc = 0;
            document.getElementById("hpc_" + prehphoto).classList.remove("active");
            document.getElementById("hpc_" + phsc).classList.remove("inactive");
            document.getElementById("hpc_" + prehphoto).classList.remove("active2");
            document.getElementById("hpc_" + prehphoto).classList.add("inactive2");
            document.getElementById("hpc_" + phsc).classList.remove("inactive2");
            document.getElementById("hpc_" + phsc).classList.add("active2");

            document.getElementById("hpd_" + phsc).classList.remove("text-inactive");
            document.getElementById("hpd_" + phsc).classList.add("text-active");
            document.getElementById("hpd_" + prehphoto).classList.remove("text-active");
            document.getElementById("hpd_" + prehphoto).classList.add("text-inactive");
        }
        else {
            document.getElementById("hpc_" + prehphoto).classList.remove("hidden");
            document.getElementById("hpc_" + phsc).classList.remove("hidden");
            document.getElementById("hpc_" + prehphoto).classList.remove("active");
            document.getElementById("hpc_" + phsc).classList.remove("inactive");
            document.getElementById("hpc_" + prehphoto).classList.remove("active2");
            document.getElementById("hpc_" + prehphoto).classList.add("inactive2");
            document.getElementById("hpc_" + phsc).classList.remove("inactive2");
            document.getElementById("hpc_" + phsc).classList.add("active2");

            document.getElementById("hpd_" + phsc).classList.remove("text-inactive");
            document.getElementById("hpd_" + phsc).classList.add("text-active");
            document.getElementById("hpd_" + prehphoto).classList.remove("text-active");
            document.getElementById("hpd_" + prehphoto).classList.add("text-inactive");
        }
    }
}


var pmsc = 1;
var premphoto = 0;
var totalmslid = document.getElementsByClassName("image").length;

function mid_banner_move() {
    if (totalmslid > 1) {
        premphoto = pmsc;
        pmsc++;

        if (pmsc >= totalmslid) {
            pmsc = 0;
            document.getElementById("mpc_" + premphoto).classList.remove("active");
            document.getElementById("mpc_" + premphoto).classList.add("inactive");
            document.getElementById("mpc_" + pmsc).classList.remove("inactive");
            document.getElementById("mpc_" + pmsc).classList.add("active");
            document.getElementById("mpd_" + premphoto).classList.remove("textactive");
            document.getElementById("mpd_" + premphoto).classList.add("textinactive");
            document.getElementById("mpd_" + pmsc).classList.remove("textinactive");
            document.getElementById("mpd_" + pmsc).classList.add("textactive");
        }
        else {
            document.getElementById("mpc_" + premphoto).classList.remove("hidden");
            document.getElementById("mpc_" + pmsc).classList.remove("hidden");
            document.getElementById("mpc_" + premphoto).classList.remove("active");
            document.getElementById("mpc_" + premphoto).classList.add("inactive");
            document.getElementById("mpc_" + pmsc).classList.remove("inactive");
            document.getElementById("mpc_" + pmsc).classList.add("active");

            document.getElementById("mpd_" + premphoto).classList.remove("textactive");
            document.getElementById("mpd_" + premphoto).classList.add("textinactive");
            document.getElementById("mpd_" + pmsc).classList.remove("textinactive");
            document.getElementById("mpd_" + pmsc).classList.add("textactive");
        }
    }
}

function mid_banner_previus() {
    if (totalmslid > 1) {

        premphoto = pmsc;
        pmsc = pmsc - 1;

        if (pmsc < 0) {
            pmsc = totalmslid - 1;
        }

        if (pmsc >= totalmslid) {
            pmsc = 0;
            document.getElementById("mpc_" + premphoto).classList.remove("active");
            document.getElementById("mpc_" + premphoto).classList.add("inactive");
            document.getElementById("mpc_" + pmsc).classList.remove("inactive");
            document.getElementById("mpc_" + pmsc).classList.add("active");

            document.getElementById("mpd_" + premphoto).classList.remove("textactive");
            document.getElementById("mpd_" + premphoto).classList.add("textinactive");
            document.getElementById("mpd_" + pmsc).classList.remove("textinactive");
            document.getElementById("mpd_" + pmsc).classList.add("textactive");
        }
        else {
            document.getElementById("mpc_" + premphoto).classList.remove("hidden");
            document.getElementById("mpc_" + pmsc).classList.remove("hidden");
            document.getElementById("mpc_" + premphoto).classList.remove("active");
            document.getElementById("mpc_" + premphoto).classList.add("inactive");
            document.getElementById("mpc_" + pmsc).classList.remove("inactive");
            document.getElementById("mpc_" + pmsc).classList.add("active");

            document.getElementById("mpd_" + premphoto).classList.remove("textactive");
            document.getElementById("mpd_" + premphoto).classList.add("textinactive");
            document.getElementById("mpd_" + pmsc).classList.remove("textinactive");
            document.getElementById("mpd_" + pmsc).classList.add("textactive");
        }
    }
}

var timer_top_banner = setInterval(function () {
    top_banner_move();
}, 7000);

var timer_mid_banner = setInterval(function () {
    mid_banner_move();
}, 7000);

function previus_top_button() {
    top_banner_previus();
    clearInterval(timer_top_banner);
    timer_top_banner = false;
}
function next_top_button() {
    top_banner_move();
    clearInterval(timer_top_banner);
    timer_top_banner = false;
}

function previus_mid_button() {
    mid_banner_previus();
    clearInterval(timer_mid_banner);
    timer_mid_banner = false;
}
function next_mid_button() {
    mid_banner_move();
    clearInterval(timer_mid_banner);
    timer_mid_banner = false;
}

$(window).scroll(function () {
    if (!timer_top_banner) {
        clearInterval(timer_top_banner);
        timer_top_banner = setInterval(function () {
            top_banner_move();
        }, 7000);
    }
    if (!timer_mid_banner) {
        clearInterval(timer_mid_banner);
        timer_mid_banner = setInterval(function () {
            mid_banner_move();
        }, 7000);
    }
});


var direction = "";
var oldx = 0;
var img_index = 0;
var gap = 0;

var mousemovemethod = function (e) {
    total3dimage = document.getElementsByClassName("img-3d").length - 1;
    if (total3dimage <= 1) {
        return false;
    }
    if (total3dimage >= 1 && total3dimage <= 5) {
        gap = 40;
    }
    else if (total3dimage > 5 && total3dimage <= 10) {
        gap = 35;
    }
    else if (total3dimage > 10 && total3dimage <= 15) {
        gap = 30;
    }
    else if (total3dimage > 15 && total3dimage <= 20) {
        gap = 25;
    }
    else if (total3dimage > 20 && total3dimage <= 25) {
        gap = 20;
    }
    else if (total3dimage > 25 && total3dimage <= 30) {
        gap = 20;
    }
    else if (total3dimage > 30 && total3dimage <= 35) {
        gap = 20;
    }
    else if (total3dimage > 35 && total3dimage <= 40) {
        gap = 20;
    }
    else if (total3dimage > 40) {
        gap = 10;
    }
    if (total3dimage <= 0) {
        return false;
    }


    if (oldx == 0) {
        oldx = e.pageX;
    }

    if (e.pageX > (oldx + gap)) {
        img_index = img_index - 1;

        if (img_index < 1) {
            img_index = total3dimage;
        }
        if (img_index > total3dimage) {
            img_index = 1;
        }

        document.getElementById("imgmain_3d").src = document.getElementById("img_3d_" + img_index).src;
        oldx = e.pageX;
    } else if (e.pageX < (oldx - gap)) {
        img_index = img_index + 1;

        if (img_index < 1) {
            img_index = total3dimage;
        }
        if (img_index > total3dimage) {
            img_index = 1;
        }

        document.getElementById("imgmain_3d").src = document.getElementById("img_3d_" + img_index).src;
        oldx = e.pageX;
    }
}
document.getElementById("imgmain_3d").addEventListener("mousedown", function () {
    document.getElementById("imgmain_3d").addEventListener('mousemove', mousemovemethod);
});

document.getElementById("imgmain_3d").addEventListener("mouseup", function () {
    document.getElementById("imgmain_3d").removeEventListener("mousemove", mousemovemethod);
});

function autoloop() {
    total3dimage = document.getElementsByClassName("img-3d").length - 1;
    if (total3dimage <= 1) {
        return false;
    }
    if (total3dimage >= 1 && total3dimage <= 5) {
        gap = 40;
    }
    else if (total3dimage > 5 && total3dimage <= 10) {
        gap = 35;
    }
    else if (total3dimage > 10 && total3dimage <= 15) {
        gap = 30;
    }
    else if (total3dimage > 15 && total3dimage <= 20) {
        gap = 25;
    }
    else if (total3dimage > 20 && total3dimage <= 25) {
        gap = 20;
    }
    else if (total3dimage > 25 && total3dimage <= 30) {
        gap = 20;
    }
    else if (total3dimage > 30 && total3dimage <= 35) {
        gap = 20;
    }
    else if (total3dimage > 35 && total3dimage <= 40) {
        gap = 20;
    }
    else if (total3dimage > 40) {
        gap = 10;
    }
    if (total3dimage <= 0) {
        return false;
    }

    img_index = img_index + 1;
    if (img_index < 1) {
        img_index = total3dimage;
    }
    if (img_index > total3dimage) {
        img_index = 1;
    }
    document.getElementById("imgmain_3d").src = document.getElementById("img_3d_" + img_index).src;
}

var _timer = setInterval(function () { autoloop(); }, 1000);

$("#imgmain_3d").mouseover(function () {
    clearInterval(_timer);
});
$("#imgmain_3d").mouseout(function () {
    _timer = setInterval(function () { autoloop(); }, 1000);
});


var move_id = "mpdtxt_0";
var mousePosition;
var offset = [0, 0];
var isDown = false;

function set_move_id(id) {
    move_id = id;

    document.getElementById(move_id).addEventListener('mousedown', function (e) {
        isDown = true;
        offset = [
            document.getElementById(move_id).offsetLeft - e.clientX,
            document.getElementById(move_id).offsetTop - e.clientY
        ];
    }, true);
}


document.addEventListener('mouseup', function () {
    isDown = false;
}, true);

document.addEventListener('mousemove', function (event) {
    event.preventDefault();
    if (isDown) {
        mousePosition = {

            x: event.clientX,
            y: event.clientY

        };
        document.getElementById(move_id).style.left = (mousePosition.x + offset[0]) + 'px';
        document.getElementById(move_id).style.top = (mousePosition.y + offset[1]) + 'px';
    }
}, true);
