/*!
 * jQuery UI 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();
b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,
"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,
outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b);
return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
 * jQuery UI Tabs 1.8.14
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.14"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
;
/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
// Initialize jQuery in No Conflict mode and set up the AARPHealthcare object.

var $j = jQuery.noConflict();

$j(document).ready(function(){
	$j('a#email').click( function() {
		Logger.startGroup("Email a Friend",Logger.LEVEL_DEBUG);
		Logger.debug("Email a friend clicked.");
		modelBox.email();
		Logger.endGroup(Logger.LEVEL_DEBUG);
	});
	
	//external selector is defined in modelbox.js :)
	$j('a:external').bind('click.external', (function(){
		displayDisclaimerForceSourceCode(this.href,"6NT");return false;
	}));//sync this with gatracking external quicklink
	
	var span = $j('span.sourcecode');
	if (typeof span != 'undefined' && span != null && span.length > 0) {
		fixTrackingSourcecode(span);
	}

	var fieldHidden = $j('#request_information_form input[name="requestInfoSourceCode"]');
	if ( typeof fieldHidden != 'undefined' && fieldHidden != null && fieldHidden.length > 0 ) {
		fixFormTrackingSourcecode(fieldHidden);
	}

	AARPHealthcare.init();
});

function fixTrackingSourcecode(span) {
	var srccode = $j.cookie('AHCSourceCode');
	if (typeof srccode != 'undefined' && srccode != null && srccode.length > 0) {
		span.html(srccode);
	}
}

function fixFormTrackingSourcecode(fieldHidden) {
	var srccode = $j.cookie('AHCSourceCode');
	if (typeof srccode != 'undefined' && srccode != null && srccode.length > 0) {
		fieldHidden.val(srccode);
	}
}

AARPHealthcare = (function() {
	function init() {
		Logger.logLevel(Logger.LEVEL_DEBUG);
		// Try to initialize other AARPHealthcare Objects
		try {
			Logger.startGroup("AARPHealthcare.init",Logger.LEVEL_DEBUG);
			Logger.debug("Initializing AARPHealthcare Widget Objects.");
			AARPHealthcare.Billboard.init();
			AARPHealthcare.ContentBox.init();
			AARPHealthcare.Navigation.init();
			AARPHealthcare.TabModule.init();
			AARPHealthcare.EmailPage.init();
			AARPHealthcare.RequestInformation.init();
			Logger.endGroup(Logger.LEVEL_DEBUG);
		}//try
		catch(err) {
			Logger.error(err);
		}//catch
	}//init
	
	return {
		init: init
	};
})();

function clearText(field){
	if (field.defaultValue == field.value) 
		field.value = '';
	else if (field.value == '') 
		field.value = field.defaultValue;
	}
Logger = (function() {
	var DEBUG = 1;
	var INFO  = 2;
	var WARN  = 3;
	var ERROR = 4;
	var log_level = ERROR;
	
	function debug(msg) {
		doLog(DEBUG,arguments);
	}//debug(msg)
	
	function info(msg) {
		doLog(INFO,arguments);
	}//info(msg)
	
	function warn(msg) {
		doLog(WARN,arguments);
	}//warn(msg)
	
	function error(msg) {
		doLog(ERROR,arguments);
	}//error(msg)
		
	function doLog(level,args) {
		//Only log if the overall level is set to a level less-than or equal to the level being requested.
		if(log_level <= level) {
			var msg = (typeof args[0] == "undefined") ? "" : ((typeof args[0] == "object") ? (args[0]).toString() : args[0]);
			if(args.length > 1) {			
				// Look to do some string substitution in the message.
				for(var i=2;i <= args.length; i++) {
					msg = msg.replace("{}",(typeof args[i-1] == "object") ? (args[i-1]).toString() : args[i-1]);
				}//for					
			}//if
			
			var levelStr = "";
			if(level == DEBUG) {
				levelStr = "debug";
			}//if
			else if(level == INFO) {
				levelStr = "info";
			}//else if
			else if(level == WARN) {
				levelStr = "warn";
			}//else if
			else if(level == ERROR) {
				levelStr = "error";
			}//else if
		
			try {
				console[levelStr](msg);
			}//try
			catch(err) { 
				//Try plain console.log as a final effort.
				try {
					console.log(msg);
				}//try
				catch(err) {
					//Do nothing.
				}//catch
			}//catch
		}//if
	}//doLog
	
	function startGroup(groupName,level) {
		try {
			if(log_level <= level || (typeof level == "undefined")) {
				console.group(groupName);
			}//if
		}//try
		catch(err) {}
	}//startGroup
	
	function endGroup(level) {
		try {
			if(log_level <= level || (typeof level == "undefined")) {
				console.groupEnd();
			}//if
		}//try
		catch(err) {}
	}//endGroup
	
	function logLevel(level) {
		if(typeof level == "number") {
			if(level == ERROR) {
				log_level = ERROR;
			}//if
			else if(level == WARN) {
				log_level = WARN;
			}//else if
			else if(level == INFO) {
				log_level = INFO;
			}//else if
			else if(level == DEBUG) {
				log_level = DEBUG;
			}//else if
		}//if
		else if(typeof level == "string") {
			if(level.toUpperCase() == "ERROR") {
				log_level = ERROR;
			}//if
			else if(level.toUpperCase() == "WARN") {
				log_level = WARN;
			}//else if
			else if(level.toUpperCase() == "INFO") {
				log_level = INFO;
			}//else if
			else if(level.toUpperCase() == "DEBUG") {
				log_level = DEBUG;
			}//else if
		}//else if
		else if(typeof level == "undefined") {
			return log_level;
		}//else if
	}//logLevel(level)
		
	return {
		LEVEL_DEBUG: DEBUG,
		LEVEL_INFO : INFO,
		LEVEL_WARN : WARN,
		LEVEL_ERROR: ERROR,
		debug: debug,
		info: info,
		warn: warn,
		error: error,
		startGroup: startGroup,
		endGroup: endGroup,
		logLevel: logLevel
	};
})();

var externalSiteLink, defaultSourceCode = '';
var overrideSourceCode = null;
var useXOver = true;

var oldMembershipNumberWidth = null;

$j.ajaxSetup({cache: false});


//Creating custom :external selector
$j.expr[':'].external = function(obj){
    //return (obj.hostname != location.hostname);
    //ignore email links and use regexp for ie6 compatibility
    return (!obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname));
};

$j.expr[':'].external2 = function(obj){
    return (typeof obj.href != 'undefined' && !obj.href.match(/^mailto\:/) && !obj.href.match(/^javascript/) && (obj.hostname != location.hostname));
};


// Modelbox Window Functionality
var docpath='';
var modelBox = 
{
    init: function (){
        $j(".modelBox").click(function() {
            var popupdivId = "#" + this.id + "_box";
            modelBox.loadPopup(popupdivId);
        });     
    },
    
    getContent:function(docPath, func){
        docpath = docPath;
        $j('#modelwindow').empty().load(docPath, function() {
            modelBox.loadPopup('#modelContent');
            if (typeof func != 'undefined' && func != null) {               
                func();
            }//if           
        });
        return false;
    },
    
    getContentFrame:function(docPath, func){
        docpath = docPath;
        Logger.startGroup("Modal iframe",Logger.LEVEL_DEBUG);
        $j('#modelwindow').replaceWith('<iframe id="modelwindow" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:775px; height:0;" allowTransparency="true" />');
        $j('#modelwindow').attr('src', window.location.protocol + '//' + window.location.host + docPath);
        $j('#modelwindow').bind('load', function() 
            {
                $j(this).css('width', '775px');
                var $mf = $j(this).contents();
                var $body = $j(this, window.top.document).contents().find('body');
                $body.css('background', 'none')
                                .css('filter', 'none');
                $body.find('#email_a_friend_currentURL').val(window.location.href);
                $body.find('#email_a_friend_pageTitle').val(document.title);

                var newHeight = $body[0].scrollHeight; // + 50;
                if ($j.browser.mozilla) { newHeight += 50;}
                this.style.height = newHeight + 'px';
                //$j(this).height($mf.find('body')[0].scrollHeight+75);
                Logger.debug('Frame Loaded & Sized:' + newHeight);
                //Logger.debug( $mf.find('html').height+'px');
                $mf.find('.mod_close, .modalclose, .form_button_cancel, a.close').each( function(ndx) {
                    $j(this).bind('click', function (e)
                    {
                        e.preventDefault();
                        $j(parent.document).trigger(modelBox.popupClose('#modelContent'));                        
                    });
                });
                modelBox.centerPopup("#modelContent");
            });
        Logger.debug($j('#modelwindow').length);
            
            modelBox.loadPopup('#modelContent');
            if (typeof func != 'undefined' && func != null) {               
                func();
            }//if           
        Logger.endGroup(Logger.LEVEL_DEBUG);
        return false;
    },
    
    loadPopup: function (id) {
        // Remove the action wrap clone if it has previously existed.
        if($j(id + " .form_action_wrap").length > 0) {
            $j(id + " .form_action_wrap").detach();
        }//if
        var scrollWid = modelBox.calScrollbarWidth();
        var hgt = $j(document).height();
        var wid = $j(document).width();
        $j("#cover").css({"opacity": "0.4", "height": hgt, "width": (wid - scrollWid), "background-color": "#fff"}); 
        //$j("#cover").bgiframe().fadeIn("slow");
        //$j("#cover").fadeIn("slow");
        $j(id).css({"z-index": "9999","position": "absolute"}).fadeIn("medium");
        modelBox.centerPopup(id);
    },
    
    email: function(){
        var path = '/content/aarphealthcare/home/email-a-friend.html?wcmmode=disabled' +
                   '&url=' + escape(document.URL) + '&title=' + escape(document.title);
        modelBox.getContentFrame(path);
    },
    
    calScrollbarWidth: function () { 
        var div = $j('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>'); 
        // Append our div, do our calculation and then remove it 
        $j('body').append(div); 
        var w1 = $j('div', div).innerWidth(); 
        div.css('overflow-y', 'scroll'); 
        var w2 = $j('div', div).innerWidth(); 
        $j(div).remove(); 
        return (w1 - w2); 
    },

    popupClose: function (id) {
        $j(id).fadeOut();
        $j("#cover").fadeOut(); 
        $j('#modelwindow').replaceWith('<div id="modelwindow"></div>');
    },
    
    centerPopup: function (id) {
        var windowWidth = $j(window).width();
        var windowHeight = $j(window).height();
        var popupHeight = $j(id).height();
        var popupWidth = $j(id).width();
        var dsocleft = $j(window).scrollLeft();
        var dsoctop = $j(window).scrollTop();
        var left = windowWidth/2+dsocleft-popupWidth/2;
        var top = windowHeight/2+dsoctop-popupHeight/2;
        /* top = (($(window).scrollTop() >= ($(document).height()/4)) || (top < 100)) ? 100 : top; */
        top = (top < 0) ? 3 : top;
        $j(id).css({"top": top, "left": left});
        if(docpath == "/publisher/aarphealth/aarp_membership_number.html")
        {   
            var offset = $j(".tooltip").offset();
            $j(id).css({"top": (offset.top-335), "left": (offset.left-250)});
        }
    }
}

