if(typeof QFAMS==="undefined"||!QFAMS){var QFAMS={}}QFAMS.env=QFAMS.env||{persistantSelection:false,persistantMove:true};QFAMS.updateCounter=function(e,a){var b;var d=null;if(e!==null){if(e.childNodes){for(b=0;b<e.childNodes.length;b++){e.removeChild(e.childNodes[b])}}d=document.createTextNode(a);e.appendChild(d)}};QFAMS.updateLiveCounter=function(){var g=this.parentNode;var b=0;var j=g.parentNode;var a=j.getElementsByTagName("input");for(var c=0;c<a.length;c++){if(a[c].checked==1){b++}}var h=j.id;var f=h.substring(h.indexOf("_",0)+1,h.length);var d=document.getElementById(f+"_selected");QFAMS.updateCounter(d,b+"/"+a.length)};QFAMS.editSelection=function(f,g){if(g!==0&&g!==1&&g!==2){return}var c=0;var a=document.getElementById("qfams_"+f);var b=a.getElementsByTagName("input");for(var d=0;d<b.length;d++){if(g===2){if(b[d].checked==0){b[d].checked=1}else{if(b[d].checked==1){b[d].checked=0}}}else{b[d].checked=g}if(b[d].checked==1){c++}}var e=document.getElementById(f+"_selected");QFAMS.updateCounter(e,c+"/"+b.length)};QFAMS.moveSelection=function(qfamsName,selectLeft,selectRight,selectHidden,action,arrange){var isIE=
/*@cc_on!@*/
false;var source=null;var target=null;var option;var c=null;var s=null;var i;var maxFrom,maxTo;if(action==="add"||action==="all"||action==="toggle"){source=selectLeft;target=selectRight}else{source=selectRight;target=selectLeft}if(source.selectedIndex===-1&&(action==="add"||action==="remove")){return}maxFrom=source.options.length;maxTo=target.options.length;if(maxTo>0&&target.options[0].value===""){target.removeAttribute("disabled");target.options[0]=null}for(i=(maxFrom-1);i>=0;i--){if(action==="all"||action==="none"||action==="toggle"||source.options[i].selected===true){if(source.options[i].disabled===false){if(isIE){option=source.options[i].removeNode(true);option.selected=QFAMS.env.persistantSelection;target.appendChild(option)}else{option=source.options[i].cloneNode(true);option.selected=QFAMS.env.persistantSelection;target.options[target.options.length]=option}}}}if(!isIE){for(i=(maxFrom-1);i>=0;i--){if(action==="all"||action==="none"||action==="toggle"||source.options[i].selected===true){if(source.options[i].disabled===false){source.options[i]=null}}}}if(action==="toggle"){for(i=(maxTo-1);i>=0;i--){if(target.options[i].disabled===false){if(isIE){option=target.options[i].removeNode(true);option.selected=QFAMS.env.persistantSelection;source.appendChild(option)}else{option=target.options[i].cloneNode(true);option.selected=QFAMS.env.persistantSelection;source.options[source.options.length]=option}}}if(!isIE){for(i=(maxTo-1);i>=0;i--){if(target.options[i].disabled===false){target.options[i]=null}}}}c=document.getElementById(qfamsName+"_unselected");s=document.getElementById(qfamsName+"-f");QFAMS.updateCounter(c,s.length);c=document.getElementById(qfamsName+"_selected");s=document.getElementById(qfamsName+"-t");QFAMS.updateCounter(c,s.length);if(arrange!=="none"){QFAMS.sortList(target,QFAMS.compareText,arrange)}QFAMS.updateHidden(selectHidden,selectRight)};QFAMS.sortList=function(d,a,e){var c;var b=new Array(d.options.length);for(c=0;c<b.length;c++){b[c]=new Option(d.options[c].text,d.options[c].value,d.options[c].defaultSelected,d.options[c].selected)}b.sort(a);if(e==="desc"){b.reverse()}d.options.length=0;for(c=0;c<b.length;c++){d.options[c]=b[c]}};QFAMS.compareText=function(b,a){if(b.text===a.text){return 0}return b.text<a.text?-1:1};QFAMS.updateHidden=function(b,c){var a;for(a=0;a<b.length;a++){b.options[a].selected=false}for(a=0;a<c.length;a++){b.options[b.length]=new Option(c.options[a].text,c.options[a].value);b.options[b.length-1].selected=true}};QFAMS.moveUp=function(a,b){var c=a.selectedIndex;if(c<0){return}if(c>0){QFAMS.moveSwap(a,c,c-1);QFAMS.updateHidden(b,a)}};QFAMS.moveDown=function(a,b){var c=a.selectedIndex;if(c<0){return}if(c<a.options.length-1){QFAMS.moveSwap(a,c,c+1);QFAMS.updateHidden(b,a)}};QFAMS.moveTop=function(a,b){var c=a.selectedIndex;if(c<0){return}while(c>0){QFAMS.moveSwap(a,c,c-1);QFAMS.updateHidden(b,a);c--}};QFAMS.moveBottom=function(a,b){var c=a.selectedIndex;if(c<0){return}while(c<a.options.length-1){QFAMS.moveSwap(a,c,c+1);QFAMS.updateHidden(b,a);c++}};QFAMS.moveSwap=function(a,c,b){var d;d=a.replaceChild(a.options[c],a.options[b]);if(c>b){a.insertBefore(d,a.options[b].nextSibling)}else{a.insertBefore(d,a.options[c])}if(QFAMS.env.persistantMove){a.selectedIndex=b}else{a.selectedIndex=-1}};QFAMS.init=function(f){var c,b;for(c=0;c<f.length;c++){var d=document.getElementById("qfams_"+f[c]);if(d!==null){var a=d.getElementsByTagName("input");if(a!==null){for(b=0;b<a.length;b++){a[b].onclick=QFAMS.updateLiveCounter}}}}};
