var library_type = ""; 

function toggleAddProduct() {
  if(document.getElementById("share_this").style.display == "none") {
    document.getElementById("share_this").style.display = "block";
  }
  else {
    document.getElementById("share_this").style.display = "none";
  }
    
  //var left = findPosX(document.getElementById("share_img")); 
  //document.getElementById("bm-main").style.left = (left - 270) + "px";
}
var ajax_tag= new sack();
var type = "";

function postProductLoading(){
    var e = document.getElementById('bm-link');
    e.style.display="inline";
    e.innerHTML = "<strong>Saving product...</strong>";
}

function postProductCompleted(){
    var e = document.getElementById('bm-link');
     e.innerHTML = "<font style='font-size: 8pt'><strong>Product added.</strong><br />Click <a href='/members/libary/?v=" + type + "'>here</a> to see your product list</font>";
}

function doPostProduct(id, ptype) {
    type = ptype;		
    ajax_tag.setVar("a", "add");
    ajax_tag.setVar("p", id);
    ajax_tag.setVar("v", ptype);
    ajax_tag.setVar("src", "ajax");
    ajax_tag.requestFile = "/members/library/updateProduct.htm";
    ajax_tag.method = "GET";
    ajax_tag.onLoading = postProductLoading;
    ajax_tag.onCompletion = postProductCompleted;
    ajax_tag.runAJAX();
}

function postLibraryCompleted(){    
     location.href = "/members/library/?v=" + library_type + "&a=add";
}

function doPostLibrary(id, ptype) {

    library_type = ptype;	
    ajax_tag.setVar("a", "add");
    ajax_tag.setVar("p", id);
    ajax_tag.setVar("v", ptype);
    ajax_tag.requestFile = "/members/library/updateProduct.htm";
    ajax_tag.method = "GET";
    ajax_tag.onCompletion = postLibraryCompleted;
    ajax_tag.runAJAX();

}