function displayDisclaimerForceSourceCode(toURL, forceSourceCode) {
    //** Jason identified that the URL regexes should be case insensitive
    //** so we added the switch to do that
    //**
    externalSiteLink = toURL;
    if (externalSiteLink.match(/(\/|\.)aarpmedicareplans\.com/i)) {
        overrideSourceCode = "810107"
    }  
    if (externalSiteLink.match(/(\/|\.)myhospitalplan\.com/i)) {
        overrideSourceCode = "6NX"
    }  
    if (typeof overrideSourceCode != 'undefined' && overrideSourceCode != null && overrideSourceCode != 'null') {
        useXOver = false;
    } else {
        defaultSourceCode = forceSourceCode;
    }
    //alert("toURL: " + toURL + "  forceSourceCode: " + forceSourceCode);
    if (externalSiteLink.match(/(\/|\.)aarp\.org/i)) {
        goToExternalSite();
    }//if
    else {
        modelBox.getContent("/content/aarphealthcare/home/leaving/jcr:content/par.html");
    }//else 
}

function getTargetUrlWithSourcecode(){
    var targetURL = externalSiteLink;
    var concatChar = "?";
    (targetURL.indexOf("?") >0 ) ? concatChar = "&" : concatChar = "?";

    if (defaultSourceCode != 'genworth') {
        var sourcecode = getSourceCode();
        
        if (typeof sourcecode != 'undefined' && sourcecode != null && sourcecode != 'null') {
            
            if (sourcecode != '') {
                if (targetURL.match(/sourcecode/i)) {
                    //** If the targetURL already has a sourcecode, we should
                    //** not be using the xover value we may obtain from the
                    //** xover cookie
                    useXOver = false;
                } else {
                    targetURL = targetURL + concatChar+ "sourcecode=" + sourcecode;
                }
            }
        }

        if (useXOver) {
            var xover = getCookie('xover');
            if (typeof xover != 'undefined' && xover != null && xover != 'null') {
                targetURL = targetURL + "&xover=" + xover;
            }
        }
        useXOver = true;
    }
    return targetURL;
}

