/*!
 * jQuery.Utils Extension
 * Adds jQuery.Utils.Cookie { Set,Get,Delete } Methods
 * Version 1.0.0
 *
 * Copyright © 2009,2010 Cape Fear Webmasters, Inc.
 * http://www.cfwebmasters.com/
 *
 * Usage:
 * -SET THE VALUE OF A COOKIE
 * 		var args={
 *			Encode:true,
 *			Expires:7,
 *			Path:'/',
 *			Domain:'www.cfwebmasters.com',
 *			Secure:false
 * 		}
 * 		jQuery.Utils.Cookie.Set('Name','Value',args);
 *
 * -GET THE VALUE OF A COOKIE BY NAME
 *		var decode=true; //Whether or not the value of the cookie should be URI Decoded.  Default is true;
 *		jQuery.Utils.Cookie.Get('Name',decode);
 *
 * -DELETE A COOKIE BY NAME
 * 		var args={
 *			Path:'/',
 *			Domain:'www.cfwebmasters.com'
 *		}
 *		jQuery.Utils.Cookie.Delete('Name',args)
 *
 * Notes:
 * All arguments are optional, and may be passed as an object literal rather than a declared variable object. 
 * Defaults (unless otherwise overwridden by the provided args object) are:
 *		Encode: true, 	//(boolean true|false) - URI Encode the value of the cookie
 *		Expires: 7,		//(integer) - Number (of days) from today's date until cookie expires.  Must be positive integer (or null to expire at end of session).
 *		Path: '/',		//(string) - Path of cookie.  Default is site root.
 *		Domain: '',		//(string) - Domain of cookie.  Default is no domain.
 *		Secure: false	//(boolean true|false) - Determines whether https:// protocol is required to read cookie.
 */
;(function($){$.extend({Utils:{Cookie:{Set:function(k,v,args){var dd=0,dt=null,ri=[];if((typeof k==='string'&&k.length>0)&&(typeof v!=='undefined'&&v!==null)){args=jQuery.extend({Encode:true,Expires:7,Path:'/',Domain:'',Secure:false},args);if(typeof args.Expires==='number'&&args.Expires!==0){dd=args.Expires;dt=args.Expires=new Date();dt.setDate(dt.getDate()+dd);}else{args.Expires=null;}ri.push(args.Encode?encodeURIComponent(String(v)):String(v));if(args.Expires!==null){ri.push('expires='+args.Expires.toUTCString());}if(typeof args.Path==='string'&&args.Path!==''){ri.push('path='+args.Path);}if(typeof args.Domain==='string'&&args.Domain!==''){ri.push('domain='+args.Domain);}if(typeof args.Secure==='boolean'&&args.Secure===true){ri.push('secure');}document.cookie=[encodeURIComponent(k),'=',ri.join(';')].join('');}},Get:function(k,args){var ri=null,decode=(typeof(args)==='undefined')?true:(typeof(args)==='boolean')?args:false;if(typeof(k)==='string'&&k.length>0){ri=new RegExp('(?:^|; )' + encodeURIComponent(k) + '=([^;]*)').exec(document.cookie);if(ri!==null){if(decode){ri=decodeURIComponent(ri[1]);}else{ri=ri[1];}}}return ri;},Delete:function(k,args){args=jQuery.extend({Expires:-1},args);jQuery.Utils.Cookie.Set(k,'',args);}}}});})(jQuery);
