Drupal.behaviors.attachVoteAjax=function(context){$("form.advpoll-vote",context).each(function(){var thisForm=this,options={dataType:"json",success:function(data){$("div.messages").remove();if(data.errors){$(data.errors).insertBefore(thisForm).fadeIn()}else{$(thisForm).hide();$(data.statusMsgs).insertBefore(thisForm).fadeIn();$(data.response).insertBefore(thisForm)};$(".form-submit",thisForm).removeAttr("disabled")},beforeSubmit:function(){$(".form-submit",thisForm).attr("disabled","disabled")}};$("input.ajax",thisForm).val(true);$(this).ajaxForm(options)})};Drupal.behaviors.handleWriteins=function(context){$("form.advpoll-vote:not(.handleWriteins-processed)",context).addClass("handleWriteins-processed").each(function(){var poll=this;if($(".writein-choice",poll).length==0)return;$(".vote-choices input[type=radio], .vote-choices input[type=checkbox]",poll).click(function(){var isLast=$(this).val()==$(".vote-choices input[type=radio]:last, .vote-choices input[type=checkbox]:last",poll).val(),type=$(this).attr("type");if(isLast||type=="radio"){var showChoice=isLast&&(type=="radio"||$(this).attr("checked"));$(".writein-choice",poll).css("display",showChoice?"inline":"none");if(showChoice){$(".writein-choice",poll)[0].focus()}else $(".writein-choice",poll).val("")}});$(".vote-choices select:last",poll).change(function(){var showChoice=$(this).val()>0,alreadyVisible=$(".writein-choice",poll).css("display")=="inline";$(".writein-choice",poll).css("display",showChoice?"inline":"none");if(!showChoice){$(".writein-choice",poll).val("")}else if(!alreadyVisible)$(".writein-choice",poll)[0].focus()})})};Drupal.behaviors.rankingDragAndDrop=function(context){$('form.advpoll-vote.drag-and-drop:not(.advpoll-drag-and-drop-processed)',context).addClass('advpoll-drag-and-drop-processed').each(function(){var mainForm=$(this),formId=mainForm.attr('id'),$existingChoicesTable=$('.advpoll-existing-choices-table',mainForm),stringRemoveFromVote=Drupal.t('(x)'),stringRemoveFromVoteURL=document.location.href+'/'+Drupal.t('remove-from-vote'),stringAddToVote=Drupal.t('add &gt;'),stringAddToVoteURL=document.location.href+'/'+Drupal.t('add-to-vote'),voteButton=$(".form-submit",mainForm),newVoteButton=voteButton.clone().attr("disabled","true").css("margin-left","10px").css("margin-top","4px").addClass("vote-button");voteButton.remove();$('.advpoll-drag-box',mainForm).append(newVoteButton);$(this).parent().parent().siblings().filter(".writein-choice").clone().insertAfter($("select.advpoll-writeins",mainForm));$("select.form-select",mainForm).css('display','none');$("select.form-select",mainForm).addClass('advpoll-choice-order');var maxChoices=parseInt(mainForm.find('input[name=max_choices]').val());$('.vote-choices div.form-item',$(this)).wrapAll('<ul class="advpoll-pending-choices-list"></ul>').wrap('<li class="advpoll-choice-container"></li>').removeClass("form-item").addClass("advpoll-pending-choice").each(function(){$(this).parent().attr("id","choice-"+parseInt($(this).attr("id").replace(/[^0-9]/g,"")));$(this).append('<a href="'+stringAddToVoteURL+'" class="advpoll-add-to-vote advpoll-choice-action-link">'+stringAddToVote+'</a>')
function handleChoiceClick(event){event.preventDefault();var $element=$(event.target),isPending=$element.parent('.advpoll-pending-choice').size()>0,choiceType=isPending?'pending':'existing',choiceNotType=isPending?'existing':'pending',$choice=$element.parent('.advpoll-'+choiceType+'-choice'),$pendingChoicesList=$('.advpoll-pending-choices-list',mainForm),$newChoice=$choice.clone(true).removeClass('advpoll-'+choiceType+'-choice').addClass('advpoll-'+choiceNotType+'-choice').find("a.advpoll-choice-action-link").html(isPending?stringRemoveFromVote:stringAddToVote).attr('href',isPending?stringRemoveFromVoteURL:stringAddToVoteURL).removeClass(isPending?'advpoll-add-to-vote':'advpoll-remove-from-vote').addClass(isPending?'advpoll-remove-from-vote':'advpoll-add-to-vote').end(),$newRow=isPending?$('<tr class="draggable advpoll-choice-container"><td class="advpoll-receive-choice"></td></tr>'):$('<li class="advpoll-receive-choice advpoll-choice-container"></li>');if(isPending){$newRow.find('.advpoll-receive-choice').append($newChoice);$existingChoicesTable.append($newRow)}else{$newRow.append($newChoice);$pendingChoicesList.append($newRow);$newRow.find('select.advpoll-choice-order').val(0)};$choice.parents('.advpoll-choice-container').remove();var currentOrder=0;$("tr.advpoll-choice-container select.advpoll-choice-order",$existingChoicesTable).each(function(){if($(this).val()!=currentOrder+1)$(this).val(currentOrder+1);currentOrder++});var currentChoices=currentOrder;if(currentChoices<=1);else{$existingChoicesTable.removeClass('dragtable-processed');Drupal.attachBehaviors($existingChoicesTable)};$(".vote-status",mainForm).show().html(Drupal.t("Choices remaining: %choices",{"%choices":maxChoices-currentChoices}));if(currentChoices>maxChoices){$(".vote-status",mainForm).addClass("error");newVoteButton.attr("disabled","true")}else{newVoteButton.attr("disabled","");$(".vote-status",mainForm).removeClass("error")};if(currentChoices==1){newVoteButton.attr("disabled","")}else if(currentChoices==0)newVoteButton.attr("disabled","true");$('.tabledrag-handle',$existingChoicesTable).remove();$existingChoicesTable.removeClass('tabledrag-processed');Drupal.attachBehaviors($existingChoicesTable)};$("label",this).click(handleChoiceClick);$("a.advpoll-choice-action-link",this).click(handleChoiceClick)});if($('.writein-choice input',mainForm).size()>0){var newInput=$(".writein-choice input",mainForm).clone().css("display","inline");$(".writein-choice",mainForm).remove();$("li:last .advpoll-pending-choice",mainForm).append("<br />").append(newInput)};newVoteButton.click(function(){var currentOrder=1;$("tr.advpoll-choice-container select.advpoll-choice-order",mainForm).each(function(){$(this).val(currentOrder);currentOrder++})})})};

