Deleting Style switcher cookie

Deleting Style switcher cookie

Hi I want to add to this style switcher (below code) one extra function var but don't know how or where to insert it. The code works great by switching between 2 sylesheet wide.css and boxed.css. 

I want to add to it that when any stylesheet is selected.. a cookie name "bg_pattern" reset or removed. I have that cookie being stored by another script for the page background pattern. So basically I want the use to have the background pattern gone when they switch page width.

Code:

  1. function getCookie(css_width)
  2.     {
  3.     if (document.cookie.length>0)
  4.     {
  5.     c_start=document.cookie.indexOf(css_width + "=");
  6.     if (c_start!=-1)
  7.     {
  8.     c_start=c_start + css_width.length+1;
  9.     c_end=document.cookie.indexOf(";",c_start);
  10.     if (c_end==-1) c_end=document.cookie.length;
  11.     return unescape(document.cookie.substring(c_start,c_end));
  12.     }
  13.     }
  14.     return "";
  15.     }

  16.     function setCookie(css_width,value,expiredays)
  17.     {
  18.     var exdate=new Date();
  19.     exdate.setDate(exdate.getDate()+expiredays);
  20.     document.cookie=css_width+ "=" +escape(value)+
  21.     ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  22.     }


  23.     $(document).ready(function() {

  24.     // Wide
  25.     $("#css-wide").click(function() {
  26.     $("link.css-width[rel=stylesheet]").attr({href : "css/wide.css"});
  27.     setCookie('csspref', 'wide');
  28.     });

  29.     // Boxed
  30.     $("#css-boxed").click(function() {
  31.     $("link.css-width[rel=stylesheet]").attr({href : "css/boxed.css"});
  32.     setCookie('csspref', 'boxed');
  33.     });

  34.     var $cssPref = getCookie('csspref');
  35.     if ($cssPref.length > 0)
  36.     {
  37.     $('#css-' + $cssPref).trigger('click');
  38.     }

  39.     });