$(function(){$("body").addClass("jsEnabled");});function alreadyExecuted(name){var alreadyExecuted=$("body").data("applied."+name);$("body").data("applied."+name,true);return alreadyExecuted;}function applyAutoInputs(){if(alreadyExecuted("applyAutoInputs")){return;}$("input.auto").each(function(){$(this).attr("autocomplete","off");if(!$(this).attr("value")||$(this).attr("value")==""){$(this).attr("value",$(this).attr("title"));}$(this).focus(function(e){if($(this).attr("value")==$(this).attr("title")){$(this).attr("value","");}});$(this).blur(function(e){if(!$(this).attr("value")||$(this).attr("value")==""){$(this).attr("value",$(this).attr("title"));}});});}function applyOnChangeDropdowns(){if(alreadyExecuted("applyOnChangeDropdowns")){return;}$("select.onChangeDrop").each(function(){$(this).change(function(){$(this).addClass("wait");$(this).blur();$(this).parents("form:first").submit();});});}function applyMultipleFileUploads(){if(alreadyExecuted("applyMultipleFileUploads")){return;}function increment(elem,attr){var value=$(elem).attr(attr);var index=value.lastIndexOf("-")+1;var count=new Number(value.substring(index));$(elem).attr(attr,value.substring(0,index)+(count+1));}$("table.file").each(function(){var $table=$(this);$("tr.new a.fileAdder",$table).click(function(){var $row=$(this).parents("tr").eq(0);var $newRow=$row.clone(true);$newRow.find("input,select").val("").each(function(){increment(this,"id");increment(this,"name");});$newRow.find("label").val("").each(function(){increment(this,"for");});$(this).hide();if($("tr.new",$table).size()>18){$("a.fileAdder",$newRow).hide();}$newRow.appendTo($table);return false;});});}function applyConfirmation(){if(alreadyExecuted("applyConfirmation")){return;}$("form.needsConfirm").each(function(){var title=$(this).attr("title");$(this).attr("title","");var actionInput=$(this).find("input[name='a']");var action=actionInput.attr("value");var index=action.indexOf(".conf");if(index>0){actionInput.attr("value",action.substring(0,index));}$(this).find("input[type='submit']:not(.cancel)").each(function(){$(this).attr("title",title);}).click(function(){return confirm(title);});});}function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else{expires="";}document.cookie=name+"="+value+expires+"; path=/";}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length);}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length);}}return null;}function pop(oAnchor,sProps,sWindow){var sUserAgent=navigator.userAgent.toLowerCase();var isOp=(sUserAgent.indexOf("opera")!=-1)?true:false;var sUrl="";if(oAnchor.getAttribute){sUrl=oAnchor.getAttribute("href");}if(sUrl==""){sUrl=oAnchor.href;}if(sUrl==""){return true;}var sWindowName=sWindow?sWindow:"reusedWindow";if(!sProps){sProps=null;}if(sUrl){var oPopup=window.open(sUrl,sWindowName,sProps);}if(oPopup&&!isOp){oPopup.focus();}return(oPopup)?false:true;}function applyHttpSessionRefresh(cycleSeconds,maxIdleRefreshes){if(alreadyExecuted("applyRefreshHttpSession")){return;}$("body").data("data.applyRefreshHttpSession.count",maxIdleRefreshes/cycleSeconds);refreshHttpSession(false,1000*cycleSeconds);function refreshHttpSession(refreshNow,millis){if(refreshNow){$.get("session");}var count=$("body").data("data.applyRefreshHttpSession.count");count--;$("body").data("data.applyRefreshHttpSession.count",count);if(count>0){setTimeout(function(){refreshHttpSession(true,millis);},millis);}}}function applyFilterStatus(){var $showHideAnchors=$("#criteriaShowHide a");$showHideAnchors.click(function(){$showHideAnchors.each(function(){$(this).toggleClass("inv");});$("#toolsFilters").slideToggle("slow");});}function applySelectDeselectAll(){$("#select-all").click(function(){$(this).parents("table.pojo").eq(0).find("input:checkbox").attr("checked",$(this).is(":checked"));});}function applyAjaxQuestionnaireLoading(){$("#levels a.ViewItemQuestionnaire").live("click",function(){var $anchor=$(this);var expandThis=$anchor.hasClass("expanded");$anchor.toggleClass("expanded");if(!expandThis){$anchor.parents("li").eq(0).find("ul").each(function(){$(this).fadeOut("medium");});}if(expandThis){var href=$anchor.attr("href");if(href.indexOf("#")>0){href=$(this).attr("href").substring(href.indexOf("?"),href.indexOf("#"));}$.ajax({url:"component"+href,cache:false,dataType:"html",success:function(html){$anchor.parent("span").after($(html).fadeIn("medium"));JT_init();},error:function(){alert("Failed to load content");return false;}});}$(this).parents().each(function(){$(this).removeClass("parent");});return false;});}var fontSizes=new Array("0.8em","0.9em","1em","1.1em","1.2em","1.3em");var currentFontSize=0;function applyStyle(){var cookie=readCookie("fontsize");if(!cookie){cookie=2;}var style=parseInt(cookie);setActiveFontSize(style);}function setActiveFontSize(size){currentFontSize=size;$("#wrapper").css("fontSize",fontSizes[size]);}function getActiveFontSize(){return currentFontSize;}function changeFontSize(amount){var newFontSize=getActiveFontSize()+amount;if(newFontSize<0){newFontSize=0;}if(newFontSize>=fontSizes.length){newFontSize=fontSizes.length-1;}setActiveFontSize(newFontSize);}$(function(){applyStyle();applyOnChangeDropdowns();applyMultipleFileUploads();applyAutoInputs();JT_init();applyMultipleSelectDropdowns();$("a#toolsFontDown").click(function(){changeFontSize(-1);return false;});$("a#toolsFontUp").click(function(){changeFontSize(1);return false;});$("a#toolsPrint").click(function(){window.print();return false;});$("a#toolsSend").toggle(function(){$("form#sendToFriend").show("slow");return false;},function(){$("form#sendToFriend").hide("slow");return false;});$("form#sendToFriend").each(function(){this.style.display="none";});$("a.popup").click(function(){return pop(this,"width=1100, height=750, top=65, left=55, scrollbars, resizable, menubar","pop");});});$(window).unload(function(){createCookie("fontsize",getActiveFontSize(),365);});function JT_init(){$("a.jTip").hover(function(){JT_show(this.href,this.id,this.name);},function(){$("#JT").remove();return false;});}function JT_show(url,linkId,title){if(title==false){title="&nbsp;";}var de=document.documentElement;var w=self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var queryString=url.replace(/^[^\?]+\??/,"");var params=parseQuery(queryString);if(params.width===undefined){params.width=250;}if(params.link!==undefined){$("#"+linkId).bind("click",function(){window.location=params.link;});$("#"+linkId).css("cursor","pointer");}var clickElementy=params.position!==undefined?getAbsoluteTop(params.position):getAbsoluteTop(linkId)-1;if(params.scrollTop!=undefined){clickElementy-=document.getElementById(params.scrollTop).scrollTop;}$("#JT").remove();$("body").append("<div id='JT' style='width:"+params.width*1+"px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"+title+"<a class='close' href='#'></a></div><div id='JT_copy'><div class='JT_loader'><div></div></div>");var arrowOffset=getElementWidth(linkId)+14;var clickElementx=getAbsoluteLeft(linkId)+arrowOffset;if(params.fixed!==undefined){if(params.x!==undefined){clickElementx=Number(params.x);}if(params.y!==undefined){clickElementy=Number(params.y);}}if(params.relative!==undefined){if(params.x!==undefined){clickElementx+=Number(params.x);}if(params.y!==undefined){clickElementy+=Number(params.y);}}$("#JT").css({left:clickElementx+"px",top:clickElementy+"px"});$("#JT").show();$("#JT_copy").load(url);}function getElementWidth(objectId){x=document.getElementById(objectId);return x.offsetWidth;}function getAbsoluteLeft(objectId){o=document.getElementById(objectId);oLeft=o.offsetLeft;while(o.offsetParent!=null){oParent=o.offsetParent;oLeft+=oParent.offsetLeft;o=oParent;}return oLeft;}function getAbsoluteTop(objectId){o=document.getElementById(objectId);oTop=o.offsetTop;while(o.offsetParent!=null){oParent=o.offsetParent;oTop+=oParent.offsetTop;o=oParent;}return oTop;}function parseQuery(query){var Params=new Object();if(!query){return Params;}var Pairs=query.split(/[;&]/);for(var i=0;i<Pairs.length;i++){var KeyVal=Pairs[i].split("=");if(!KeyVal||KeyVal.length!=2){continue;}var key=unescape(KeyVal[0]);var val=unescape(KeyVal[1]);val=val.replace(/\+/g," ");Params[key]=val;}return Params;}function applyMultipleSelectDropdowns(){function initMultipleSelects(originalSelect,fromSelect,toSelect){for(var i=0,length=originalSelect.options.length;i<length;i++){var option=originalSelect.options[i];var newOption=option.cloneNode(true);newOption.selected=false;if(option.text.indexOf("OTHER")<0&&option.text.indexOf("MUU")<0&&option.text.indexOf("SONSTIGE")<0){if(option.selected){toSelect.appendChild(newOption);}else{fromSelect.appendChild(newOption);}}}}function transferSelected(originalSelect,fromSelect,toSelect){for(var i=fromSelect.options.length-1;i>=0;i--){var option=fromSelect.options[i];if(option.selected){toSelect.appendChild(fromSelect.removeChild(option));}}}function applySelected(originalSelect,cloneSelect){for(var i=0,length=originalSelect.options.length;i<length;i++){var selectedOption=false;for(var j=0,lengthj=cloneSelect.options.length;j<lengthj;j++){if(originalSelect.options[i].value==cloneSelect.options[j].value){selectedOption=true;break;}}originalSelect.options[i].selected=selectedOption;}}function findSelect(button){return button.parentNode.parentNode.getElementsByTagName("select")[0];}function findFromSelect(button){return button.parentNode.parentNode.getElementsByTagName("select")[1];}function findToSelect(button){return button.parentNode.parentNode.getElementsByTagName("select")[2];}var selects=document.getElementsByTagName("select");for(var i=selects.length-1;i>=0;i--){if(selects[i].getAttribute("multiple")&&selects[i].className.indexOf("buckets")>=0){var select=selects[i];select.style.display="none";var fromSelect;var toSelect;try{fromSelect=document.createElement("<select multiple>");toSelect=document.createElement("<select multiple>");}catch(e){fromSelect=document.createElement("select");toSelect=document.createElement("select");}fromSelect.setAttribute("multiple","multiple");fromSelect.multiple=true;fromSelect.setAttribute("size",15);toSelect.setAttribute("multiple","multiple");toSelect.setAttribute("size",7);toSelect.multiple=true;initMultipleSelects(select,fromSelect,toSelect);var removeButton=document.createElement("input");var addButton=document.createElement("input");removeButton.setAttribute("type","button");removeButton.setAttribute("value",tokens.removeKeyword);removeButton.setAttribute("title",tokens.removeKeyword);removeButton.className="button moveup";addButton.setAttribute("type","button");addButton.setAttribute("value",tokens.addKeyword);addButton.setAttribute("title",tokens.addKeyword);addButton.className="button movedown";var par=document.createElement("p");removeButton.onclick=function(){transferSelected(findSelect(this),findToSelect(this),findFromSelect(this));applySelected(findSelect(this),findToSelect(this));};addButton.onclick=function(){transferSelected(findSelect(this),findFromSelect(this),findToSelect(this));applySelected(findSelect(this),findToSelect(this));};select.parentNode.appendChild(fromSelect);par.appendChild(addButton);par.appendChild(removeButton);select.parentNode.appendChild(par);select.parentNode.appendChild(toSelect);select.parentNode.className="cartcontainer";}}}