/*!
 * jQuery UI 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||function(c){c.ui={version:"1.8.1",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,f,g){return c.ui.isOverAxis(a,d,f)&&c.ui.isOverAxis(b,e,g)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,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}};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)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none")},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!==
undefined)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"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b||"area"==b?a.href||!isNaN(d):!isNaN(d))&&
!c(a)["area"==b?"parents":"closest"](":hidden").length},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}(jQuery);
;/*!
 * jQuery UI Widget 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b){var j=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 j.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({},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.substring(0,1)==="_")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!==undefined){h=i;return false}}):this.each(function(){var g=
b.data(this,a);if(g){d&&g.option(d);g._init()}else 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){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();
this._init()},_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,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f,
h){e._setOption(f,h)});return e},_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 Accordion 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},_create:function(){var a=this.options,b=this;this.running=0;this.element.addClass("ui-accordion ui-widget ui-helper-reset");
this.element[0].nodeName=="UL"&&this.element.children("li").addClass("ui-accordion-li-fix");this.headers=this.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c(this).removeClass("ui-state-focus")});
this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(a.navigation){var d=this.element.find("a").filter(a.navigationFilter);if(d.length){var f=d.closest(".ui-accordion-header");this.active=f.length?f:d.closest(".ui-accordion-content").prev()}}this.active=this._findActive(this.active||a.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");
this._createIcons();this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(g){return b._keydown(g)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();this.active.length?this.active.attr("aria-expanded","true").attr("tabIndex","0"):this.headers.eq(0).attr("tabIndex","0");c.browser.safari||this.headers.find("a").attr("tabIndex","-1");a.event&&this.headers.bind(a.event+
".accordion",function(g){b._clickHandler.call(b,g,this);g.preventDefault()})},_createIcons:function(){var a=this.options;if(a.icons){c("<span/>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");
this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(a.autoHeight||a.fillHeight)b.css("height",
"");return this},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();b&&this._createIcons()}},_keydown:function(a){var b=c.ui.keyCode;if(!(this.options.disabled||a.altKey||a.ctrlKey)){var d=this.headers.length,f=this.headers.index(a.target),g=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:g=this.headers[(f+1)%d];break;case b.LEFT:case b.UP:g=this.headers[(f-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},
a.target);a.preventDefault()}if(g){c(a.target).attr("tabIndex","-1");c(g).attr("tabIndex","0");g.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,
b-c(this).innerHeight()+c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a=="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=
this.options;if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]==this.active[0];d.active=d.collapsible&&b?false:c(".ui-accordion-header",this.element).index(a);if(!(this.running||!d.collapsible&&b)){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);
a.next().addClass("ui-accordion-content-active")}e=a.next();f=this.active.next();g={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):e,oldContent:f};d=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(e,f,g,b,d)}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
this.active.next().addClass("ui-accordion-content-active");var f=this.active.next(),g={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:f},e=this.active=c([]);this._toggle(e,f,g)}},_toggle:function(a,b,d,f,g){var e=this.options,k=this;this.toShow=a;this.toHide=b;this.data=d;var i=function(){if(k)return k._completed.apply(k,arguments)};this._trigger("changestart",null,this.data);this.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&f?{toShow:c([]),
toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;f=c.ui.accordion.animations;var h=e.duration,j=e.animated;if(j&&!f[j]&&!c.easing[j])j="slide";f[j]||(f[j]=function(l){this.slide(l,{easing:j,
duration:h||700})});f[j](d)}else{if(e.collapsible&&f)a.toggle();else{b.hide();a.show()}i(true)}b.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();a.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(a){var b=this.options;this.running=a?0:--this.running;if(!this.running){b.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,
{version:"1.8.1",animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},e={},k;b=a.toShow;k=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(i,h){e[h]="hide";i=(""+c.css(a.toShow[0],
h)).match(/^([\d+-.]+)(.*)$/);g[h]={value:i[1],unit:i[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(e,{step:function(i,h){if(h.prop=="height")f=h.end-h.start===0?0:(h.now-h.start)/(h.end-h.start);a.toShow[0].style[h.prop]=f*g[h.prop].value+g[h.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css("width",k);a.toShow.css({overflow:d});a.complete()}})}else a.toHide.animate({height:"hide"},
a);else a.toShow.animate({height:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
;

/*
 * jQuery clueTip plugin
 * Version 1.0.3  (May 29, 2009)
 * @requires jQuery v1.2.6+
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';(b($){$.5={3M:\'1.0.3\'};9 $5,$h,$1w,$1e,$1m,$1j,$x,1q;$.1b.5=b(z,A){7(2t z==\'3I\'){A=z;z=34}7(z==\'3y\'){N 8.1F(\'.5\')}N 8.3t(b(2w){9 m=8,$8=$(8);9 4=$.2x(v,{},$.1b.5.3b,A||{},$.3o?$8.3o():$.2X?$8.l():{});9 1C=k;9 1d=+4.1d;$8.l(\'11\',{w:m.w,p:1d});9 14=k,1T=0;7(!$(\'#5\').2d){$([\'<j Q="5">\',\'<j Q="5-3g">\',\'<2V Q="5-w"></2V>\',\'<j Q="5-1M"></j>\',\'</j>\',\'<j Q="5-3P"></j>\',\'<j Q="5-1n" 2u="5-1n"></j>\',\'</j>\'].3W(\'\'))[1l](1o).y();$5=$(\'#5\').d({1N:\'2m\'});$1w=$(\'#5-3g\').d({1N:\'3G\',p:1d});$h=$(\'#5-1M\');$1e=$(\'#5-w\');$1m=$(\'#5-1n\');$1j=$(\'<j Q="5-3X"></j>\').d({1N:\'2m\'}).2F($5).y()}9 R=(4.x)?+4.R:0;7(!$x){$x=$([]);2C(9 i=0;i<R;i++){$x=$x.3U($(\'<j></j>\').d({p:1d-1,3u:.1,F:1+i,M:1+i}))};$x.d({1N:\'2m\',3z:\'#3s\'}).1P($5)}9 o=$8.U(4.1V),1E=4.37;7(!o&&!4.1J&&!z)N v;7(4.1D&&4.2j){o=4.2j+o}7(4.1D&&4.35){$(o+\':3F\').y()}9 E=L(4.33,10),O=L(4.32,10);9 I,1H,1y=3N(L(4.G,10))?\'1g\':(/\\D/g).X(4.G)?4.G:4.G+\'26\';9 1v,2p,K,s,1f,1u;9 1I=L(4.1s,10)||3c,q=1I+(L($5.d(\'3K\'),10)||0)+(L($5.d(\'3T\'),10)||0)+R,1h=8.3Q,H,n,3S,t,17;9 18;9 r=(4.1V!=\'w\')?$8.U(4.1X):\'\';7(4.1J){7(r==3v){r=\'\'}18=r.2y(4.1J);r=18.3A()}7(4.36){r=r.1t(/&/g,\'&\').1t(/>/g,\'>\').1t(/</g,\'<\')}9 2l;9 1B=b(c){7(!4.2J($8)){N k}14=v;$5.1i().d({1s:1I});7(o==$8.U(\'1G\')){$8.d(\'1O\',4.1O)}7(4.1r){$8.1k(4.1r)}2p=K=$8.2r().F;H=$8.2r().M;t=c.2k;1f=c.19;7(m.1Z.2n()!=\'2i\'){1v=$(3h).3L();17=$(2K).1s()}7(4.Z==\'2E\'){n=1h+H+O;$5.d({M:n})}f{n=(1h>H&&H>q)||H+1h+q+O>17?H-q-O:1h+H+O;7(m.1Z.2n()==\'2i\'||4.Z==\'2q\'||1h+q>17){7(t+20+q>17){$5.1k(\' 5-\'+1E);n=(t-q-O)>=0?t-q-O-L($5.d(\'3O\'),10)+L($h.d(\'3V\'),10):t-(q/2)}f{n=t+O}}9 T=n<0?c.19+E:c.19;$5.d({M:(n>0&&4.Z!=\'2G\')?n:(t+(q/2)>17)?17/2-q/2:1Y.1W(t-(q/2),0),p:$8.l(\'11\').p});$1m.d({p:$8.l(\'11\').p+1})}1H=$(2K).G();7(z){7(2t z==\'b\'){z=z(m)}$h.B(z);V(T)}f 7(18){9 2o=18.2d;$h.B(18[0]);7(2o>1){2C(9 i=1;i<2o;i++){$h.3H(\'<j 2u="2y-2N">\'+18[i]+\'</j>\')}}V(T)}f 7(!4.1D&&o.3R(\'#\')!=0){7(/\\.(3q?g|3r?|3w|3x)$/i.X(o)){$h.B(\'<2f 3D="\'+o+\'" 3E="\'+r+\'" />\');V(T)}f 7(1C&&4.2S){$h.B(1C);V(T)}f{9 1S=4.W.2z,1Q=4.W.2a,29=4.W.2A,2c=4.W.2B;9 W={3C:k,3B:o,2z:b(1c){7(1S){1S.12(m,1c,$5,$h)}$1w.3J().47();7(4.3a){$1j.d({F:1f+20,M:t+20,p:$8.l(\'11\').p-1}).P()}},2a:b(1c,1a){7(14){7(1Q){1Q.12(m,1c,1a,$5,$h)}f{$h.B(\'<i>4t, 4u 4v 4w 4s 4r 4n</i>\')}}},2A:b(l,1a){1C=4.2Q.12(m,l);7(14){7(29){29.12(m,l,1a,$5,$h)}$h.B(1C)}},2B:b(1c,1a){7(2c){2c.12(m,1c,1a,$5,$h)}1q=$(\'#5-1M 2f\').2d;7(1q&&!$.4o.4y){$(\'#5-1M 2f\').u(\'4q 2a\',b(){1q--;7(1q<1){$1j.y();7(14)V(T)}})}f{$1j.y();7(14){V(T)}}}};9 2v=$.2x(v,{},4.W,W);$.4x(2v)}}f 7(4.1D){9 $2l=$(o+(/#\\S+$/.X(o)?\'\':\':4A(\'+2w+\')\')).4z(v).P();$h.B($2l);V(T)}};9 V=b(2s){$5.1k(\'5-\'+1E);7(4.22){9 $2D=$h.4B().4C(0,4.22)+\'...\';$h.B($2D)}b 1R(){};r?$1e.P().B(r):(4.3k)?$1e.P().B(\' \'):$1e.y();7(4.24){9 $16=$(\'<j Q="5-4D"><a 1G="#">\'+4.2H+\'</a></j>\');(4.23==\'2M\')?$16.2g($h):(4.23==\'w\')?$16.1P($1e):$16.1P($h);$16.u(\'13.5\',b(){1x();N k});7(4.3m){7($.1b.C&&4.C){$5.C({2T:1R,1A:4.C.1A,2O:b(){$16.2I(\'13.5\')}})}f{$5.3f(1R,b(){$16.2I(\'13.5\')})}}f{$5.1F(\'4p\')}}9 J=\'\';$1w.d({p:$8.l(\'11\').p,4l:1y==\'1g\'?\'45\':\'1g\',G:1y});I=1y==\'1g\'?1Y.1W($5.46(),$5.G()):L(1y,10);s=K;1u=1v+1H;7(4.Z==\'2E\'){s=K-4.R+E}f 7((n<t&&1Y.1W(n,0)+q>t)||4.Z==\'2G\'){7(K+I+E>1u&&1f-1v>I+E){s=1f-I-E;J=\'F\'}f{s=1f+E;J=\'2M\'}}f 7(K+I+E>1u){s=(I>=1H)?1v:1u-I-E}f 7($8.d(\'4m\')==\'48\'||m.1Z.2n()==\'2i\'||4.Z=="2q"){s=2s-E}f{s=K-4.R}7(J==\'\'){n<H?J=\'M\':J=\'27\'}$5.d({F:s+\'26\'}).1i().1k(\'44-\'+J+\'-\'+1E).1k(\' 5-\'+1E);7(4.1n){9 2b=(K-s-4.R);$1m.d({F:(/(M|27)/.X(J)&&n>=0&&2b>0)?2b+\'26\':/(M|27)/.X(J)?0:\'\'}).P()}f{$1m.y()}$x.y();$5.y()[4.1K.1U](4.1K.1U!=\'P\'&&4.1K.2L);7(4.x){$x.d({G:I,1s:1I,p:$8.l(\'11\').p-1}).P()}7($.1b.3l){$5.3l()}7(4.21>0){1T=43(1x,4.21)}4.2Z.12(m,$5,$h)};9 1p=b(c){14=k;$1j.y();7(!4.24||(/13|3n/).X(4.1L)){1x();3Y(1T)};7(4.1r){$8.1i(4.1r)}};9 1x=b(){$1w.40().y().1i();4.38.12(m,$5,$h);$8.1i(\'5-1z\');7(r){$8.U(4.1X,r)}$8.d(\'1O\',\'\');7(4.1n)$1m.d({F:\'\'})};$(3h).u(\'41\',b(e){1x()});7((/13|3n/).X(4.1L)){$8.u(\'13.5\',b(c){7($5.3p(\':42\')||!$8.3p(\'.5-1z\')){1B(c);$(\'.5-1z\').1i(\'5-1z\');$8.1k(\'5-1z\')}f{1p(c)}8.2W();N k})}f 7(4.1L==\'3d\'){$8.u(\'3d.5\',b(c){1B(c)});$8.u(\'2W.5\',b(c){1p(c)})}f{$8.u(\'13.5\',b(){7($8.U(\'1G\')&&$8.U(\'1G\')==o&&!4.3i){N k}});9 2h=b(Y){7(4.3j==v){9 3e=n-Y.2k;9 2U=s?s-Y.19:K-Y.19;$8.u(\'28.5\',b(Y){$5.d({M:Y.2k+3e,F:Y.19+2U})})}};7($.1b.C&&4.C){$8.C({25:4.C.25,2e:4.C.2e,2T:b(c){1B(c);2h(c)},1A:4.C.1A,2O:b(c){1p(c);$8.1F(\'28.5\')}})}f{$8.u(\'2R.5\',b(c){1B(c);2h(c)}).u(\'30.5\',b(c){1p(c);$8.1F(\'28.5\')})}$8.u(\'2R.5\',b(c){$8.U(\'w\',\'\')}).u(\'30.5\',b(c){$8.U(\'w\',$8.l(\'11\').w)})}})};$.1b.5.3b={1s:3c,G:\'1g\',1d:49,Z:\'1g\',33:15,32:15,1D:k,2j:34,35:v,1V:\'4a\',1X:\'w\',1J:\'\',36:k,3k:v,37:\'4h\',1r:\'\',3a:v,1O:\'4i\',1n:k,x:v,R:6,24:k,3m:k,1L:\'3f\',3i:k,3j:k,21:0,23:\'F\',2H:\'4j\',22:0,1K:{1U:\'P\',2L:\'\'},C:{25:3,2e:4k,1A:0},2J:b(e){N v},2Z:b(39,31){},38:b(39,31){},2S:v,2Q:b(l){l=l.1t(/<(2P|2Y|w)[^<]+<\\/(2P|2Y|w)>/4g,\'\').1t(/<(m|2X)[^>]+>/g,\'\');N l},W:{4f:\'B\'},4b:k};9 1l=\'2g\',1o=\'2N\';$.5.4c=b(A){7(A&&A.1l&&(A.1l).4d(/2g|1P|2F|4e/)){1l=A.1l}7(A&&A.1o){1o=A.1o}}})(3Z);',62,288,'||||opts|cluetip||if|this|var||function|event|css||else||cluetipInner||div|false|data|link|posX|tipAttribute|zIndex|tipWidth|tipTitle|tipY|mouseX|bind|true|title|dropShadow|hide|js|options|html|hoverIntent||tOffset|top|height|linkLeft|tipHeight|direction|posY|parseInt|left|return|lOffset|show|id|dropShadowSteps||pY|attr|cluetipShow|ajaxSettings|test|evt|positionBy||thisInfo|call|click|isActive||closeLink|winWidth|tipParts|pageY|textStatus|fn|xhr|cluezIndex|cluetipTitle|mouseY|auto|linkWidth|removeClass|cluetipWait|addClass|insertionType|cluetipArrows|arrows|insertionElement|inactivate|imgCount|hoverClass|width|replace|baseline|sTop|cluetipOuter|cluetipClose|defHeight|clicked|timeout|activate|cluetipContents|local|ctClass|unbind|href|wHeight|tipInnerWidth|splitTitle|fx|activation|inner|position|cursor|prependTo|optionError|doNothing|optionBeforeSend|closeOnDelay|open|attribute|max|titleAttribute|Math|tagName||delayedClose|truncate|closePosition|sticky|sensitivity|px|right|mousemove|optionSuccess|error|bgY|optionComplete|length|interval|img|appendTo|mouseTracks|area|localPrefix|pageX|localContent|absolute|toLowerCase|tpl|linkTop|mouse|offset|bpY|typeof|class|ajaxMergedSettings|index|extend|split|beforeSend|success|complete|for|truncloaded|fixed|insertBefore|bottomTop|closeText|trigger|onActivate|window|openSpeed|bottom|body|out|script|ajaxProcess|mouseenter|ajaxCache|over|trackY|h3|blur|meta|style|onShow|mouseleave|ci|leftOffset|topOffset|null|hideLocal|escapeTitle|cluetipClass|onHide|ct|waitImage|defaults|275|focus|trackX|hover|outer|document|clickThrough|tracking|showTitle|bgiframe|mouseOutClose|toggle|metadata|is|jpe|tiff|000|each|opacity|undefined|gif|png|destroy|backgroundColor|shift|url|cache|src|alt|first|relative|append|object|children|paddingLeft|scrollTop|version|isNaN|marginLeft|extra|offsetWidth|indexOf|tipX|paddingRight|add|marginRight|join|waitimage|clearTimeout|jQuery|parent|hideCluetip|hidden|setTimeout|clue|visible|outerHeight|empty|block|97|rel|debug|setup|match|insertAfter|dataType|gm|default|help|Close|50|overflow|display|loaded|browser|mouseout|load|be|not|sorry|the|contents|could|ajax|opera|clone|eq|text|slice|close'.split('|'),0,{}))

// Define Selector Expressions:
// Scenarios <td> Cell:
var SCE_CELL = "#scenariosCell";
// Recommendations <td> Cell:
var REC_CELL = "#recommendationsCell";
// Resources <td> Cell:
var RES_CELL = "#resourcesCell";

// All Accordion Controls:
var ACC_CONT_GLOBAL = "#explorerBodyContainer div.accordionContainer";
// Scenarios Accordion Control:
var ACC_CONT_SCE = "#accContSCE";
// All Recommendations Accordion Control:
var ACC_CONT_ALL = "#accContALL";

// Personalized Recommendation Group Content:
//var ACC_GROUP_PER_CONTENT = "#recGroupPERContent";
// All Recommendations Group Content:
var ACC_GROUP_ALL_CONTENT = "#recGroupALLContent";

// Selected Personalized Recommendations Accordion Panel:
//var SEL_ACC_GROUP_PANEL_PER = "#recGroupPER[class*=' selected']";
//var REC_GROUP_HEADER_PER = "#recGroupPERHeader";

// Scenario Anchor Elements:
var SCE_ITEM_LINKS = SCE_CELL + " a.scenario";

// Recommendation Anchor Elements:
var REC_ITEM_LINKS = REC_CELL + " a.recItem";
var REC_ITEM_INFO_LINKS = REC_CELL + " a.recDef";

// Form elements:
// Explored Scenarios Value:
var FORM_ELEMENT_FOR_EXPLORED_SCENARIOS = "#exploredScenarios";
// Explored Recommendations Value:
var FORM_ELEMENT_FOR_EXPLORED_RECS = "#exploredRecommendations";

var AMPERSAND_REPLACEMENT = "~|~";

var ARRAY_INDICES = 
{
	INDEX_FOR_GROUP_NAME:0
	,INDEX_FOR_NAME:1	
}

// jQuery Object Instances for Tool:
var JOIT = 
{
	// All Recommendations Accordion Group Content:
	AGAC:$("#recGroupALLContent")	
	// Personalized Recommendation Accordion Group Content:
	,AGPC:$("#recGroupPERContent")
	// Personalized Recommendations Accordion Control:
	,ACPER:$("#accContPER")
	// Scenarios Accordion Control:
	,ACSC:$("#accContSCE")
	// Contact Form:
	,CF:$("#frmContactSEPAFooter")
	// Resource Container List:	
	,RL:$("#resourcesList")
	// Feedback Control:
	,FC:$('#feedback')		
	// Table Container:
	,TABLE_CONT:$('#explorerContainer')
	// Hideable Cells:
	,HIDEABLE_TABLE_CELLS:$("#explorerContainer th.hideable,#explorerContainer td.hideable")
	// Expandable Cells:
	,EXPANDABLE_TABLE_CELLS:$("#explorerContainer th.expandable,#explorerContainer td.expandable")
	// All Table Cells:
	,ALL_TABLE_CELLS:$("#explorerContainer th,#explorerContainer td")
};

var LAST_CLICKED_REC_TEXT = '';

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Overrides the link click behavior for
// links marked as members-only or registered-user only.
// Last Revision Date:  05/20/2010
// Parameters:
//		N/A
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function RedirectProtectedLinksToLogin()
{
	// Is the user logged in?
	if (IsUserAuthenticated() == false)		
	{
		JOIT.RL.find("a.r,a.m").click(function()		
		{
			ShowLogInDialogFromLinkOrRedirect(this);
			
			return false;
		});
	}
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Retrieves the "v" attribute value for a
// specified <prop> element with an "n" attribute value
// specified by "propName".
// Last Revision Date:  05/20/2010
// Parameters:
//		props:  The property XML
//		propName:  The property name attribute value to match
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function GetPropValue(props, propName)
{
	return (props.children("prop[n='" + propName + "']:eq(0)").attr("v"));
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Builds a library <div> element for a node.
// Last Revision Date:  05/20/2010
// Parameters:
//		node:  The XML element containing the properties
//		isUserAuthenticated:  A value indicating whether or not the user is authenticated
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function ResourceItemBuilder(node, isUserAuthenticated)
{
	var props = $(node).find("props");
			
	var pURL = GetPropValue(props, 'url');
	var canAccess = GetPropValue(props, 'canAccess');
	var linkClass = GetPropValue(props, 'accessClass');
	var title = GetPropValue(props, 'title');
	var linkTitle = '';
	
	if ((linkClass == 'm') && (isUserAuthenticated == false))	
	{
		linkTitle = ('This is a members-only resource.  Members can click to log in and access.');
	}
	else	
	{
		linkTitle = ('View the &quot;' + title + '&quot; file.');
	}

	var item = ['<a class="ca',
	canAccess,
	' ',
	linkClass,
	'" href="',
	((pURL.length > 0) ? pURL : GetPropValue(props, 'path')),
	'" rel="',
	GetPropValue(props, "id"),
	'" title="',
	linkTitle,
	'" target="_blank">',
	title ,
	'</a>'];	
	
	return item.join('');
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Determines if personalized recommendation content is visible.
// Last Revision Date:  09/11/2009
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function ArePersonalizedRecsVisible()
{
	return (JOIT.AGPC.css("display") == "block");
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Appends a text value to a specified form element.
// Last Revision Date:  12/10/2008
// Parameters:
//		formFieldID:  	The JID for the form field
//		valueToAppend:  The text value to append
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function AppendToFormField(formFieldID, valueToAppend)
{
	try
	{
		if (formFieldID) 
		{
			var _formField = $(formFieldID);
			
			if (_formField.length == 1)			
			{
				if (valueToAppend)
				{
					// Retrieve the current form value.
					var currentFieldValue = _formField.val();
					
					_formField.val("<p>" + valueToAppend + "</p>" + currentFieldValue);
				}
			}
		}
	}
	catch (e)
	{
		alert("The attempt to append data to the form field failed with the following error:\n\n" + e);
	}
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Initializes the recommendation link elements.
// Last Revision Date:  12/10/2008
// Parameters:
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function InitializeRecommendationLinks()
{
	try
	{
		$(REC_ITEM_LINKS).click(function()
		{
			LAST_CLICKED_REC_TEXT = this.rel.replace("&", AMPERSAND_REPLACEMENT);
		
			RetrieveMediaFilesForRecommendation(LAST_CLICKED_REC_TEXT);
			
			// Append the explored recommendations to the hidden form field.
			AppendToFormField(FORM_ELEMENT_FOR_EXPLORED_RECS, $(this).text());
		});		
		
		// Ensure that the tooltip display is activated for the recommendation info symbols.
		$(REC_ITEM_INFO_LINKS).cluetip({splitTitle: '|', arrows:true});		
	}
	catch (e)
	{
		alert("The attempt to initialize the recommendation link elements failed with the following error:\n\n" + e);
	}
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Initializes the scenario link elements.
// Last Revision Date:  12/10/2008
// Parameters:
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function InitializeScenarioLinks()
{
	try
	{
		$(SCE_ITEM_LINKS).click(function()
		{		
			var _text = $(this).text();
		
			// Append the explored scenarios to the hidden form field.
			AppendToFormField(FORM_ELEMENT_FOR_EXPLORED_SCENARIOS, _text);
			
			$("#perRecAccLink").html("Personalized Recommendations for <br />'" + _text + "'");

			// Find the hidden form field using the "rel" attribute.
			PersonalizeRecommendations(jQuery.trim(this.rel), _text);		
		});		
	}
	catch (e)
	{
		alert("The attempt to initialize the scenario link elements failed with the following error:\n\n" + e);
	}	
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Creates a customized list of recommendations for a selected profile.
// Last Revision Date:  12/10/2008
// Parameters:
//		rgID: 			The selected profile ID
//		scenarioText:	The selected profile text
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function PersonalizeRecommendations(rgID, scenarioText)
{
	try
	{
		// Clear any current personalized recommendations.
		JOIT.AGPC.empty();
		
		// Retrieve the recommendation text from the selected scenario.
		var recText = jQuery.trim($("#" + rgID).val());
			
		if (String.IsNullOrEmpty(recText) == false)
		{	
			// Store the last recommendation group name and index.
			var lastRecGroupName = "";
			var lastRecGroupIndex = -1;
			
			// Split the recommendation groups from the main string.
			var recGroups = recText.split(",");
			
			if (recGroups)			
			{
				var i = 0;
				var countRecGroups = recGroups.length;
				
				// Iterate through each recommendation group.
				while (i < countRecGroups)				
				{
					// Split the item text into the group and name.
					var itemParts = recGroups[i].split("|");
					
					var groupName = itemParts[ARRAY_INDICES.INDEX_FOR_GROUP_NAME];
					var name = itemParts[ARRAY_INDICES.INDEX_FOR_NAME];
										
					// Iterate through all recommendations associated with a recommendation group.
					// If this is a new group, add a group <div> element.				
					if (groupName != lastRecGroupName)
					{
						// For each recommendation section, build a personalized recommendation group
						// using the template.
						// The group IDs will be of the form:precGroup0,precGroup1,etc.
						JOIT.AGPC.append('<div class="recGroupName">' + groupName + '</div><ul id="precGroup' + (++lastRecGroupIndex) + '" class="recItems"></ul>');
						
						lastRecGroupName = groupName;
					}
					
					// Prepare the group|name text pair.
					var g_n = (groupName + '|' + name);
					var desc = $(ACC_GROUP_ALL_CONTENT + " a.recDef[rel='" + recGroups[i] + "']").attr("title").split("|")[1];
					
					// Build an individual recommendation to append to the current recommendation group.
					$("#precGroup" + lastRecGroupIndex).append('<li><a class="recDef" rel="' + g_n + '" title="' + name + ' Definition:|' + desc + '"></a> <a class="recItem" rel="' + g_n + '">' + name + '</a></li>');
					
					// Prepare for the next loop iteration.
					++i;
				}
			}
	
			if (ArePersonalizedRecsVisible() == false)
			{
				// Enable the ACC_CONT_PER control.				
				JOIT.ACPER.accordion('enable');
			
				// Activate the personalized recommendations panel.
				JOIT.ACPER.accordion("activate", 0);
			}				
		}		
	
		// Initialize the recommendation links for the dynamically generated <a> elements.	
		InitializeRecommendationLinks();
	}
	catch (e)
	{
		alert("The attempt to personalize the recommendations failed with the following error:\n\n" + e);
	}
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Initializes the tool based on the desired interaction mode.
// Last Revision Date:  12/10/2008
// Parameters:
//		displayType:  The tool display mode
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function InitializeDisplay(displayType)
{
	try
	{
		// Initialize all accordion controls for the page.
		$(ACC_CONT_GLOBAL).accordion(
		{
			//alwaysOpen:false,
			active:false,
			autoHeight:false,
			collapsible:true,
			header:"h3"
		});		
			
		if (displayType == "buttonRecommendations")
		{
			// Hide the hideable cells.
			JOIT.HIDEABLE_TABLE_CELLS.hide();
			// Expand the expandable cells.
			JOIT.EXPANDABLE_TABLE_CELLS.css("width", "50%");
			// Hide the personalized recommendations accordion control.
			JOIT.ACPER.hide();
			
			// Ensure that the all recommendations accordion control is shown.
			// Activate the "All Recommendations" accordion control.
			$(ACC_CONT_ALL).show().accordion("activate", 0);
		}	
		else if (displayType == "buttonScenarios")
		{
			// Show the hideable cells.
			JOIT.HIDEABLE_TABLE_CELLS.show();			
			// Adjust the table cell widths.
			JOIT.ALL_TABLE_CELLS.css("width", "33%");
			
			// Ensure that the personalized recommendations accordion control is shown.
			JOIT.ACPER.show();
			
			// Ensure that the all recommendations accordion control is shown.
			$(ACC_CONT_ALL).show();
		}
		
		// Disable the ACC_CONT_PER control to start.
		JOIT.ACPER.accordion('disable');
		
		$("#perRecAccLink").click(function()
		{
			var nc = JOIT.AGPC.html();
			
			if ((nc == null) || (nc == "&nbsp;"))
			{			
				alert("Before recommendations can be personalized, please choose either a Utility Profile or a Solar Topic.");
				
				return false;
			}
		});		
		
		// Fade in the container table.	
		JOIT.TABLE_CONT.fadeIn(500);
		
		// Initialize the recommendation links for the dynamically generated <a> elements.	
		InitializeRecommendationLinks();		
	}
	catch (e)
	{
		alert("The attempt to initialize the display failed with the following error:\n\n" + e);
	}
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Creates the XML for the media file list POST request.
// Last Revision Date:  12/10/2008
// Parameters:
//		sections:  The collection of retrieval sections to process
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function GetMediaFileListInstructions(recText)
{
	try
	{
		var xml = ["<mediaFileListRequest>"];
		
		var authCookie = $.cookie("SEPA_AUTH_3");
		
		// Build the the authentication area.
		xml[xml.length] = ("<auth>" + ((authCookie == null) ? "" : authCookie) + "</auth>");
		
		// Retrieve the focus area.
		xml[xml.length] = ("<focusArea>All</focusArea>");
		
		// Retrieve the data filters definitions.
		xml[xml.length] = ("<dataFilters><dataFilter attributeName='mediaFileSolarSolutionRecommendations' attributeValue='" + recText + "'/></dataFilters><sections>");
		
		xml[xml.length] = (("<section mediaFileType='report,presentation,forms and examples' sortDirection='desc' pageNumber='1' fileCountPerPage='100' includePermanentContent='0'/>"));
		
		xml[xml.length] = ("</sections></mediaFileListRequest>");
		
		return xml.join('');
	}
	catch (e)
	{
		return ("<mediaFileListRequest/>");
	}	
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Retrieves the library resources for a specified recommendation.
// Last Revision Date:  12/10/2008
// Parameters:
//		recText:  The recommendation for which to retrieve resources
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function RetrieveMediaFilesForRecommendation(recText)
{
	try
	{
		// Empty the resources list.
		JOIT.RL.empty();
		
		// Show the feedback control.
		JOIT.FC.show();
		
		//alert("mediaFileListRequestXML=" + GetMediaFileListInstructions(recText));
		
		// Retrieve the data.
		_DFServiceProxy.invokeXML("GetMediaFileList4",
		"mediaFileListRequestXML=" + GetMediaFileListInstructions(recText),
	    function(responseXML)
	    {
			if (responseXML != null)
			{
				var nodes = $(responseXML).find("mediaFile");
				var message = "No library resources were found";
				
				if (nodes)
				{
					var i = 0;
					var countNodes = nodes.length;
					var html = [];
					var _isUserAuthenticated = IsUserAuthenticated();
					
					// Construct the output message.
					if (countNodes > 0)
					{
						message = (countNodes + " library resource" + ((countNodes > 1) ? "s were found" : " was found"));
					}		
					
					// Split the item text into the group and name.
					var itemParts = recText.replace(AMPERSAND_REPLACEMENT, "&amp;").split("|");
					
					html[html.length] = ('<p class="resource">' + message + ' for the "' + itemParts[1] + '" recommendation.</p>');					
					
					while (i < countNodes)					
					{
						//'<p class="resource"><a href="${url}" target="_blank" title="${title}">${text}</a></p>
						html[html.length] = ('<p class="resource">' + ResourceItemBuilder(nodes[i], _isUserAuthenticated) + '</p>');
						
						++i;
					}		
					
					JOIT.RL.html(html.join(''));									
				}
				
				RedirectProtectedLinksToLogin();
				
				// Hide the feedback control.
				JOIT.FC.hide();
			}				
	    },
	    function(errorMessage)
	    {
	        JOIT.RL.prepend('<p class="resource">There was an error while retrieving the resources for the recommendation.</p>');
			
			// Hide the feedback control.
			JOIT.FC.hide();
	    },
		true);
	}
	catch (e)
	{
		alert("There was an error in the 'GetMediaFileList' function:\n\n" + e);	
	}	
}

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Purpose:  Retrieves the XML configuration for the tool.
// Last Revision Date:  12/10/2008
// Parameters:
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function RetrieveToolConfiguration()
{
	try
	{
		// Retrieve the list of solar solutions recommendations via webservice.
		_DFServiceProxy.invokeXML("GetSolarSolutionsToolConfiguration",
		"",
	    function(responseXML)
	    {
			if (responseXML)		
			{
				// Find the nodes that represent the recommendations.
				var recommendationNodes = $(responseXML).find("recommendation");
				// Find the nodes that represent the scenarios or profiles.
				var scenarioNodes = $(responseXML).find("scenario");
				
				var lastRecGroupName = "";
				var lastRecGroupIndex = -1;
				
				// Process the recommendation nodes.
				if (recommendationNodes != null)			
				{
					var i = 0;
					var countRecNodes = recommendationNodes.length;
					
					while (i < countRecNodes)					
					{
						var _recNode = $(recommendationNodes[i]);
						// Retrieve the description group.
						var groupName = _recNode.attr("group");						
						// Retrieve the description name.
						var name = _recNode.attr("name");						
						// Retrieve the recommendation description.
						var desc = _recNode.attr("desc");
						
						// If this is a new recommendation group, append a new <div> for the recommendation group.
						if (groupName != lastRecGroupName)						
						{
							JOIT.AGAC.append(('<div class="recGroupName">' + groupName + '</div><ul id="recGroup' + (++lastRecGroupIndex) + '" class="recItems"></ul>'));
							
							lastRecGroupName = groupName;
						}

						// Build the group|name pair.
						var g_n = (groupName + '|' + name);

						// Append the recommendation definition.
						$("#recGroup" + lastRecGroupIndex).append('<li><a class="recDef" rel="' + g_n + '" title="' + name + ' Definition:|' + desc + '"></a> <a class="recItem" rel="' + g_n + '">' + name + '</a></li>');

						// Prepare for the next loop iteration.
						++i;
					}
				}
				
				// Process the scenario nodes.
				if (scenarioNodes != null)			
				{
					var i = 0;
					var countScenarioNodes = scenarioNodes.length;
					var html = [];
					
					while (i < countScenarioNodes)					
					{
						var index = i.toString();
						var _sceNode = $(scenarioNodes[i]);
						var recText = [];
						
						// Retrieve the scenario name.
						var sceName = _sceNode.attr("name");
						// Retrieve the scenario description.
						var sceDesc = _sceNode.find("desc").text();
						
						// For each scenario node, find the recommendation child nodes.
						var _recs = _sceNode.find("recs");
						
						if (_recs != null)
						{
							var finalIndex = (_recs.find("rec").length - 1);
							
							// Retrieve the scenario recommendations.
							var j = 0;
							var _recs2 = _recs.find("rec");
							var countRecs = _recs2.length;
							
							while (j < countRecs)							
							{
								recText[recText.length] = ($(_recs2[j]).text() + (j != finalIndex ? "," : ""));
								
								// Prepare for the next loop iteration.
								++j;
							}
						
							html[html.length] = ('<h3><a href="#" class="scenario" rel="recs' + index + '">' + sceName + '</a></h3><div>' + sceDesc + '<input id="recs' + index + '" type="hidden" value="' + recText.join('') + '" /></div>')
						}

						// Prepare for the next loop iteration.
						++i;
					}
					
					JOIT.ACSC.html(html.join(''));
					
					// Initialize the scenario link elements.
					InitializeScenarioLinks();
					
					// Locate the first topic link, and prepend a separator element.
					$("#accContSCE a.scenario:contains('Topic'):first").parent().prepend('<div class="firstTopicSep"></div>');					
				}
			
				// Initialize the display with the accordion controls.
				InitializeDisplay("#buttonScenarios");
			}					
	    },
	    function(errorMessage)
	    {
	        alert(errorMessage);
	    },
		true);
	}
	catch (e)
	{
		alert("The attempt to retrieve the Solar Solution Tool recommendations failed with the following error:\n\n" + e);
	}
}

var timer = null;

function CopyFormFields()
{
	// Copy the form fields to the iframe's form.
	$('#cboxIframe').contents().find('body #frmContactSEPAFooter').append( $('#frmSST').html());
	
	// Cancel the timer.
	window.clearTimeout(timer);
	
	timer = null;	
}

$(document).ready(function()
{
	// Retrieve the scenarios and recommendations.
	RetrieveToolConfiguration();
	
	$("#contactRD").click(function()	
	{
		$(this).colorbox({width: function()
			{
				return GetCBDimensionFromClass(this.className, 'w', '50%');
			}
			,height: function()
			{
				return GetCBDimensionFromClass(this.className, 'h', '25%');
			}
			,iframe:true
			,onComplete:function()			
			{
				// The timer event is needed to allow the iframe time to load and initialize.
				window.setTimeout(CopyFormFields, 1500);			
			}
		});			
	});
		
	$("a.sstType").click(function()
	{
		InitializeDisplay(this.id);
	});
	
	$("#authEventLink").bind("click", function()	
	{
		RetrieveMediaFilesForRecommendation(LAST_CLICKED_REC_TEXT);
	});
})
