function Push_in(obj, way) {

    if (window.ActiveXObject) {
        xh = new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
        xh = new XMLHttpRequest();
    }

    xhurl = "search_spot.php?type=" + obj + "&way=" + way + "&date= " + new Date().getTime();
    xh.open("get", xhurl, false);
    xh.send(null);
    if (xh && xh.responseText) {
        var aaa = xh.responseText;
    }

}
function insertdb(obj, id, name, contact_no, hkid, email) {
    if (window.ActiveXObject) {
        xh = new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
        xh = new XMLHttpRequest();
    }
    xhurl = "promotion_insertdb.php?cart_id=" + obj + "&id=" + id + "&name=" + name + "&contact_no=" + contact_no + "&hkid=" + hkid + "&email=" + email;
    xh.open("get", xhurl, false);
    xh.send(null);

}

function del(obj) {
    if (window.ActiveXObject) {
        xh = new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
        xh = new XMLHttpRequest();
    }
    xhurl = "search_spot.php?type=" + obj + "&way=del";
    xh.open("get", xhurl, false);
    xh.send(null);

}

function click_change(obj, n) {
    var spotarray = new Array();
    var add_spot = eval("document.getElementById('add_" + obj + "')");
    var del_spot = eval("document.getElementById('del_" + obj + "')");
    var myspot = getCookie('_myspot');
    // alert(myspot);
    if (myspot) {
        spotarray = myspot.split('|');
    }
    if (spotarray.length < 300) {
        if (n == 1) {
            add_spot.style.display = "none";
            del_spot.style.display = '';
            Push_in(obj, 1);
        }
        if (n == 0) {
            add_spot.style.display = '';
            del_spot.style.display = "none";
            Push_in(obj, 0);
        }

        /* no. of spot */

        if (getCookie('spot')) {
            spotarray = getCookie('spot').split('|');
            document.getElementById('myspot').innerHTML = "(" + spotarray.length + ")";
        }
        else document.getElementById('myspot').innerHTML = "(0)";

    }
    else {
        alert("你已bookmark多於 300 個景點");
    }
}