$(document).ready(function() {
    //$(document).ready(function() 
    $(".treeone").each(function(i) {
        $(".treeone").eq(i).bind("click", function() {

            /*start*/
            var imgid = "";
            if ($(".treeone").get(i).id != "")
                imgid = $(".treeone").get(i).id;
            var id = imgid.substring(3, imgid.length);
            var cityid = "#province" + id;

            //toggle
            $(cityid).toggleClass("twocityadd");

            //tu pian toggle
            src = document.getElementById(imgid).src;

            if (src.indexOf("images/tree/jia.gif") > 0 || src.indexOf("images/tree/jia.gif") > 0) {
                document.getElementById(imgid).src = "images/tree/jian.gif";
                //start city
                var html = $(cityid).html();
                if (html.length < 100)
                    Citydadd(id, cityid);
                //city finish
            }
            else {
                document.getElementById(imgid).src = "images/tree/jia.gif";
            }
            /* finish */

        });

    });
});

function Citydadd(p1,did) {
    //start city
    //City.aspx Response.Charset="gb2312"
    $(did).html("\u6b63\u5728\u8f7d\u5165\u6570\u636e\u2026\u2026");
    $.ajax({
        type: "POST",
        url: "jquery/City.aspx",
        dataType: "html",
        data: { "p": "" + p1 + "" }, 
        success: function(html) {
        if (html != "0") {
                $(did).html(html);        
          }
        }, error: function(html) { alert("error-$.ajax"); }
    });
    //start city finish
}