function goToExternalSite() {
    var targetURL = getTargetUrlWithSourcecode();
    
    // Used for Google Event tracking, do not delete.
    logGoogleEvent(targetURL);
    
    //*** Log Exit Link for Omniture, do not delete
    logOmnitureExit(targetURL, true);   
    
        window.open(targetURL);
    //modelBox.popupClose('#modelwindow');
        modelBox.popupClose('#modelContent');
    externalSiteLink=defaultSourceCode='';
}

function noToExternalSite() {
    var targetURL = getTargetUrlWithSourcecode();
    
    //*** Log Exit Link for Omniture - as no exit, do not delete
    //logOmnitureExit(targetURL, false);  
    
    //modelBox.popupClose('#modelwindow');
    modelBox.popupClose('#modelContent');
    externalSiteLink=defaultSourceCode='';
}

function backToPreviousPage(flashTool){
    history.go(-1);
}

function getSourceCode() {
    
    // If overrideSourceCode is set force the source code for a particular link, leave the actual stored source code in place
    if (typeof overrideSourceCode != 'undefined' && overrideSourceCode != null && overrideSourceCode != 'null' ) {
        return overrideSourceCode;
    }
    
    // otherwise uses the stored source code or the default source code
    var sourcecode = getCookie('AHCSourceCode');
    if (sourcecode != null && sourcecode != 'null') {
        return sourcecode;
    }
    else {
        return defaultSourceCode;
    }
}

function getCookie(name) {
    // Escape regexp special characters 
    name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');

    var regex = new RegExp('(?:^|;)\\s?' + name + '=(.*?)(?:;|$)','i'),
        match = document.cookie.match(regex);

    if (match != null)
        return unescape(match[1]);
    else
        return null;
}

function loadMembershipNumber() {
    oldMembershipNumberWidth = $j('#modelContent.contentbox').width();
    modelBox.getContent('/content/aarphealthcare/home/membership-number/jcr:content/par.html');
    oldMembershipNumberWidth = $j('#modelContent.contentbox').width('487px');
}

function closeMembershipNumber() {
    $j('#modelContent.contentbox').width(oldMembershipNumberWidth);
    oldMembershipNumberWidth = null;
    noToExternalSite();
}

/**
 * Only binds if there isn't a 'click' event that already exists
 */
function bindClickEventForExternalLinks() {
    $j('a:external2').each(function() {
        if (typeof $j(this) != 'undefined' && typeof $j(this).data != 'undefined') {
            var events = $j(this).data('events');
            
            var click = ( typeof events != 'undefined' ? events['click'] : null );
            
            if (click == null) {
                $j(this).click(function(){
                    displayDisclaimerForceSourceCode(this.href,"6NT");return false;
                });
            }
        }
    });
} 

function logGoogleEvent(destUrl) {
    // Track the event
    _gaq.push([ '_trackEvent', 'Exit Links-Version 1', destUrl ]);
}
function logOmnitureExit(targetURL, isClicked) {
    /*
    var exitMethod = "";
    if (typeof isClicked=="boolean"){
        if (isClicked){
            exitMethod = "YES"
        }
        else {
            exitMethod = "NO"
        }       
    }
    else {
        exitMethod = "UNKNOWN"
    }
    */
	var exitMethod = document.title + ', ' + location.href;
        
    Logger.debug("Target URL: " + targetURL);
    Logger.debug("External Site Link: " + externalSiteLink);
    Logger.debug("Prop16: " + exitMethod);
    //since we only have link value, reverse lookup link on page to get the name and pass that to tracking script.
    var $extLink = $j("a[href*='"+externalSiteLink+"']").clone(true);
    
    //Make sure the tracking script is available.  (Is available only in production.)
    if (typeof s != 'undefined') {
        $extLink.attr('href', targetURL);
        s.linkTrackVars="prop16,events";
        s.linkTrackEvents="event6";
        s.prop16=exitMethod;
        /** changed Prop16 to show location info **/
        s.events="event6";
        s.tl($extLink, 'e', $extLink.text());
        Logger.debug("Logged Exit Link: " + $extLink.attr('href'));
        Logger.debug("Logged Link as: " + $extLink.text());
    }
    else {
        Logger.debug("Exit Link not Tracked: " + $extLink.attr('href') + " (not production environment)")
    }
}
$j(document).ready(function(){
	var formSelector = '';
	if ( $j('#request_information_form').length > 0 ) {
		formSelector = '#request_information_form';
	} else if ($j('#contact_us_form').length > 0) {
		formSelector = '#contact_us_form';
	}
	
    if ( formSelector.length > 0 ) {
    	
    	var raw = $j.cookie('B2BJson');
    	if (raw != null && raw.length > 0) {
    		
    		var json = $j.parseJSON(eval(raw));
    		for ( var prop in json ) {
    			if (json[prop] != null && json[prop].length > 0) {
                	var qry = formSelector + ' input[name="' + prop + '"]';
                	
                	var field = $j(qry);
                	if (field.length < 1) {
                		if (prop == 'state') {
                			qry = formSelector + ' select[name="' + prop + '"]';
                		}
                		field = $j(qry);
                	}
                	
                	
                	if (field.length > 0) {
                		field.val(json[prop]);
                	}
    			}
    		}
    	}
    }
    
}); 
$j(document).ready(function(){
	//** Add all the DDLB Select Element names here
	//** we will look through all of them
	var list = new Array();
	list[0] = 'location';
	
	var hasAtLeastOne = false;
	for ( var ndx=0, len=list.length ; ndx<len ; ndx++ ) {
		var theName = list[ndx];
		
		var jqsel = 'select[name="' + theName + '"]';
		var field = $j(jqsel);
		if (field.length > 0) {
			hasAtLeastOne = true;
			break;
		}
	}
	
	if (hasAtLeastOne == true) {
		
		var states = getStateArray();
		var terr = getTerritories();
		
		if (states != null) {
			for ( var ndx=0, len=list.length ; ndx<len ; ndx++ ) {
				var theName = list[ndx];
				
				var jqsel = 'select[name="' + theName + '"]';
				var field = $j(jqsel);
				for ( var ndx2=0, len2=field.length ; ndx2<len2 ; ndx2++) {
					populateDdlb(field[ndx2], states, terr);
				}
			}
		}
	}
    
}); 

