var type = "";
var ajax_library= new sack();

function postAddLibraryCompleted(){    
     location.href = "/members/library/?v="+type + "&a=add";
}

function postRemoveLibraryCompleted(){    
     location.href = "/members/library/?v="+type + "&a=remove";
}

function doPostStoryLibrary(id, ptype) {

    type = ptype;	
    ajax_library.setVar("a", "add");
    ajax_library.setVar("p", id);
    ajax_library.setVar("v", ptype);
    ajax_library.requestFile = "/members/library/updateStory.htm";
    ajax_library.method = "GET";
    ajax_library.onCompletion = postAddLibraryCompleted;
    ajax_library.runAJAX();

}

function doPostDownloadLibrary(id, ptype) {

    type = ptype;	
    ajax_library.setVar("a", "add");
    ajax_library.setVar("p", id);
    ajax_library.setVar("v", ptype);
    ajax_library.requestFile = "/members/library/updateSoftware.htm";
    ajax_library.method = "GET";
    ajax_library.onCompletion = postAddLibraryCompleted;
    ajax_library.runAJAX();

}

function doRemoveLibrary(id, ptype) {
    type = ptype;	
    ajax_library.setVar("a", "remove");
    ajax_library.setVar("p", id);
    ajax_library.setVar("v", ptype);
    if(ptype == "hardware" || ptype == "software" || ptype == "itlibrary" || ptype == "jobs") {
        ajax_library.requestFile = "/members/library/updateProduct.htm";
    }
    else if(ptype == "downloads") {
        ajax_library.requestFile = "/members/library/updateSoftware.htm";
    }
    else {
        ajax_library.requestFile = "/members/library/updateStory.htm";
    }
    ajax_library.method = "GET";
    ajax_library.onCompletion = postRemoveLibraryCompleted;
    ajax_library.runAJAX();
}