function deleteText(text,url) {
bootbox.confirm(text, function(result) {
if (result) location.href=url;
});
}
function deleteItem(url) {
deleteText("Bent u zeker?",url);
}
function capitaliseFirstLetter(string)
{
return string.charAt(0).toUpperCase() + string.slice(1);
}
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
function ccList(id, url, prepopulate) {
list[id] = { };
$("#"+id).tokenInput(url, {
theme: "facebook",
hintText: "CC toevoegen.",
noResultsText: "Niet gevonden.",
searchingText: "Zoeken...",
onAdd: function (item) {
list[id][item.id] = item.id;
setList(id);
},
onDelete: function (item) {
delete list[id][item.id];
setList(id);
},
prePopulate: prepopulate,
resultsFormatter: function(item){ return "
" + "" + item.name + "
" + item.email + "
" },
});
}
function ccListParticipants(id, url, prepopulate) {
list[id] = {};
$("#"+id).tokenInput(url, {
theme: "facebook",
hintText: "CC toevoegen.",
noResultsText: "Niet gevonden.",
searchingText: "Zoeken...",
onAdd: function (item) {
list[id][item.id + "::" + item.type] = item.id + "::" + item.type;
setList(id);
},
onDelete: function (item) {
delete list[id][item.id + "::" + item.type];
setList(id);
},
prePopulate: prepopulate,
resultsFormatter: function(item){
//var color = "style='background-color: #18ab18'";
var color = "";
if (item.type == "dep"){
return "" + ""
}
else{
return "" + "" + item.name + "
" + item.email + "
"
}
},
tokenFormatter: function(item){
if (item.type == "dep"){
return "" + item.name + "
";
} else return "" + item.name + "
";
}
});
}
function setList(id) {
$("#"+id+"List").val(JSON.stringify(list[id]));
}
function makeFixedAction(form) {
scrollAction(form);
$(window).scroll(function() {
scrollAction(form);
});
}
function scrollAction(form) {
t = $(form).offset();
t = (t.top+180);
s = $(window).scrollTop();
d = t-s;
if (d >= 0) {
$(form+" .form-fixed").addClass('fixed');
}else{
$(form+" .form-fixed").removeClass('fixed');
}
}
function makeFixedModalAction(form) {
makeFixedAction(form);
/*$(".modal-scrollable").scroll(function() {
t = $(form).offset();
t = t.top;
s = $(".modal-scrollable").scrollTop();
d = t-s;
if (d >= 0) {
$(form+" .form-actions").addClass('fixed');
}else{
$(form+" .form-actions").removeClass('fixed');
}
});*/
}
$(window).scroll(function(){
$(".form-action-float").stop().animate({"bottom": -($(window).scrollTop()-($(window).height()*0.5)) + "px"}, "slow" );
});