/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function shortlist()
{
	this.insertObject = "#shortlist ol";
	this.maxLength = 5;
	this.remoteurl = "";
}

shortlist.prototype.setRemoteUrl = function(remoteUrl)
{
	this.remoteurl = remoteUrl;
}

shortlist.prototype.refresh = function()
{
    $(this.insertObject).load(this.remoteurl + "/jobs/shortlist", function(){
       if($(this).find("li").size()==0)
           $(this).parent().hide();
       else
           $(this).parent().show();
    });
}
shortlist.prototype.add = function(jid){
    var shortlist = this;
    $.get(shortlist.remoteurl + "/jobs/addtoshortlist/jid/" + jid,function(data){
        //alert(shortlist.remoteurl + "/jobs/addtoshortlist/jid/" + jid);
    });
    //shortlist.refresh();
    
}
shortlist.prototype.remove = function(object){
    var jid = $(object).attr('jobid');
    $.get(this.remoteurl + "/jobs/removeshortlist/jid/" + jid,function(data){
        //alert(data);
    });
    $(object).parent().remove();
    //shortlist.refresh();
    return false;
}
shortlist.prototype.removeById = function(id){
    var jid = id;
    $.get(this.remoteurl + "/jobs/removeshortlist/jid/" + jid,function(data){
        //alert(data);
    });
}
