function getLayerLeft(layer) {
    if (layer.pageX) return layer.pageX;
    if (layer.style.left) return parseInt(layer.style.left);
    return -1;
}