/*
 * jQuery Form Plugin
 * version: 2.01 (10/31/2007)
 * @requires jQuery v1.1 or later
 *
 * Examples at: http://malsup.com/jquery/form/
 * 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,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[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}('(5($){$.7.1j=5(o){2(P o==\'5\')o={L:o};o=$.2h({1h:4.X(\'2i\')||1E.2u.3D(),I:4.X(\'2g\')||\'29\'},o||{});3 p={};$.M.N(\'R.2P.2L\',[4,o,p]);2(p.1Q)6 4;3 a=4.1z(o.2r);2(o.V){H(3 n 3u o.V)a.C({z:n,A:o.V[n]})}2(o.28&&o.28(a,4,o)===E)6 4;$.M.N(\'R.K.36\',[a,4,o,p]);2(p.1Q)6 4;3 q=$.1x(a);2(o.I.31()==\'29\'){o.1h+=(o.1h.2Z(\'?\')>=0?\'&\':\'?\')+q;o.V=B}8 o.V=q;3 r=4,U=[];2(o.1r)U.C(5(){r.1r()});2(o.1o)U.C(5(){r.1o()});2(!o.18&&o.14){3 u=o.L||5(){};U.C(5(a){2(4.1N)$(o.14).X("1M",a).1N().D(u,1L);8 $(o.14).2t(a).D(u,1L)})}8 2(o.L)U.C(o.L);o.L=5(a,b){H(3 i=0,F=U.G;i<F;i++)U[i](a,b,r)};3 v=$(\'19:3v\',4).15();3 w=E;H(3 j=0;j<v.G;j++)2(v[j])w=T;2(o.2f||w){2($.1i.3o&&o.2a)$.3l(o.2a,1l);8 1l()}8 $.3h(o);$.M.N(\'R.K.3f\',[4,o]);6 4;5 1l(){3 d=r[0];3 f=$.2h({},$.39,o);3 h=\'35\'+$.7.1j.1a++;3 i=$(\'<2f 33="\'+h+\'" z="\'+h+\'" />\');3 j=i[0];3 k=$.1i.20&&1E.20.30()<9;2($.1i.1X||k)j.2Y=\'2W:E;1w.2U("");\';i.2S({2R:\'2Q\',23:\'-24\',1R:\'-24\'});3 l={Z:B,1b:B,2K:0,2J:\'n/a\',2H:5(){},2F:5(){},2E:5(){}};3 g=f.2B;2(g&&!$.1O++)$.M.N("2x");2(g)$.M.N("2w",[l,f]);3 m=0;3 n=0;1f(5(){i.2v(\'1n\');j.1K?j.1K(\'1J\',12):j.2s(\'1I\',12,E);3 a=d.1H?\'1H\':\'2q\';3 t=r.X(\'14\');r.X({14:h,2g:\'3C\',2i:f.1h});d[a]=\'3B/R-V\';2(f.1G)1f(5(){n=T;12()},f.1G);d.K();r.X(\'14\',t)},10);5 12(){2(m++)6;j.2o?j.2o(\'1J\',12):j.3A(\'1I\',12,E);3 a=T;3z{2(n)3x\'1G\';3 b,O;O=j.2n?j.2n.1w:j.2l?j.2l:j.1w;l.Z=O.1n?O.1n.1M:B;l.1b=O.2k?O.2k:O;2(f.18==\'2j\'||f.18==\'3s\'){3 c=O.1D(\'1C\')[0];b=c?c.A:l.Z;2(f.18==\'2j\')3r("V = "+b);8 $.3q(b)}8 2(f.18==\'2m\'){b=l.1b;2(!b&&l.Z!=B)b=2d(l.Z)}8{b=l.Z}}3p(e){a=E;$.3n(f,l,\'2b\',e)}2(a){f.L(b,\'L\');2(g)$.M.N("3m",[l,f])}2(g)$.M.N("3k",[l,f]);2(g&&!--$.1O)$.M.N("3j");2(f.27)f.27(l,a?\'L\':\'2b\');1f(5(){i.3i();l.1b=B},3g)};5 2d(s,a){2(1E.26){a=25 26(\'3d.3c\');a.3b=\'E\';a.3a(s)}8 a=(25 38()).37(s,\'1A/2m\');6(a&&a.22&&a.22.1e!=\'34\')?a:B}}};$.7.1j.1a=0;$.7.W=5(a){6 4.21().K(1m).D(5(){4.1u=$.7.W.1a++;$.7.W.1t[4.1u]=a;$(":K,19:Y",4).1Z(1s)})};$.7.W.1a=1;$.7.W.1t={};5 1s(e){3 a=4.R;a.Q=4;2(4.I==\'Y\'){2(e.1Y!=S){a.11=e.1Y;a.16=e.2X}8 2(P $.7.1U==\'5\'){3 b=$(4).1U();a.11=e.1V-b.1R;a.16=e.1W-b.23}8{a.11=e.1V-4.2V;a.16=e.1W-4.32}}1f(5(){a.Q=a.11=a.16=B},10)};5 1m(){3 a=4.1u;3 b=$.7.W.1t[a];$(4).1j(b);6 E};$.7.21=5(){4.1T(\'K\',1m);6 4.D(5(){$(":K,19:Y",4).1T(\'1Z\',1s)})};$.7.1z=5(b){3 a=[];2(4.G==0)6 a;3 c=4[0];3 d=b?c.1D(\'*\'):c.2T;2(!d)6 a;H(3 i=0,F=d.G;i<F;i++){3 e=d[i];3 n=e.z;2(!n)1v;2(b&&c.Q&&e.I=="Y"){2(!e.1d&&c.Q==e)a.C({z:n+\'.x\',A:c.11},{z:n+\'.y\',A:c.16});1v}3 v=$.15(e,T);2(v&&v.1c==1g){H(3 j=0,1S=v.G;j<1S;j++)a.C({z:n,A:v[j]})}8 2(v!==B&&P v!=\'S\')a.C({z:n,A:v})}2(!b&&c.Q){3 f=c.1D("19");H(3 i=0,F=f.G;i<F;i++){3 g=f[i];3 n=g.z;2(n&&!g.1d&&g.I=="Y"&&c.Q==g)a.C({z:n+\'.x\',A:c.11},{z:n+\'.y\',A:c.16})}}6 a};$.7.2O=5(a){6 $.1x(4.1z(a))};$.7.2N=5(b){3 a=[];4.D(5(){3 n=4.z;2(!n)6;3 v=$.15(4,b);2(v&&v.1c==1g){H(3 i=0,F=v.G;i<F;i++)a.C({z:n,A:v[i]})}8 2(v!==B&&P v!=\'S\')a.C({z:4.z,A:v})});6 $.1x(a)};$.7.15=5(a){H(3 b=[],i=0,F=4.G;i<F;i++){3 c=4[i];3 v=$.15(c,a);2(v===B||P v==\'S\'||(v.1c==1g&&!v.G))1v;v.1c==1g?$.3e(b,v):b.C(v)}6 b};$.15=5(b,c){3 n=b.z,t=b.I,13=b.1e.1F();2(P c==\'S\')c=T;2(c&&(!n||b.1d||t==\'17\'||t==\'2M\'||(t==\'1q\'||t==\'1B\')&&!b.1p||(t==\'K\'||t==\'Y\')&&b.R&&b.R.Q!=b||13==\'J\'&&b.1y==-1))6 B;2(13==\'J\'){3 d=b.1y;2(d<0)6 B;3 a=[],1k=b.2I;3 e=(t==\'J-2e\');3 f=(e?d+1:1k.G);H(3 i=(e?d:0);i<f;i++){3 g=1k[i];2(g.2c){3 v=$.1i.1X&&!(g.2G[\'A\'].3t)?g.1A:g.A;2(e)6 v;a.C(v)}}6 a}6 b.A};$.7.1o=5(){6 4.D(5(){$(\'19,J,1C\',4).2p()})};$.7.2p=$.7.2D=5(){6 4.D(5(){3 t=4.I,13=4.1e.1F();2(t==\'1A\'||t==\'3w\'||13==\'1C\')4.A=\'\';8 2(t==\'1q\'||t==\'1B\')4.1p=E;8 2(13==\'J\')4.1y=-1})};$.7.1r=5(){6 4.D(5(){2(P 4.17==\'5\'||(P 4.17==\'2C\'&&!4.17.3y))4.17()})};$.7.2A=5(b){2(b==S)b=T;6 4.D(5(){4.1d=!b})};$.7.J=5(b){2(b==S)b=T;6 4.D(5(){3 t=4.I;2(t==\'1q\'||t==\'1B\')4.1p=b;8 2(4.1e.1F()==\'1P\'){3 a=$(4).2z(\'J\');2(b&&a[0]&&a[0].I==\'J-2e\'){a.2y(\'1P\').J(E)}4.2c=b}})}})(3E);',62,227,'||if|var|this|function|return|fn|else|||||||||||||||||||||||||||name|value|null|push|each|false|max|length|for|type|select|submit|success|event|trigger|doc|typeof|clk|form|undefined|true|callbacks|data|ajaxForm|attr|image|responseText||clk_x|cb|tag|target|fieldValue|clk_y|reset|dataType|input|counter|responseXML|constructor|disabled|tagName|setTimeout|Array|url|browser|ajaxSubmit|ops|fileUpload|submitHandler|body|clearForm|checked|checkbox|resetForm|clickHandler|optionHash|formPluginId|continue|document|param|selectedIndex|formToArray|text|radio|textarea|getElementsByTagName|window|toLowerCase|timeout|encoding|load|onload|attachEvent|arguments|innerHTML|evalScripts|active|option|veto|left|jmax|unbind|offset|pageX|pageY|msie|offsetX|click|opera|ajaxFormUnbind|documentElement|top|1000px|new|ActiveXObject|complete|beforeSubmit|GET|closeKeepAlive|error|selected|toXml|one|iframe|method|extend|action|json|XMLDocument|contentDocument|xml|contentWindow|detachEvent|clearFields|enctype|semantic|addEventListener|html|location|appendTo|ajaxSend|ajaxStart|find|parent|enable|global|object|clearInputs|setRequestHeader|getResponseHeader|attributes|getAllResponseHeaders|options|statusText|status|serialize|button|fieldSerialize|formSerialize|pre|absolute|position|css|elements|write|offsetLeft|javascript|offsetY|src|indexOf|version|toUpperCase|offsetTop|id|parsererror|jqFormIO|validate|parseFromString|DOMParser|ajaxSettings|loadXML|async|XMLDOM|Microsoft|merge|notify|100|ajax|remove|ajaxStop|ajaxComplete|get|ajaxSuccess|handleError|safari|catch|globalEval|eval|script|specified|in|file|password|throw|nodeType|try|removeEventListener|multipart|POST|toString|jQuery'.split('|'),0,{}))
;
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY,track=function(ev){cX=ev.pageX;cY=ev.pageY},compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}},delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])},handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this)try{p=p.parentNode}catch(e){p=this};if(p==this)return false;var ev=jQuery.extend({},e),ob=this;if(ob.hoverIntent_t)ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1)ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1)ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}};return this.mouseover(handleHover).mouseout(handleHover)}})(jQuery);