function getTerritories() {
	var t = new Array();
	t[0] = 'AS';
	t[t.length] = 'GU';
	t[t.length] = 'MP';
	t[t.length] = 'PR';
	t[t.length] = 'VI';
	
	return t;
}

function getStateArray() {
	var rtn = null;
	
	var json = $j.ajax({
		  url: "/etc/designs/aarphealthcare/referencedata/usstates.json",
		  async: false
		 });
	var txt = json.responseText;
	var _states = txt.match(/\[(.*)\]/);
	if (_states != null) {
		var match = _states[1].substring(5, _states[1].length - 1);
		rtn = match.split('","');
	}
	
	return rtn;
}

function populateDdlb(ddlb, elements, ignoreElements) {
	ddlb.options.length = 0;
	
	var ignoreLength = 0;
	if (typeof ignoreElements != 'undefined' && ignoreElements != null) {
		ignoreLength = ignoreElements.length;
	}
	
	for ( var ndx=0, len=elements.length ; ndx<len ; ndx++ ) {
		var state = elements[ndx].split('=');
		var ignore = false;
		for (var ndx2=0 ; ndx2<ignoreLength ; ndx2++) {
			if (ignoreElements[ndx2] == state[0]) {
				ignore = true;
				break;
			}
		}
		if (ignore == false) {
			var opt = new Option(state[1], state[0]);
			var optsLen = ddlb.options.length;
			ddlb[optsLen] = opt;
		}
	}
}
AARPHealthcare.EmailPage = (function() {
	
	var formAction = "";
	
	function init() {
		Logger.startGroup("AARPHealthcare.EmailPage.init",Logger.LEVEL_DEBUG);
		if($j('form#email_a_friend').length > 0) {
			//Populate hidden fields.
			Logger.debug("Populating hidden fields.");
			$j('form#email_a_friend input[name="currentURL"]').val(document.URL.replace(/#$/,""));
			$j('form#email_a_friend input[name="pageTitle"]').val(document.title);
			//$j('form#email_a_friend input[name=":errorpage"]').val(document.URL.replace(/.*\/\/[^\/]+/,"").replace(/#$/,""));
			//$j('form#email_a_friend input[name=":redirect"]').val(document.URL.replace(/.*\/\/[^\/]+/,"").replace(/#$/,""));
			
			$j('form#email_a_friend input[name="fromFirstName"]').change(setSubject);
			$j('form#email_a_friend input[name="fromLastName"]').change(setSubject);
			
			formAction = $j('form#email_a_friend').attr('action');
			successPage = $j('form#email_a_friend input[name="success_page"]').val();
			failurePage = $j('form#email_a_friend input[name="failure_page"]').val();
			
			var btn = $j('form#email_a_friend .form_button_reset');
			if (btn.length > 0) {
				btn.val('');
				btn.removeClass('form_button_reset');
				btn.addClass('form_button_cancel');
			}
		}//if
		Logger.endGroup(Logger.LEVEL_DEBUG);
	}//init
	
	function bindReset() {
		if($j('form#email_a_friend .form_button_cancel').length > 0) {
			$j('form#email_a_friend .form_button_cancel').click(function () {
				modelBox.popupClose('#modelContent');
			});
		}//if
	}//bindReset
	
	function setSubject() {
		var first = $j('form#email_a_friend input[name="fromFirstName"]').val();
		var last = $j('form#email_a_friend input[name="fromLastName"]').val();
		var sub = 'An AARPhealthcare.com article';
		if (first.length > 0 || last.length > 0) {
			sub += ' from';
			if (first.length > 0) {
				sub += ' ' + first;
			}
			if (last.length > 0) {
				sub += ' ' + last;
			}
		}
		
		$j('form#email_a_friend input[name="subject"]').val(sub);
	}
	
	function resetForm() {
		$j('form#email_a_friend').find("input,textarea").each(function () {
			if($j(this).attr('value')) {
				$j(this).attr('value','');
			}//if
			else if($j(this).attr('checked')) {
				$j(this).removeAttr('checked');
			}//else if
			else if($j(this).attr('selected')) {
				$j(this).removeAttr('selected');
			}//else if
		});
		
		$j('form#email_a_friend').find('input[type="checkbox"]').attr("checked","checked");
	}//resetForm
	
	return {
		init: init
	};
})();
AARPHealthcare.RequestInformation = (function() {
	var isRequestInfoPage = false;
	var ajaxUrl = '/bin/aarp/wssupport/available.json?quoted=true';
	var notAvail = '/content/aarphealthcare/home/request-information/not-available.html';
	var ignoreNotAvailable = null;
	
	function init() {
		Logger.startGroup("AARPHealthcare.RequestInformation.init", Logger.LEVEL_DEBUG);
		
		if ($j('form#request_information_form').length > 0) {
			isRequestInfoPage = true;
			Logger.debug("We ARE on the Request Information Page");
		} else {
			Logger.debug("We ARE NOT on the Request Information Page");
		}
		
		handleServiceNotAvailable();
		
		Logger.endGroup(Logger.LEVEL_DEBUG);
	}
	
	function setIgnoreNotAvailable(trueOrFalse) {
		ignoreNotAvailable = trueOrFalse;
	}
	
	function isIgnoreNotAvailable() {
		var rtn = false;
		
		var loc = '' + window.location;
		
		var ndx = loc.indexOf('?');
		if (ndx > -1) {
			ndx = loc.indexOf('ignore=');
			if (ndx > -1) {
				rtn = true;
			}
		}
		
		return rtn;
	}
	
	function isRequestInformationPage() {
		return isRequestInfoPage;
	}
	
	function isServiceAvailable() {
		var rtn = false;
		
		var response = $j.ajax( { url: ajaxUrl, async: false } );
		//var _json = eval(response.responseText);
		var json = $j.parseJSON(response.responseText);
		rtn = (json.isAvailable == 'true');
		
		return rtn;
	}
	
	function handleServiceNotAvailable() {
		if (isRequestInformationPage()) {
			if (! isServiceAvailable()) {
				if (! isIgnoreNotAvailable()) {
					var newUrl = getHostAndProtocol() + notAvail;
					Logger.debug("The Request Information Service IS NOT Available, error url is {}", newUrl);
					window.location = newUrl;
				} else {
					Logger.debug("Ignoring that the Request Information Service IS NOT Available");
				}
			} else {
				Logger.debug("The Request Information Service IS Available");
			}
		}
	}
	
	function getHostAndProtocol() {
		return window.location.protocol + '//' + window.location.host;
	}
	
	return {
		init: init,
		isRequestInformationPage: isRequestInformationPage,
		isServiceAvailable: isServiceAvailable
	};
})();
AARPHealthcare.Billboard = (function() {
	var currentTab = 1;
	var timeout;
	
	function init() {
		if($j('.billboard').length > 0) {
			$j('.billboard div.tab').each(function () { $j(this).hide(); });
			$j('.billboard div.tab:first').show();
			timeout = setTimeout(nextTab,8000);
			Logger.startGroup("AARPHealthcare.Billboard.init",Logger.LEVEL_DEBUG);
			Logger.debug("Initialized Billboard.");
			Logger.endGroup(Logger.LEVEL_DEBUG);
		}//if
		
		$j('.billboard ul.tabs li').click(function () {
			showTab(parseInt($j(this).html()));
		});
	}//init
	
	function nextTab() {		
		if(currentTab == $j('.billboard div.tab').length) {
			showTab(1);
		}//if
		else {
			showTab(currentTab+1);
		}//else
		
		timeout = setTimeout(nextTab,10000);
	}//nextTab
	
	function showTab(tabNum) {
		var currTab = currentTab;
		var tabs    = $j('.billboard div.tab');
		var numTabs = $j('.billboard ul.tabs li');
		
		Logger.startGroup("AARPHealthcare.Billboard.showTab",Logger.LEVEL_DEBUG);
		Logger.debug("On tab {} of {}", currTab, tabs.length);
		clearTimeout(timeout);
		
		if(typeof tabNum == "number" && tabNum <= tabs.length) {
			Logger.debug("Hiding tab {}.  Displaying tab {}.", currTab, tabNum);
			$j(tabs[currTab - 1]).hide();
			$j(tabs[tabNum - 1]).show();
			$j(numTabs[currTab -1]).removeClass('active');
			$j(numTabs[tabNum - 1]).addClass('active');
			currentTab = tabNum;
		}//if
		else {
			Logger.error("Cannot change tab.  The parameter provided was not a number.");			
		}//else
		
		Logger.endGroup(Logger.LEVEL_DEBUG);		
	}//showTab(tabNum)
	
	return {
		init: init,
		showTab: showTab
	};
})();
AARPHealthcare.ContentBox = ( function () {
	function init () {
		Logger.startGroup("AARPHealthcare.Navigation.init",Logger.LEVEL_DEBUG);
		/* Draw lines between all interior column joints. */
		if(typeof CQ == "undefined" || !CQ.WCM.isEditMode()) {
			
			/* Add a line between column systems */	
			$j('.boxedpar').each(function () {
				if ($j(this).children('.parsys_column').has('.parsys_column').not(':first').length > 0) {
					Logger.debug("Adding a line between column systems.");
				}//if
				$j(this).children('.parsys_column').has('.parsys_column').not(':first').each(function () {
					$j(this).css('border-top','1px solid #ccc'); 
					$j(this).children().css('padding-top','15px');
				}); 
			});

			/* Add a line between text components inside a border_thick_topbottom content box. */
			if($j('.contentbox.border_thick_topbottom .text').length > 1) {
				Logger.debug("Adding lines between text components in border_thick_topbottom content boxes.");
				for(var i=1;i < $j('.contentbox.border_thick_topbottom .text').length;i++) {
					if($j($j('.contentbox.border_thick_topbottom .text')[i]).prev().is('div.title')) {
						$j($j('.contentbox.border_thick_topbottom .text')[i]).prev().css('border-top','1px solid #ccc');
						$j($j('.contentbox.border_thick_topbottom .text')[i]).prev().css('padding-top','15px');
					}//if
					else {
						$j($j('.contentbox.border_thick_topbottom .text')[i]).css('border-top','1px solid #ccc');
					}//else
				}//for
			}//if
		
			/* Make all columns within the same column control the same height */	
			Logger.debug("Adjusting Column Heights.");
			for(var i=0;i < $j('.contentbox .parsys_column').has('.parsys_column').length;i++) {
				var targetHeight = $j($j('.contentbox .parsys_column').has('.parsys_column')[i]).height();
				$j($j('.contentbox .parsys_column').has('.parsys_column')[i]).children().each( function () {
					$j(this).height(targetHeight);
				});			
			}//for
			
			/* Make all columns within the feature block the same height */
			if($j('#feature-block').length > 0) {
				var targetHeight = $j('#feature-block .parsys_column').has('.parsys_column').height();
				$j('#feature-block .parsys_column').has('.parsys_column').children().each( function () {
					$j(this).height(targetHeight);
				});
			}//if						
		}//if
		else {
			Logger.debug("Not processing content box.");
		}//else
		Logger.endGroup(Logger.LEVEL_DEBUG);
	}//init
	
	return {
		init: init
	};
})();
AARPHealthcare.Navigation = (function () {
	var topNavShown = false;
	
	function init () {
		Logger.startGroup("AARPHealthcare.Navigation.init",Logger.LEVEL_DEBUG);
		if($j('#navigation')) {
			Logger.debug("Initialized Top Navigation.");
			$j('#navigation ul.level-0').children().filter('li').each(function (event) {
				$j(this).hover(showTopNav,hideTopNav);				
			});
		}//if
		if($j('.side-nav')) {
			Logger.debug("Initialized Side Navigation.");
			if($j('.side-nav li.health-products-hubs li.selected ul').is(':hidden')) {
				Logger.debug("Showing selected side-nav's child pages.");
				$j('.side-nav li.health-products-hubs li.selected ul').show(); 
			}//if
			if($j('.side-nav li.health-products-hubs li.selected:hidden').length > 0) {
				$j('.side-nav li.health-products-hubs li.selected:hidden').parent().show();
			}//if
		}//if
		markSelectedPath();
		Logger.endGroup(Logger.LEVEL_DEBUG);
	};
	
	function showTopNav() {
		//$j(this).children().filter('ul').slideDown('fast');
		$j(this).children().filter('ul').show();
	}//showTopNav
	
	function hideTopNav () {
		//$j(this).children().filter('ul').slideUp('fast');
		$j(this).children().filter('ul').hide();
	}//hideTopNav
	
	function markSelectedPath() {
		Logger.startGroup("AARPHealthcare.Navigation.markSelectedPath",Logger.LEVEL_DEBUG);
		$j('#navigation li.selected').parentsUntil('#navigation').filter('li').each( function () {
			$j(this).addClass("selected");
			Logger.debug("Added selected class.  Classes are now: " + $j(this).attr('class'));
		});
		Logger.endGroup(Logger.LEVEL_DEBUG);
	}//markSelectedPath
	
	return {
		init: init
	};
})();
AARPHealthcare.TabModule = (function () {
	var disable_text = "_disable";
	
	function init() {
		if($j('#tabs').length > 0) {
			var clean_hash = window.location.hash.split(disable_text)[0];
			var selected_i = ($j(clean_hash).index()>0)? $j(clean_hash).index()-1 : 0;
			
			$j('#tabs').tabs({
				select:		keepTabState,
				selected: 	selected_i
			});
			Logger.startGroup("AARPHealthcare.TabModule.init",Logger.LEVEL_DEBUG);
			Logger.debug("Initialized Tab Module.");
			Logger.endGroup(Logger.LEVEL_DEBUG);
		}//if
	}//init
	
	function keepTabState (e, ui){
		window.location.hash = ui.tab.hash+disable_text;
	}


	return {
		init: init
	};
})();
$j(document).ready(function(){
	if($j(".contentbox input.form_button_submit").length > 0) {
		var parent_wrap = $j(".contentbox input.form_button_submit").parents(".section:first");
		var new_parent_wrap;
		
		if(parent_wrap.parents('#modelwindow').length > 0) {
			new_parent_wrap = parent_wrap.clone().insertAfter(parent_wrap.parents("#modelwindow"));
		}//if
		else {
			new_parent_wrap = parent_wrap.clone().insertAfter(parent_wrap.parents(".contentbox"));
		}//else
			
		new_parent_wrap.wrap("<div class=\"form_action_wrap\" />"); 
		parent_wrap.hide();
		
		new_parent_wrap.find("input").click(function(){
			parent_wrap.find("."+$j(this).attr("class")).trigger("click");
		});		
	}//if
});
var _gaq = _gaq || [];


var currentSiteLocation = window.location.host;
if (currentSiteLocation == "www.aarphealthcare.com") {
    // AARP Account below...
    _gaq.push(['_setAccount', 'UA-16397184-1']);
}
else {
    // Siteworx Test Account below...
    _gaq.push([ '_setAccount', 'UA-25108366-1' ]); 
    Logger.debug("GA set to Siteworx Test Account.");

}






_gaq.push([ '_setDomainName', 'none' ]);
_gaq.push([ '_setAllowLinker', true ]);

$j(document).ready(function() {
	//Inject GA Tracking into the end of the head. 
	//This was relocated from outside of document.ready in this file to ensure 
	//that the injected script is always loaded after the title.
	(function() {
		var ga = document.createElement('script');
		ga.type = 'text/javascript';
		ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		//var s = document.getElementsByTagName('script')[0];
		//s.parentNode.insertBefore(ga, s);
		var s = document.getElementsByTagName('head')[0];
		s.appendChild(ga);
	})();    

	_gaq.push([ '_trackPageview' ]);
	
	// Bind an event to all a-tags on the billboard
	// When the user clicks these, pass an event to GA
	$j('.billboard .tab a').bind('click', function(event) {
		event.preventDefault();
		var billboard = $j(this);
		// Track the event
		_gaq.push([ '_trackEvent', 'Billboards', 'Click', billboard.closest('.tab').attr('id') ]);
		setTimeout('document.location = "' + billboard.attr('href') + '"', 100);
	});
        
    // Bind an event to all a-tags on the quicklinks
    // When the user clicks these, pass an event to GA
	// manually rebinding the click event because propogation is first to last
    $j('.quicklinks li a').unbind('click').bind('click.quicklink', function(event) {
        event.stopPropagation();
        event.preventDefault(); //possibly redundant
        var quickLink = $j(this);
        
        if (quickLink.is(':external')) {
        	//This needs to be smart enough to cooperate with the exit modal and only track when "YES" is clicked
        	Logger.debug("Trigger External");
        	
        	_gaq.push([ '_trackEvent', 'QuickLink', 'Click', quickLink.attr('title') ]);
        	//Wait to allow tracking data to be sent and manually call the external modal  -- which will need to be refactored
        	setTimeout(function(){displayDisclaimerForceSourceCode(quickLink.attr('href'),"6NT");},100); 
        	
        	//-- If they want to track yes vs no then this will require approval because of time needed for development--//
        	//$j(this).trigger('click.external');
			//$j('#modalwindow .btn_yes').removeAttr('onclick').unbind('click').bind('click.external.quicklink', function(e){
        	//	// Track the event
            //    _gaq.push([ '_trackEvent', 'QuickLink', 'Click', quickLink.attr('title') ]);
            //    
            //    //Continue with modal YES
        	//	//setTimeout(goToExternalSite(),100);
        	//	Logger.debug("triggered");
        	//	$j(this).unbind('click.external.quicklink'); //cleanup for re-use on current page-view
        	//
        	//});        	
        }
        else {
        	Logger.debug("Delay Load for Tracking Scripts");
        	// Track the event
            _gaq.push([ '_trackEvent', 'QuickLink', 'Click', quickLink.attr('title') ]);
        	setTimeout('document.location = "' + quickLink.attr('href') + '"', 100);
        }
    });
    
    // Bind an event to Next Clicks on Vision Tool
    // When the user clicks these, pass an event to GA
    Logger.startGroup("VisionGA",Logger.LEVEL_DEBUG);
    // Send over analytics for that section everytime the "next" button is hit."
    $j('.fine-print h4 a').bind('click', function(event) {
        
        // Variables for defining the left and right div classes that determins the looking for, or lens choice
        var lookingForDivClassName = "left-col";
        var lensChoiceDivClassName = "right-col";
        
        Logger.debug("Next button clicked : finding which step.");
        var nextClick = $j(this);
        var curStep = nextClick.closest("section").attr("class");
        
        var gaqPushEval = "_gaq.push(";
        // no ga events should be fired or checked for in the case for step 2 where contacts has been selected. This screen
        // just gets ignored by the user but still flashes by in an animation and calls this event. In any case it must
        // be skipped.
        if ( !( (curStep == "step2") && ($j('input[name="Product"]:checked').val() == "contacts") ) ) {
            gaqPushEval += "[ '_trackEvent', 'Vision Tool', 'Next Button', '"+curStep+ "' ]";
        
            
            var lookingForRadios = $j('.'+curStep+' input[type=radio]:visible:checked'); 

            lookingForRadios.each(function() {

                var curRadioLabel = replaceAllStrings(replaceAllStrings($j(this).next().html(),"'",""),'"','');

                // Get the first word of the label - this will be the label used for the gaq push
                var labelTextForQA = curRadioLabel.split(" ");
                var displayString = labelTextForQA[0];
                var currentAction;
                if ($j(this).closest("fieldset").hasClass(lookingForDivClassName)) {
                    currentAction = "Looking For";
                }
                if ($j(this).closest("fieldset").hasClass(lensChoiceDivClassName)) {
                    currentAction = "Lens Choice";
                }
                //_gaq.push([ '_trackEvent', 'Vision Tool', currentAction, displayString ]);
                gaqPushEval += ", [ '_trackEvent', 'Vision Tool', '" + currentAction + "', '" + displayString + "' ]";

            });

            // When the user selects contacts, no data for lens option should be sent over.
            // This is needed because the code that handles the skipping of the lens options is a .click ... tsk tsk..
            if ($j('input[name="Product"]:checked').val() != "contacts") {

                var lookingForCheckboxes = $j('.'+curStep+' input:checkbox:visible');

                lookingForCheckboxes.each(function() {
                    // Get whether or not the checkbox is checked
                    var checkedValue = $j(this).attr("checked")?"On":"Off";

                    var curCheckboxLabel = replaceAllStrings(replaceAllStrings($j(this).next().text(),"'",""),'"','');
                    // Get the text that will be dislayed to GA
                    var displayLabel = curCheckboxLabel.substring(0,curCheckboxLabel.indexOf(" -")) + " " + checkedValue;

                    // do not add the track event if from step 3
                    if (curStep != "step3") {
                        //_gaq.push([ '_trackEvent', 'Vision Tool', 'Lens Options', displayLabel ]);
                        gaqPushEval += ", [ '_trackEvent', 'Vision Tool', 'Lens Options', '" + displayLabel + "' ]";
                    }
                });
            }
            gaqPushEval += ");";
            // do not do the eval of the push if it is empty. - Sanity Check
            if (gaqPushEval != "_gaq.push();") {
                Logger.debug("finalEval:\n" + gaqPushEval);
                eval(gaqPushEval);
            }
        }
    });
    // Bind the "Print this Page" button so a GA event can be fired.
    $j('.fine-print h5 a').bind('click', function(event) {
        Logger.debug("Print this Page was clicked!");
        _gaq.push([ '_trackEvent', 'Vision Tool', 'Print this Page' ]);
    });
    
    // Bind the "Start New Session" button so a GA event can be fired./
    $j('#btnNewSession').bind('click', function(event) {
        Logger.debug("Start New Session was clicked!");
        _gaq.push([ '_trackEvent', 'Vision Tool', 'Start New Session' ]);
    });
    
    // Bind the "Edit" button so a GA event can be fired./
    $j('.title-bar h4 a').bind('click', function(event) {
        
        var nextClick = $j(this);
        var curStep = nextClick.closest("section").attr("class");
        Logger.debug("Edit for " + curStep + " was clicked!");
        _gaq.push([ '_trackEvent', 'Vision Tool', 'Edit Step', curStep ]);
    });
    Logger.endGroup(Logger.LEVEL_DEBUG);
    
    
    
    
    
    /*
     *  Bind some google analytics to the genworth widget found on the caregiving page.
     *
     */
    
    Logger.startGroup("genworthWidget",Logger.LEVEL_DEBUG);
    Logger.debug("genworth: " + $j('#genworthWidget').length);
    if ($j('#genworthWidget').length > 0) {
        Logger.debug("genworthWidget Found");
        var testVar = $j("#provType :selected").val(); 
        // send a GA event when something is selected in the widget's dropdown
        $j("#genworthWidget #provType").bind("change.gw", function() {
            Logger.debug("dropdown clicked. GA: Genworth Widget - Dropdown Select - " + $j("#provType :selected").text());
            _gaq.push([ '_trackEvent', 'Genworth Widget', 'Dropdown Select', $j("#provType :selected").text() ]);
        });
        
        // send a GA event when the submit button is clicked.
        $j("#genworthWidget #submitbtn").bind("click.gw", function() {
            
            var validateSuccess = "Success";
            
            var provType = $j("#provType").val();
            var zip = $j("#zip").val();
            
            if ( (zip == "Zip Code") || (zip == "") ) {
                validateSuccess = "Failure";
            }
            else if (zip.length != 5) {
                validateSuccess = "Failure";
            }
            if (provType == "") {
                validateSuccess = "Failure";
            }
            
            Logger.debug("Submit clicked. GA: Genworth Widget - Submit - " + validateSuccess);
            _gaq.push([ '_trackEvent', 'Genworth Widget', 'Submit', validateSuccess ]);
            
        });
        
        

       Logger.debug("end of js");
    }
    
    Logger.endGroup(Logger.LEVEL_DEBUG);
    
    
    
    
    
    
    /***
     * Bind an event to Capture PDF links on "PDF Documents" 
     * When the user clicks these, pass an event to GA
     * This is called from function to allow the tools to rebind if necessary
     ***/
    logPDFsToGoogle();
    
    /***
     * Bind tracking events to Product Finder controls on "Product Finder - v 2.0"
     * When the user clicks these, pass an event to GA
     ***/

    /** Submit Event **/
    $j('.apf-wrapper footer h6 a').bind('click.ProductFinderTrack', function(e){
	    Logger.startGroup("Product Finder: Submit - GA",Logger.LEVEL_DEBUG);
	    
    	var EventCategory = "Product Finder - 2.0";
		var EventAction = "Submit Click"; 
		var EventLabel;
		
		Logger.debug(EventCategory);
		Logger.debug(EventAction);
		//Logger.debug(EventLabel);
		_gaq.push([ '_trackEvent', EventCategory, EventAction]);
		
		$j('.apf-wrapper section.person-entry:visible').each(function(e){
			/* Location */
			Logger.startGroup("Product Finder: Location - GA",Logger.LEVEL_DEBUG);
		    
	    	EventAction = (($j(this).hasClass('person-1')) ? 'Person 1' : 'Person 2') + " - Location";  
			EventLabel = replaceAllStrings(replaceAllStrings($j(this).find("select.location option:selected").text(),"'",""),'"',''); 
			if (EventLabel == "") {EventLabel = "Not Set";}
			
			Logger.debug(EventCategory);
			Logger.debug(EventAction);
			Logger.debug(EventLabel);
			_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
			
			Logger.endGroup(Logger.LEVEL_DEBUG);
		    
			/* Age Group */
			Logger.startGroup("Product Finder: Age Group - GA",Logger.LEVEL_DEBUG);
		    
	    	EventAction = (($j(this).hasClass('person-1')) ? 'Person 1' : 'Person 2') + ' - Age Group';   
			EventLabel = replaceAllStrings(replaceAllStrings($j(this).find("input[name='age']:checked").parent().find('span').text(),"'",""),'"',''); 
			if (EventLabel == "") {EventLabel = "Not Set";}
			
			Logger.debug(EventCategory);
			Logger.debug(EventAction);
			Logger.debug(EventLabel);
			_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
			
			Logger.endGroup(Logger.LEVEL_DEBUG);
		});

	    Logger.endGroup(Logger.LEVEL_DEBUG);
    });
    
    /** Additional Person Event **/
    $j('.apf-wrapper footer h2 a').bind('click.ProductFinderTrack', function(e){
    	Logger.startGroup("Product Finder: Additional Person - GA",Logger.LEVEL_DEBUG);
		
    	var EventCategory = "Product Finder - 2.0";
		var EventAction = "Additional Person"; 
		var EventLabel = ($j(this).text().split(" ").shift().toUpperCase() == 'REMOVE') ? 'REMOVE' : 'ADD'; 
		
		Logger.debug(EventCategory);
		Logger.debug(EventAction);
		Logger.debug(EventLabel);
		_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
		
    	Logger.endGroup(Logger.LEVEL_DEBUG);
    });
    
    /** Result Tabs Event **/
    $j('.apf-wrapper div.tabs h2 a').bind('click.ProductFinderTrack', function(e){
    	Logger.startGroup("Product Finder: Result Tabs - GA",Logger.LEVEL_DEBUG);
		
    	var EventCategory = "Product Finder - 2.0";
		var EventAction = "Results Tab";
		var EventLabel = ($j(this).closest('li').index() == 0) ? 'Person 1' : 'Person 2'; 
		
		Logger.debug(EventCategory);
		Logger.debug(EventAction);
		Logger.debug(EventLabel);
		_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
		
    	Logger.endGroup(Logger.LEVEL_DEBUG);
    });
    
    /** Product Link Event **/
    $j('.apf-wrapper div.panel a').bind('click.ProductFinderTrack', function(e){
		if ($j(this).parent().find("a[href='"+this.href+"']:external").length < 1) {
			e.preventDefault();		
			window.open(this.href);
		}
    	
    	Logger.startGroup("Product Finder: Product Results - GA",Logger.LEVEL_DEBUG);
		
    	var EventCategory = "Product Finder - 2.0";
		var EventAction = (($j(this).closest('.panel-wrapper').hasClass('person-1')) ? 'Person 1' : 'Person 2') + " - Product Link"; 
		var EventLabel = replaceAllStrings(replaceAllStrings($j(this).closest('section').find('h2 a').text(),"'",""),'"',''); 
		if (EventLabel == "") {EventLabel = "Unknown";}
		
		Logger.debug(EventCategory);
		Logger.debug(EventAction);
		Logger.debug(EventLabel);
		_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
		
    	Logger.endGroup(Logger.LEVEL_DEBUG);
    });
    
    /** New Session Event **/
    $j('.apf-wrapper div.start-new h6 a').bind('click.ProductFinderTrack', function(e){
    	Logger.startGroup("Product Finder: New Session - GA",Logger.LEVEL_DEBUG);
		
    	var EventCategory = "Product Finder - 2.0";
		var EventAction = "New Session Click";
		//var EventLabel = ($j(this).closest('li').index() == 0) ? 'Person 1' : 'Person 2'; 
		
		Logger.debug(EventCategory);
		Logger.debug(EventAction);
		//Logger.debug(EventLabel);
		//_gaq.push([ '_trackEvent', EventCategory, EventAction]);
		
    	Logger.endGroup(Logger.LEVEL_DEBUG);
    });
    
});

function logPDFsToGoogle() { 
	//Used to log PDF usage data to Google Analytics
	var pdfSelector = "a[href$='.pdf']:not(:external)"
	$j(pdfSelector).unbind("click.PdfTrack");
	$j(pdfSelector).bind("click.PdfTrack", 
			function(e) {
				Logger.startGroup("PDF Document Tacked - GA",Logger.LEVEL_DEBUG);
				//Open links in new window so that tracking script completes. 
				//New windows is intended practice for PDFs on this site.
				e.preventDefault();		
				window.open(this.href);
				
				var EventCategory = "PDF Documents";
				var EventAction = replaceAllStrings(replaceAllStrings($j(this).attr('href').split('/').pop(),"'",""),'"',''); 
				var EventLabel = replaceAllStrings(replaceAllStrings((document.title + ': ' + $j(this).text()),"'",""),'"',''); 
				
				Logger.debug(EventCategory);
				Logger.debug(EventAction);
				Logger.debug(EventLabel);
				_gaq.push([ '_trackEvent', EventCategory, EventAction, EventLabel]);
			    Logger.endGroup(Logger.LEVEL_DEBUG);
			});
}

function replaceAllStrings(txt, replace, with_this) {
  return txt.replace(new RegExp(replace, 'g'),with_this);
}


