﻿var jsonweburl = "http://1.a.rompy.cn"; 
jsonweburl = "http://center.rompy.cn";

$(document).ready(function () {
   
    var rtnstr = '';
    $.getJSON(jsonweburl + "/rompycenter/handler/yby_getInfo.ashx?flag=2&&format=json&&jsoncallback=?", function (data) {
        //获取JSON对象中的实体，并填充表单
        //i索引  第2个是对象
        $.each(data, function (i) {
            rtnstr += "<li><a href='"+jsonweburl+"/rompycenter/xiangcedetail.aspx?wsn="+data[i].Sn+"&&sn="+data[i].Shopsn+"'><img src='" + jsonweburl + "/images/rompycenter/" + data[i].Defaultpic + "' title='" + "【" + data[i].Shopname + "】" + data[i].Stitle + "' style='cursor:pointer;border: 0px; width: 150px; height: 150px' /></a></li>";
        });
        if (rtnstr == "") {
            $("#photo").html("暂无相册");
        } else {
            $("#photo").html("<ul id='mycarousel' class='jcarousel-skin-tango'>" + rtnstr + "</ul>");
            $('#mycarousel').jcarousel({
                auto: 2,
                wrap: 'last',
                initCallback: mycarousel_initCallback
            });
        }
    });
    
});

function mycarousel_initCallback(carousel) {
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function () {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function () {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function () {
        carousel.stopAuto();
    }, function () {
        carousel.startAuto();
    });
};
