Currently i have this:
$(".splitCol").click(function () {
$.cookie('whichColumn', 'split');
$(".threeCol .active").removeClass("active");
$(".leftCol .active").removeClass("active");
$(".splitCol span").addClass("active");
$(".threeColumns li:eq(3)").removeClass("first");
$(".threeColumns li:eq(6)").removeClass("first");
$(".entries").removeClass("threeColumns");
$(".entries").removeClass("leftColumn");
$(".entries").addClass("splitColumns");
$(".splitColumns li:eq(2)").addClass("first");
$(".splitColumns li:eq(4)").addClass("first");
$(".splitColumns li:eq(6)").addClass("first");
$(".splitColumns li:eq(8)").css("display", "none");
});
And i need to repeat all those commands again after i do an if check. How can i take all those and add them to a single function so that if you $(".splitCol").click(function () { then it runs the function. And then also if the IF statement is satisfied it runs it as well?