jQuery(document).ready(function(){
	var urlParams = {};
	(function () {
		var e,
			a = /\+/g,  // Regex for replacing addition symbol with a space
			r = /([^&=]+)=?([^&]*)/g,
			d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
			q = window.location.search.substring(1);
	
		while (e = r.exec(q))
		   urlParams[d(e[1])] = d(e[2]);
	})();
	
	jQuery.cookie = function(name, value, options) {
		if (typeof value != 'undefined') { // name and value given, set cookie
			options = options || {};
			if (value === null) {
				value = '';
				options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
				var date;
				if (typeof options.expires == 'number') {
					date = new Date();
					date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
				} else {
					date = options.expires;
				}
				expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
			}
			// CAUTION: Needed to parenthesize options.path and options.domain
			// in the following expressions, otherwise they evaluate to undefined
			// in the packed version for some reason...
			var path = options.path ? '; path=' + (options.path) : '';
			var domain = options.domain ? '; domain=' + (options.domain) : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		} else { // only name given, get cookie
			var cookieValue = null;
			if (document.cookie && document.cookie != '') {
				var cookies = document.cookie.split(';');
				for (var i = 0; i < cookies.length; i++) {
					var cookie = jQuery.trim(cookies[i]);
					// Does this cookie string begin with the name we want?
					if (cookie.substring(0, name.length + 1) == (name + '=')) {
						cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
						break;
					}
				}
			}
			return cookieValue;
		}
	};
	
	if ($.cookie('utm_source') == "Adwords+CPC" || $.cookie('utm_source') == 'Adwords CPC' || urlParams['utm_source'] == 'Adwords+CPC' || urlParams['utm_source'] == 'Adwords CPC') {
		$.cookie('utm_source','Adwords CPC');
		$('.TollFreePPC').html('877-891-7787');
		$('.PhonePPC').html('617-506-3775');
		$('#tagline a').html('<img src="http://www.jeffreysglassman.com/images/h2_for_PPC.png" />');
		$('#tagline a').css('z-index','1').css('position','absolute');
		$('#tagline a img').css('marginTop','-108px').css('z-index','100').css('position','relative');
	}
});

