function Form2_MultipleSelection_SwapOptions(a,b){strValueOf1=a.value;strInnerHTMLOf1=a.innerHTML;blnSelectOf1=a.selected;a.value=b.value;a.selected=b.selected;a.innerHTML=b.innerHTML;b.value=strValueOf1;b.selected=blnSelectOf1;b.innerHTML=strInnerHTMLOf1};function Form2_MultipleSelection_ToggleSelectAll(a,b){blnAllSelected=document.getElementById(b+"_selectAll").style.display=="none";for(i=0;i<eval("document."+a+"."+b+".length");i++){eval("document."+a+"."+b+".options["+i+"].selected = "+!blnAllSelected)}Form2_MultipleSelection_UpdateOptions(a,b)};function Form2_MultipleSelection_UpdateOptions(a,b){blnAllSelected=true;for(i=0;i<eval("document."+a+"."+b+".length");i++){if(eval("document."+a+"."+b+".options["+i+"].selected")==false){blnAllSelected=false;break}}if(blnAllSelected){document.getElementById(b+"_selectAll").style.display="none";document.getElementById(b+"_deselectAll").style.display="block"}else{document.getElementById(b+"_selectAll").style.display="block";document.getElementById(b+"_deselectAll").style.display="none"}};function Form2_MultipleSelection_UpdateSorting(a,b,c){if(c!==null){blnSelection=false;blnSelectionCoherent=true;blnNoMoreUp=true;blnNoMoreDown=true;intNumSelected=0;for(i=0;i<eval("document."+a+"."+b+".length");i++){if(eval("document."+a+"."+b+".options["+i+"].selected")==true){if(blnNoMoreUp&&i>intNumSelected&&blnSelectionCoherent){blnNoMoreUp=false}if(!blnNoMoreDown){blnSelectionCoherent=false;blnNoMoreDown=true;blnNoMoreUp=true}intNumSelected++;blnSelection=true}else{if(blnNoMoreDown&&blnSelection&&blnSelectionCoherent){blnNoMoreDown=false}}}if(c=="up"&&!blnNoMoreUp){elmLastOption=null;for(i=0;i<eval("document."+a+"."+b+".length");i++){elmCurrOption=eval("document."+a+"."+b+".options["+i+"]");if(elmCurrOption.selected){Form2_MultipleSelection_SwapOptions(elmCurrOption,elmLastOption)}elmLastOption=elmCurrOption}Form2_MultipleSelection_UpdateSortingOptions(a,b)}else if(c=="down"&&!blnNoMoreDown){elmLastOption=null;for(i=eval("document."+a+"."+b+".length")-1;i>=0;i--){elmCurrOption=eval("document."+a+"."+b+".options["+i+"]");if(elmCurrOption.selected){Form2_MultipleSelection_SwapOptions(elmCurrOption,elmLastOption)}elmLastOption=elmCurrOption}Form2_MultipleSelection_UpdateSortingOptions(a,b)}}strValue="";for(i=0;i<eval("document."+a+"."+b+".length");i++){strValue+=eval("document."+a+"."+b+".options["+i+"]").value+";"}if(strValue.length>0)strValue=strValue.substring(0,strValue.length-1);document.getElementById(b+"_sorting").value=strValue};function Form2_MultipleSelection_UpdateSortingOptions(a,b){blnSelection=false;blnSelectionCoherent=true;blnNoMoreUp=true;blnNoMoreDown=true;intNumSelected=0;for(i=0;i<eval("document."+a+"."+b+".length");i++){if(eval("document."+a+"."+b+".options["+i+"].selected")==true){if(blnNoMoreUp&&i>intNumSelected&&blnSelectionCoherent){blnNoMoreUp=false}if(!blnNoMoreDown){blnSelectionCoherent=false;blnNoMoreDown=true;blnNoMoreUp=true}intNumSelected++;blnSelection=true}else{if(blnNoMoreDown&&blnSelection&&blnSelectionCoherent){blnNoMoreDown=false}}}if(blnNoMoreDown){document.getElementById(b+"_downActive").style.display="none";document.getElementById(b+"_down").style.display="block"}else{document.getElementById(b+"_downActive").style.display="block";document.getElementById(b+"_down").style.display="none"}if(blnNoMoreUp){document.getElementById(b+"_upActive").style.display="none";document.getElementById(b+"_up").style.display="block"}else{document.getElementById(b+"_upActive").style.display="block";document.getElementById(b+"_up").style.display="none"}};function Form2_Overview(d,e){var f=e;var g=new Array();var h=d;var k=false;var l=new Array();this.addMandatoryField=function(a,b){g[a][g[a].length]=b};this.addTable=function(a){l[l.length]=a;g[a]=new Array()};this.executeJSAfter=function(){f();if(typeof jQuery!='undefined'){$(this.getForm()).submit(function(){eval(h+"_overview.setSubmitted(true);")})}};this.getForm=function(){return eval("document."+h)};this.getName=function(){return h};this.getTables=function(){return l};this.getTableSuccessor=function(a){for(i=0;i<l.length;i++){if(l[i]==a&&i<l.length-1){return l[i+1]}}return null};this.isDirty=function(){form=this.getForm();if(document.getElementById(h+"_dirtyIndicator")){return document.getElementById(h+"_dirtyIndicator").value=="1"}for(var i=0;i<form.elements.length;i++){var a=form.elements[i];var b=a.type;if(b=="checkbox"||b=="radio"){if(a.checked!=a.defaultChecked){return true}}else if(b=="hidden"||b=="password"||b=="text"||b=="textarea"){if(a.value!=a.defaultValue){return true}}else if(b=="select-one"||b=="select-multiple"){var c=false;for(var j=0;j<a.options.length;j++){if(a.options[j].selected!=a.options[j].defaultSelected){if(a.options[j].defaultSelected==false&&j==0&&b=="select-one"&&!c){c=true;continue}return true}}}}return false};this.isMandatoryFilled=function(a){for(i=0;i<g[a].length;i++){if(document.getElementById(g[a][i]).value==""){return false}}return true};this.isSubmitted=function(){return k};this.isSubmittedInternally=function(){return document.getElementById(h+"_internalSubmit").value=="1"};this.setSubmitted=function(a){k=a}};function Form2_SelectionDialog(b,c,d,e){var f="SelectionDialog";var g=c;var h;var i=e;var j=b;var k;this.close=function(){if(k!=null){k.close();k=null}this.variables_write();if(i!=null){if(opener){opener.eval(i)}else{eval(i)}}if(opener){window.close();opener.focus()}else{window.focus()}};this.open=function(){k=window.open(j,f,"width=740,height=600,left=100,top=100,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,dependent=yes,hotkeys=no");k.selectionDialog=this;k.focus()};this.serialize=function(){strOutput="";strOutput+=g.toString();strOutput+="+++";strOutput+=i.replace(/;/g,"semicolon");return strOutput};this.variables_set=function(a){h=a};this.variables_write=function(){for(var a in h){objDocument=opener?opener.document:document;if(objDocument.getElementsByName(g[a])[0].type=="checkbox"){objDocument.getElementsByName(g[a])[0].checked=h[a]=="1"?"checked":""}else{objDocument.getElementsByName(g[a])[0].value=h[a]}}};if(d==null||d){this.open()}};function Form2_SelectionDialog_unserialize(a){arrPieces=a.split("+++");arrParams=arrPieces[0].split(",");strToEvalAtClosure=arrPieces[1].replace(/semicolon/g,";");objDialog=new Form2_SelectionDialog("",arrParams,false,strToEvalAtClosure);return objDialog};function Form2_StarRating_updateDisplay(a,b){blnFound=false;for(var i=b.length-1;i>=0;i--){if(document.getElementById(a+'_value').value==b[i])blnFound=true;document.getElementById(a+'_'+b[i]).style.display=blnFound?'none':'block';document.getElementById(a+'_'+b[i]+'_filled').style.display=blnFound?'block':'none'}};function Form2_SubmitInternal(a){document.getElementById(a.getName()+"_internalSubmit").value="1";page_scroll_offset_save();a.setSubmitted(true);eval("document."+a.getName()+".submit();")};function Form2_Wizard_DisplayNext(a,b){var c=null;if(b){c=a.getTableSuccessor(b)}else if(a.getTables().length>0){c=a.getTables()[0]}if(c){if(b==null||a.isMandatoryFilled(b)){document.getElementById(c).style.visibility="visible";Form2_Wizard_DisplayNext(a,c)}}};function Form2_Wizard_LoadNext(c,d,e,f){var g=null;if(typeof(form2WizardLoadNextCallNo)=="undefined")form2WizardLoadNextCallNo=1;else form2WizardLoadNextCallNo++;var h=form2WizardLoadNextCallNo;if(e){g=c.getTableSuccessor(e)}else if(c.getTables().length>0){g=c.getTables()[0]}if(g){document.getElementById(c.getName()+"_internalSubmit").value="1";var i=$("#"+g);while(i.attr("tagName")!="FORM"){i=i.parent()}var j=g.substr(g.lastIndexOf("table")+5);var k=i.serialize();i.children(".Form2_WizardElement").each(function(a,b){if(a>=j){$(this).hide()}if(a==j){$(this).before('<div class="Form2_WizardElement wizard_loading" id="'+g+'">'+f+'</div>')}});$.post(d,"ajaxCall=getContent&nextId="+g+"&"+k,function(a){if(h==form2WizardLoadNextCallNo){$("#"+g).nextAll(".Form2_WizardElement").remove();$("#"+g).replaceWith(a);Form2_Wizard_DisplayNext(c);document.getElementById(c.getName()+"_internalSubmit").value="0"}})}};
