//Execute the Query.
$(document).ready(function(){
// Get the value of the checkbox
if ($('input[name="NewDepartment"]:checked').val() == "true")
{
boolAutoApprove = true;
}
else
{
boolAutoApprove = false;
}
// When checkbox is clicked, set or unset the value of the Department field
$("input[id ^= 'NewDepartment']").change(function(){
boolAutoApprove = !boolAutoApprove;
if (boolAutoApprove)
{
$("div[title='Department']").children().prop("contenteditable",false).css('background-color','#E0E0E0');
$("div[title='Department']").parent().find('img').hide();
$("div[title='Department']").children().html("New Department");
}
else
{
$("div[title='Department']").children().prop("contenteditable",true).css('background-color','#FFFFFF');
$("div[title='Department']").parent().find('img').show();
$(".ms-taxonomy-writeableregion").html("");
}
});
});