jQuery.cookie = function( name, value, options ){
   var settings = {
      days: 360,
      path: '/'
   };
   if(options){ jQuery.extend(settings, options); };
   
   var action = value ? 'set' : 'get';
   if( action == 'get' ){
      name = name + '=';
      var cookies = document.cookie.split('; ');
      for( var i=0; i<cookies.length; i++ ){
         if ( cookies[i].indexOf(name) == 0 ){ return cookies[i].substring(name.length, cookies[i].length); };
      }
      return null;
   }
   else if( action == 'set' ){
      var date = new Date();
      date.setTime(date.getTime()+(settings.days *24*60*60*1000));
      var expires = '; expires=' + date.toGMTString();
      document.cookie = name + '=' + value + expires + '; path=' + settings.path ;
   }
};
