if("undefined"===typeof PORTFOLIO)var PORTFOLIO={};PORTFOLIO.addCollectableElement=function(a,b,c){if(!a||!b||!c)return!1;if(!PORTFOLIO.elementCollection)PORTFOLIO.elementCollection=[];PORTFOLIO.elementCollection.push({id:a,title:b,type:c});return!0};
PORTFOLIO.showAddCollectionWindow=function(a){var b,c,d;if(!PORTFOLIO.elementCollection)return alert(PORTFOLIO.gettext("No element collection found!")),!1;if(0<!PORTFOLIO.elementCollection.length)return alert(PORTFOLIO.gettext("No collectable elements found!")),!1;a=document.getElementById(a);if(!a)return!1;if("block"==a.style.display)return a.style.display="none",!1;(b=a.getElementsByTagName("tbody"))&&b[0]&&(b=b[0]);if(b){for(;b.lastChild;)b.removeChild(b.lastChild);for(c=0;c<PORTFOLIO.elementCollection.length;c++)if(d=
PORTFOLIO.elementCollection[c],d.id&&d.title&&d.type){var f=document.createElement("tr");b.appendChild(f);var e=document.createElement("td");f.appendChild(e);var g=document.createElement("input");g.type="checkbox";g.name="element";g.value=d.id;e.appendChild(g);g.checked=!0;e=document.createElement("td");f.appendChild(e);e.appendChild(document.createTextNode(d.type+":"));e=document.createElement("td");f.appendChild(e);e.appendChild(document.createTextNode(d.title))}}a.style.display="block";return!0};
PORTFOLIO.reorderAllEvents=function(){return PORTFOLIO.events};PORTFOLIO.gettext=function(a){return!PORTFOLIO.client_language?a:!PORTFOLIO.messages?a:!PORTFOLIO.messages[a]?a:!PORTFOLIO.messages[a][PORTFOLIO.client_language]?a:PORTFOLIO.messages[a][PORTFOLIO.client_language]};
PORTFOLIO.check_required=function(a){for(var b=a.getElementsByTagName("input"),a=a.getElementsByTagName("label"),c=0;c<b.length;c++){var d=b[c].getAttribute("class");if(d&&d.match("required")&&""==b[c].value){d=b[c].getAttribute("name");""==d&&(d=b[c].getAttribute("id"));for(var f=d,e=0;e<a.length;e++)a[e].htmlFor==d&&(f=$(a[e]).text());b[c].focus();alert(f+" - "+PORTFOLIO.gettext("required, please enter a value!"));return!1}}return!0};
PORTFOLIO.toggle_checkboxes=function(a,b){for(var c=a.getElementsByTagName("input"),d=0;d<c.length;d++)if("checkbox"==c[d].type)switch(b){case "all":c[d].checked=!0;break;case "none":c[d].checked=!1;break;default:c[d].checked=!c[d].checked}};PORTFOLIO.anything_checked=function(a){for(var b=a.getElementsByTagName("input"),c=0;c<b.length;c++)if("checkbox"==b[c].type&&b[c].checked)return!0;a.focus();return!1};
PORTFOLIO.remove_html_tag=function(a){if(void 0==a)return a;a=a.replace(/<\/p>/g,"\n");return a.replace(/<\/?[^>]+(>|$)/g,"")};PORTFOLIO.l_trim=function(a){return void 0==a?a:a.replace(/^\s+/g,"")};PORTFOLIO.r_trim=function(a){return void 0==a?a:a.replace(/\s+$/g,"")};PORTFOLIO.trim=function(a){return void 0==a?a:PORTFOLIO.l_trim(PORTFOLIO.r_trim(a))};PORTFOLIO.SELECT_CTRL={};
PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase()){PORTFOLIO.SELECT_CTRL.toggle_line_numbers(a,"check_setting");a.focus();for(var b=-1,c=1;c<a.options.length;c++)a.options[c].selected&&(b=c);if(b<a.options.length-1)a.options[b+1].selected=!0,a.options[b+1].selected=!1;else if(-1!=b)a.options[b].selected=!0}};
PORTFOLIO.SELECT_CTRL.selectall=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase())for(var b=0;b<a.length;b++)a[b].selected=!0};PORTFOLIO.SELECT_CTRL.selectnone=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase())for(var b=0;b<a.length;b++)a[b].selected=!1};
PORTFOLIO.SELECT_CTRL.invert_selection=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase())for(var b=0;b<a.length;b++)a[b].selected=a[b].selected?!1:!0};
PORTFOLIO.SELECT_CTRL.swap=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);for(var b=!1,c=!1,d=0;d<a.length;d++)a[d].selected&&(!1===b?b=d:c=d);if(!1===b||!1===c)return!1;d=[document.body.innerHTML?a[b].innerHTML:a[b].text,a[b].value,a[b].style.color,a[b].style.backgroundColor,a[b].className,a[b].id,a[b].selected];document.body.innerHTML?a[b].innerHTML=
a[c].innerHTML:a[b].text=a[c].text;a[b].value=a[c].value;a[b].style.color=a[c].style.color;a[b].style.backgroundColor=a[c].style.backgroundColor;a[b].className=a[c].className;a[b].id=a[c].id;a[b].selected=a[c].selected;document.body.innerHTML?a[c].innerHTML=d[0]:a[c].text=d[0];a[c].value=d[1];a[c].style.color=d[2];a[c].style.backgroundColor=d[3];a[c].className=d[4];a[c].id=d[5];a[c].selected=d[6]};
PORTFOLIO.SELECT_CTRL.sort2d=function(a,b,c,d){if(c)for(c=0;c<a.length-1;c++)for(var f=c+1;f<a.length;f++){if(parseInt(a[f][b],10)<parseInt(a[c][b],10)){var e=a[c];a[c]=a[f];a[f]=e}}else for(c=0;c<a.length-1;c++)for(f=c+1;f<a.length;f++)d?a[f][b].toLowerCase()<a[c][b].toLowerCase()&&(e=a[c],a[c]=a[f],a[f]=e):a[f][b]<a[c][b]&&(e=a[c],a[c]=a[f],a[f]=e)};
PORTFOLIO.SELECT_CTRL.listsort=function(a,b,c,d){a="string"==typeof a?document.getElementById(a):a;b=5<parseInt("0"+b,10)?0:parseInt("0"+b,10);if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;for(var f=[],e=0;e<a.length;e++)f[f.length]=[document.body.innerHTML?a[e].innerHTML:a[e].text,a[e].value,a[e].currentStyle?a[e].currentStyle.color:a[e].style.color,a[e].currentStyle?a[e].currentStyle.backgroundColor:a[e].style.backgroundColor,a[e].className,a[e].id,a[e].selected];PORTFOLIO.SELECT_CTRL.sort2d(f,
b,c,d);for(e=0;e<a.length;e++)document.body.innerHTML?a[e].innerHTML=f[e][0]:a[e].text=f[e][0],a[e].value=f[e][1],a[e].style.color=f[e][2],a[e].style.backgroundColor=f[e][3],a[e].className=f[e][4],a[e].id=f[e][5],a[e].selected=f[e][6]};
PORTFOLIO.SELECT_CTRL.viceversa=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;for(var c=[],d=a.length-1;-1<d;d--)if(a[d].selected||!b)c[c.length]=[document.body.innerHTML?a[d].innerHTML:a[d].text,a[d].value,a[d].style.color,a[d].style.backgroundColor,a[d].className,a[d].id,a[d].selected];for(var f=0,d=0;d<a.length;d++)if(a[d].selected||!b)document.body.innerHTML?a[d].innerHTML=c[f][0]:a[d].text=c[f][0],a[d].value=c[f][1],
a[d].style.color=c[f][2],a[d].style.backgroundColor=c[f][3],a[d].className=c[f][4],a[d].id=c[f][5],a[d].selected=c[f][6],f++};PORTFOLIO.SELECT_CTRL.up=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);for(var b=[],c=0;c<a.length;c++)!0==a[c].selected&&(b[b.length]=c);for(c in b)0!=b[c]&&!a[b[c]-1].selected&&a.insertBefore(a[b[c]],a[b[c]-1]);PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView(a)};
PORTFOLIO.SELECT_CTRL.down=function(a){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);for(var b=[],c=a.length-1;-1<c;c--)!0==a[c].selected&&(b[b.length]=c);for(c in b)b[c]!=a.length-1&&!a[b[c]+1].selected&&a.insertBefore(a[b[c]+1],a[b[c]]);PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView(a)};
PORTFOLIO.SELECT_CTRL.move_selection_to=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);for(var c=[],d=0;d<a.length;d++)a[d].selected&&(c[c.length]=d);if(b=prompt(PORTFOLIO.gettext("Move selection before number:"),0))if(PORTFOLIO.is_integer(b)){b--;if(0>b||b>a.length-1)return alert(PORTFOLIO.gettext("Number must be in the range 1 to")+" "+a.length),
!1;if(b>=c[0]&&b<=c[c.length-1])return alert(PORTFOLIO.gettext("Can not move selection onto itself or between selected elements!")),!1}else return alert(PORTFOLIO.gettext("Not a valid number:")+' "'+b+'"'),!1;else return!1;b<c[0]?PORTFOLIO.SELECT_CTRL.move_selection_upwards(a,b):PORTFOLIO.SELECT_CTRL.move_selection_downwards(a,b)};
PORTFOLIO.SELECT_CTRL.move_selection_upwards=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);b||(b=0);for(var c=0;c<a.length;c++)a[c].selected&&(a.insertBefore(a[c],a[b]),b++);PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView(a)};
PORTFOLIO.SELECT_CTRL.move_selection_downwards=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"!=a.tagName.toLowerCase()&&2>a.length)return!1;if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);if(!b)b=a.length;for(var c=a.length-1;-1<c;c--)a[c].selected&&(b==a.length?a.appendChild(a[c]):a.insertBefore(a[c],a[b]),b--);PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView(a)};
PORTFOLIO.SELECT_CTRL.moveOptionsAcross=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase()&&(b="string"==typeof b?document.getElementById(b):b,"select"==b.tagName.toLowerCase())){if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);PORTFOLIO.SELECT_CTRL.selectnone(b);for(var c=0;c<a.length;c++)a[c].selected&&(b.appendChild(a[c]),c--);PORTFOLIO.SELECT_CTRL.scrollSelectionIntoView(b)}};
PORTFOLIO.SELECT_CTRL.toggle_line_numbers=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase()){if("check_setting"==b){if(a.show_numbers)b=a.show_numbers;else return;if(!b)return}else a.show_numbers=b;for(var c=/\[\d{4}\] /,d=0;d<a.length;d++)if(a[d].text=a[d].text.replace(c,""),!0==b){for(var f=(d+1).toString();4>f.length;)f="0"+f;a[d].text="["+f+"] "+a[d].text}}};
PORTFOLIO.SELECT_CTRL.alert_nothing_selected=function(a){alert(PORTFOLIO.gettext("Nothing selected!"));a.focus();return!1};PORTFOLIO.SELECT_CTRL.preview_selected_object=function(a,b){a="string"==typeof a?document.getElementById(a):a;if("select"==a.tagName.toLowerCase()){if(-1==a.selectedIndex)return PORTFOLIO.SELECT_CTRL.alert_nothing_selected(a);window.open(b+"?cmd=read_object;object="+a.options[a.selectedIndex].value+";no_framework=1","pf_preview","resizable=yes,menubar=no,toolbar=no,scrollbars=yes,hotkeys=no,width=650,height=500,top=100,left=100").window.focus()}};
PORTFOLIO.SELECT_CTRL.populate_select_from_textarea=function(a,b,c,d,f,e){a="string"==typeof a?document.getElementById(a):a;if("textarea"==a.tagName.toLowerCase()){var g=a.value,b="string"==typeof b?document.getElementById(b):b;if("select"==b.tagName.toLowerCase()){for(;0<b.length;)b.removeChild(b[0]);a=!1;if(b.show_numbers)a=b.show_numbers;for(var g=g.split("\n"),e=e.split(c),h=0;h<g.length;h++)if(""!=g[h]){var j=g[h].split(c);if(!0==a){for(var k=(h+1).toString();4>k.length;)k="0"+k;j[f]="["+k+"] "+
j[f]}b.options[b.options.length]=new Option(j[f],j[d]);for(k=0;k<e.length;k++)b.options[h]["sortkey"+(k+1)]=j[e[k]]}}}};
PORTFOLIO.SELECT_CTRL.populate_textarea_from_select=function(a,b,c,d){b="string"==typeof b?document.getElementById(b):b;if("textarea"==b.tagName.toLowerCase()&&(a="string"==typeof a?document.getElementById(a):a,"select"==a.tagName.toLowerCase())){for(var f="",d=d.split(c),e=0;e<a.length;e++){for(var g="",h=0;h<d.length;h++)g+=a.options[e][d[h]],h<d.length-1&&(g+=c);g=g.replace(/\[\d{4}\] /,"");f+=g+"\n"}b.value=f}};PORTFOLIO.MANAGE_INST={};PORTFOLIO.MANAGE_INST.remember_last_separator_value="";
PORTFOLIO.MANAGE_INST.selectOptions=[["",PORTFOLIO.gettext("Ignore field")],["email",PORTFOLIO.gettext("Email")],["firstname",PORTFOLIO.gettext("First name")],["lastname",PORTFOLIO.gettext("Last name")],["username",PORTFOLIO.gettext("User name")],["id",PORTFOLIO.gettext("ID (uuid)")],["password",PORTFOLIO.gettext("Password")],["role",PORTFOLIO.gettext("Role"),"student/supervisor"]];
PORTFOLIO.MANAGE_INST.setForm=function(a){if(!a)throw new SyntaxError("Element was not specified");PORTFOLIO.MANAGE_INST.form=a;return!0};PORTFOLIO.MANAGE_INST.setTextUIContainer=function(a){if(!a)throw new SyntaxError("Element was not specified");PORTFOLIO.MANAGE_INST.textUIContainer=a;return!0};PORTFOLIO.MANAGE_INST.setTableUIContainer=function(a){if(!a)throw new SyntaxError("Element was not specified");PORTFOLIO.MANAGE_INST.tableUIContainer=a;return!0};
PORTFOLIO.MANAGE_INST.showTableUI=function(){if(!PORTFOLIO.MANAGE_INST.form.separator.value)return alert(PORTFOLIO.gettext("Need to select separator")),!1;var a=document.createElement("table");$(PORTFOLIO.MANAGE_INST.tableUIContainer).prepend(a);a.appendChild(PORTFOLIO.MANAGE_INST.makeTableHead());var b=PORTFOLIO.MANAGE_INST.makeTableBody();a.appendChild(b);$("input:checkbox",b).each(function(){this.checked=!0});$(PORTFOLIO.MANAGE_INST.textUIContainer).hide();$(PORTFOLIO.MANAGE_INST.tableUIContainer).show();
return PORTFOLIO.MANAGE_INST.form._gui_mode[0].checked=!0};
PORTFOLIO.MANAGE_INST.showTextUI=function(){PORTFOLIO.MANAGE_INST.form._gui_mode[1].checked=!0;if(document.getElementById("usertable_body")){for(var a=document.getElementById("usertable_body").getElementsByTagName("tr"),b=PORTFOLIO.MANAGE_INST.form.separator.value,c="",d=0;d<a.length;d++){var f=a[d].getElementsByTagName("td"),e="",g=!1;if(checkValue=a[d].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked){for(var h=0;h<f.length;h++){var j=f[h].getElementsByTagName("input")[0];
j.getAttribute("name");j=j.value;if("null"==j||null==j)j="";""!=j&&(g=!0);e+=j;h<f.length-1&&(e+=b)}!0==g&&(c=c+e+"\n")}}a=document.getElementById("usertable_head").getElementsByTagName("select");f="";for(d=0;d<a.length;d++)f+=a[d].options[a[d].selectedIndex].value,d<a.length-1&&(f+=b);$("table",PORTFOLIO.MANAGE_INST.tableUIContainer).remove();PORTFOLIO.MANAGE_INST.form.fields.value=f;PORTFOLIO.MANAGE_INST.form.users.value=c;$(PORTFOLIO.MANAGE_INST.tableUIContainer).hide();$(PORTFOLIO.MANAGE_INST.textUIContainer).show()}};
PORTFOLIO.MANAGE_INST.makeTableHead=function(){var a=PORTFOLIO.MANAGE_INST.form.fields.value.split(PORTFOLIO.MANAGE_INST.form.separator.value),b=document.createElement("thead");b.setAttribute("id","usertable_head");var c=document.createElement("tr"),d=document.createElement("th");d.style.width="1em";var f=document.createElement("input");f.setAttribute("type","checkbox");f.setAttribute("disabled","disabled");f.style.visibility="hidden";d.appendChild(f);c.appendChild(d);for(var e=0;e<a.length;e++){for(var d=
document.createElement("th"),f=document.createElement("select"),g=0;g<PORTFOLIO.MANAGE_INST.selectOptions.length;g++)if(f.options[f.options.length]=new Option(PORTFOLIO.MANAGE_INST.selectOptions[g][1],PORTFOLIO.MANAGE_INST.selectOptions[g][0]),PORTFOLIO.MANAGE_INST.selectOptions[g][0]==a[e])f.options[g].selected="selected",PORTFOLIO.MANAGE_INST.selectOptions[g][2]&&f.setAttribute("input_alternatives",PORTFOLIO.MANAGE_INST.selectOptions[g][2]);$(f).change(function(){PORTFOLIO.MANAGE_INST.toggleColumn(this)});
d.appendChild(f);c.appendChild(d)}b.appendChild(c);return b};PORTFOLIO.MANAGE_INST.makeTableBody=function(){var a=document.createElement("tbody");a.setAttribute("id","usertable_body");for(var b=PORTFOLIO.MANAGE_INST.form.users.value.split("\n"),c=0;c<b.length;c++)PORTFOLIO.MANAGE_INST.appendRow(a,b[c]);return a};
PORTFOLIO.MANAGE_INST.appendRow=function(a,b){var n;var c=document.createElement("tr"),d=document.createElement("th"),f=document.createElement("input");f.setAttribute("type","checkbox");$(f).click(function(){PORTFOLIO.MANAGE_INST.toggleRow(this)});d.appendChild(f);c.appendChild(d);for(var e=(n=(b=b&&b.replace(/\n/g,""))&&b.replace(/\r/g,""),b=n)?b.split(PORTFOLIO.MANAGE_INST.form.separator.value):[],g=$("select",PORTFOLIO.MANAGE_INST.tableUIContainer).get(),h=0;h<g.length;h++){var d=document.createElement("td"),
j=document.createElement("input");e[h]&&j.setAttribute("value",e[h]);var k=g[h].options[g[h].selectedIndex].value;j.setAttribute("name",k);if(""==k)j.setAttribute("disabled","disabled"),j.style.backgroundColor="#ccc";if(g[h].getAttribute("input_alternatives"))for(var k=document.createElement("select"),l=g[h].getAttribute("input_alternatives").split("/"),m=0;m<l.length;m++)k.options[k.options.length]=new Option(l[m],l[m]);j.setAttribute("type","text");d.appendChild(j);c.appendChild(d)}a.appendChild(c);
f.checked=!0;$("input:text:first",c).focus();return!0};
PORTFOLIO.MANAGE_INST.toggleColumn=function(a){var b=a.parentNode.cellIndex-1,a=a.options[a.selectedIndex].value;if(document.getElementById("usertable_body"))for(var c=-1,d=document.getElementById("usertable_body").getElementsByTagName("tr"),f=0;f<d.length;f++)for(var e=d[f].getElementsByTagName("td"),g=0;g<e.length;g++){var h=e[g].getElementsByTagName("input")[0];if(g==b)h.setAttribute("name",a),""==a?(h.disabled="disabled",h.style.backgroundColor="#ccc"):(h.disabled=!1,h.style.backgroundColor="");
else if(h.getAttribute("name")==a&&""!=a)c=g,h.setAttribute("name",""),h.disabled="disabled",h.style.backgroundColor="#ccc"}if(-1<c)document.getElementById("usertable_head").getElementsByTagName("select")[c].options[0].selected=!0};
PORTFOLIO.MANAGE_INST.toggleRow=function(a){var b=PORTFOLIO.MANAGE_INST.form.getElementsByTagName("select"),c=a.parentNode.parentNode.rowIndex-1,a=a.checked;if(document.getElementById("usertable_body"))for(var c=document.getElementById("usertable_body").getElementsByTagName("tr")[c].getElementsByTagName("td"),d=0;d<c.length;d++){var f=c[d].getElementsByTagName("input")[0],e=b[d].options[b[d].selectedIndex].value;!1==a||""==e?(f.disabled="disabled",f.style.backgroundColor="#ccc"):(f.disabled=!1,f.style.backgroundColor=
"")}};PORTFOLIO.MANAGE_INST.setSeparator=function(a){"other"==a&&(a="",PORTFOLIO.MANAGE_INST.form.separator.focus());PORTFOLIO.MANAGE_INST.form.separator.value=a};PORTFOLIO.is_uuid=function(a){return(a=a.toString().match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i))&&""!=a[0]?!0:!1};PORTFOLIO.is_integer=function(a){return(a=a.toString().match(/^\d+$/))&&""!=a[0]?!0:!1};
PORTFOLIO.ContainerBrowser=function(a,b,c){return PORTFOLIO.fileBrowser("select","container",a,b,a,700,380,"",c)};PORTFOLIO.ObjectBrowser=function(a,b,c){return PORTFOLIO.fileBrowser("select","object",null,b,a,700,380,"",c)};
PORTFOLIO.timer_count_down=function(a,b){PORTFOLIO.timeout_minutes=a;PORTFOLIO.timeout_seconds=b;if(0==PORTFOLIO.timeout_seconds)PORTFOLIO.timeout_seconds=60,PORTFOLIO.timeout_minutes--;PORTFOLIO.timeout_seconds--;if(10>PORTFOLIO.timeout_seconds)PORTFOLIO.timeout_seconds="0"+PORTFOLIO.timeout_seconds;document.getElementById(PORTFOLIO.timer_id).value=PORTFOLIO.timeout_minutes+":"+PORTFOLIO.timeout_seconds;0==PORTFOLIO.timeout_minutes&&0==PORTFOLIO.timeout_seconds?PORTFOLIO.time_is_up():setTimeout(function(){PORTFOLIO.timer_count_down(PORTFOLIO.timeout_minutes,
PORTFOLIO.timeout_seconds)},1E3)};PORTFOLIO.time_is_up=function(){document.getElementById(PORTFOLIO.timer_submit_button)?document.getElementById(PORTFOLIO.timer_submit_button).click():alert(PORTFOLIO.gettext("Your time is up!"))};
PORTFOLIO.start_quiz_timer=function(a,b,c,d){if(document.forms.pf_quiz)if(document.forms.pf_quiz.evaluate_quiz||document.forms.pf_quiz.send_quiz)PORTFOLIO.timer_id=c?c:"display_quiz_timer",PORTFOLIO.timer_submit_button=d?d:"evaluate_quiz",setTimeout("PORTFOLIO.timer_count_down("+a+","+b+")",1E3);else if(document.getElementById("pf_quiz_timer"))document.getElementById("pf_quiz_timer").innerHTML=""};
PORTFOLIO.initColList=function(){if(document.getElementById("webfx_container")&&document.getElementById("webfx_head")&&document.getElementById("webfx_body"))PORTFOLIO.currentColumnList=new WebFXColumnList,PORTFOLIO.currentColumnList.bind(document.getElementById("webfx_container"),document.getElementById("webfx_head"),document.getElementById("webfx_body")),PORTFOLIO.currentColumnList.setSortTypes([TYPE_STRING_NO_CASE,TYPE_NUMBER,TYPE_STRING,TYPE_STRING]),PORTFOLIO.currentColumnList._setAlignment()};
PORTFOLIO.selectRowByFilename=function(a){for(var b=document.getElementById("columnlist_body").getElementsByTagName("tr"),c=0;c<b.length;c++)if(b[c].getAttribute("filename")==a){PORTFOLIO.currentColumnList.selectRow(c);PORTFOLIO.update_inputs(b[c]);break}return null};PORTFOLIO.selectRowByObjectId=function(a){for(var b=document.getElementById("columnlist_body").getElementsByTagName("tr"),c=0;c<b.length;c++)if(b[c].getAttribute("id")==a){PORTFOLIO.currentColumnList.selectRow(c);break}return null};
PORTFOLIO.ajaxpage=function(a,b,c){var d=!1;if(window.XMLHttpRequest)d=new XMLHttpRequest;else if(window.ActiveXObject){try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){}try{d=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}else return!1;d.onreadystatechange=function(){PORTFOLIO.loadpage(d,b,c)};d.open("GET",a,!0);d.send(null);return 1};
PORTFOLIO.loadpage=function(a,b,c){if(4==a.readyState&&(200==a.status||-1==window.location.href.indexOf("http"))){document.getElementById(b).innerHTML=a.responseText;if(document.getElementById("currentcontainer_title")&&document.getElementById("currentcontainer")){if(document.getElementById("pf_browser_uuid")&&(document.getElementById("pf_browser_uuid").value=document.getElementById("currentcontainer").value,document.getElementById("container")))document.getElementById("container").value=document.getElementById("currentcontainer").value;
if(document.getElementById("filebrowser_title"))document.getElementById("filebrowser_title").value=document.getElementById("currentcontainer_title").value;if(document.getElementById("filebrowser_description"))document.getElementById("filebrowser_description").value=document.getElementById("currentcontainer_description").value;if(document.getElementById("pf_browser_typeof_uuid"))document.getElementById("pf_browser_typeof_uuid").value="container"}PORTFOLIO.initColList();c&&(a=document.getElementById("content_file").value.split("\\"),
PORTFOLIO.selectRowByFilename(a[a.length-1]),document.getElementById("uploadForm").reset())}};PORTFOLIO.doTransfer=!1;PORTFOLIO.giveTransferFeedback=function(a){a+="?cmd=list;container="+document.getElementById("currentcontainer").value;PORTFOLIO.ajaxpage(a+";response=xml;server_xsl=list_element","pf_fileBrowserInnerDiv",!0);PORTFOLIO.doTransfer=!1};PORTFOLIO.get_row=function(a,b){return document.getElementById(a).getElementsByTagName("tr")[b]};
PORTFOLIO.doAjaxCmd=function(a,b){var c=!1;if(window.XMLHttpRequest)c=new XMLHttpRequest;else if(window.ActiveXObject)try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}}else return!1;c.onreadystatechange=function(){PORTFOLIO.xmlCallBack(c,b)};c.open("GET",a,!0);c.send(null);return 1};
PORTFOLIO.xmlCallBack=function(a,b){if(4==a.readyState&&200==a.status){var c=a.responseXML.getElementsByTagName("portfolio").item(0);if(!c)return alert(PORTFOLIO.gettext("Not Portfolio XML-response")),!1;var d=c.getElementsByTagName("response").item(0);d.getAttribute("request");var c=d.firstChild.data,f=d.getAttribute("status"),d=d.getAttribute("code");200>d||299<d?alert(c+"\n"+f+"\n"+d):(PORTFOLIO.selectRowByObjectId(b),c=PORTFOLIO.currentColumnList.getSelectedRange(),PORTFOLIO.currentColumnList.removeRange(c),
PORTFOLIO.update_inputs(-1))}return 1};
PORTFOLIO.delete_selected=function(){var a=PORTFOLIO.currentColumnList.getSelectedRange();if(a.length){if(confirm(PORTFOLIO.gettext("Selected rows:")+" "+a.length+"\n"+PORTFOLIO.gettext("Delete now?"))){var b=0;do{var c=PORTFOLIO.get_row("columnlist_body",a[b]);PORTFOLIO.doAjaxCmd("/?cmd=delete_"+c.getAttribute("objecttype")+";"+c.getAttribute("objecttype")+"_id="+c.getAttribute("id")+";from_outbox="+c.getAttribute("outbox")+";response=xml;",c.getAttribute("id"));b+=1}while(b<a.length)}}else alert(PORTFOLIO.gettext("Nothing selected!"))};
PORTFOLIO.browser_show_imagethumb=function(a){var b,c=document.getElementById("filebrowser_imgthumb_container");if(c){if(-1==a)b.innerHTML="";else{var d=a.getAttribute("type"),f=a.getAttribute("mimetype");a.getAttribute("objectwidth");a.getAttribute("objectheight");var e=a.getAttribute("objecttitle"),c=c.offsetHeight-20;b=document.getElementById("filebrowser_imgthumb");b.innerHTML="image"==d?'<img src="'+PORTFOLIO.site_url+"thumbnail/"+a.getAttribute("id")+"/"+c+'" />':"audio"==d&&"audio/mpeg"==f?
'<object class="inline" type="application/x-shockwave-flash" data="'+PORTFOLIO.static_url+"musicplayer/player_slim.swf?autoplay=true&amp;song_title="+e+"&amp;song_url="+PORTFOLIO.site_url+"data/"+a.getAttribute("id")+'" width="250" height="17"><param name="movie" value="'+PORTFOLIO.static_url+"musicplayer/player_button.swf?autoplay=true&amp;autoload=true&amp;song_title="+e+"&amp;song_url="+PORTFOLIO.site_url+"data/"+a.getAttribute("id")+'" />'+PORTFOLIO.gettext("Your browser does not support Flash content.")+
'<a target="_blank" href="http://www.macromedia.com/go/getflashplayer/" rel="external">'+PORTFOLIO.gettext("Download Flash Player.")+"</a></object>":'<img src="'+a.getElementsByTagName("img")[0].src+'" /><br />'+d+"<br /><small>"+f+"</small>"}a=document.getElementById("preview_thumb_adjustment");b="";if(a)b=a.options[a.selectedIndex].value,adjust_img_thumb(b)}};
PORTFOLIO.update_inputs=function(a){PORTFOLIO.currentColumnList.getSelectedRange();if(document.getElementById("filebrowser_insert"))if(-1==a){if(document.getElementById("filebrowser_insert").disabled=!0,document.getElementById("filebrowser_insert_link").disabled=!0,document.getElementById("filebrowser_insert_uri").disabled=!0,document.getElementById("filebrowser_preview"))document.getElementById("filebrowser_preview").disabled=!0}else if(document.getElementById("filebrowser_insert").disabled=!1,document.getElementById("filebrowser_insert_link").disabled=
!1,document.getElementById("filebrowser_insert_uri").disabled=!1,document.getElementById("filebrowser_preview"))document.getElementById("filebrowser_preview").disabled=!1;if(-1==a){if(document.getElementById("pf_updateOnServer"))document.getElementById("pf_updateOnServer").disabled=!1;if(document.getElementById("pf_browser_uuid"))document.getElementById("pf_browser_uuid").value="";if(document.getElementById("pf_browser_typeof_uuid"))document.getElementById("pf_browser_typeof_uuid").value="";if(document.getElementById("filebrowser_title"))document.getElementById("filebrowser_title").value=
"";if(document.getElementById("filebrowser_description"))document.getElementById("filebrowser_description").value="";if(document.getElementById("filebrowser_mimetype"))document.getElementById("filebrowser_mimetype").value="";if(document.getElementById("filebrowser_width"))document.getElementById("filebrowser_width").value="";if(document.getElementById("filebrowser_height"))document.getElementById("filebrowser_height").value="";if(document.getElementById("filebrowser_mediatype"))document.getElementById("filebrowser_mediatype").value=
"";if(document.getElementById("filebrowser_filename"))document.getElementById("filebrowser_filename").value="";if(document.getElementById("filebrowser_xlinkhref"))document.getElementById("filebrowser_xlinkhref").value=""}else{if(document.getElementById("pf_updateOnServer"))document.getElementById("pf_updateOnServer").disabled=!0;if(document.getElementById("pf_browser_uuid"))document.getElementById("pf_browser_uuid").value=a.getAttribute("id");if(document.getElementById("pf_browser_typeof_uuid"))document.getElementById("pf_browser_typeof_uuid").value=
a.getAttribute("objecttype");if(document.getElementById("filebrowser_title"))document.getElementById("filebrowser_title").value=a.getAttribute("objecttitle");if(document.getElementById("filebrowser_description"))document.getElementById("filebrowser_description").value=a.getAttribute("description");if(document.getElementById("filebrowser_mimetype"))document.getElementById("filebrowser_mimetype").value=a.getAttribute("mimetype");if(document.getElementById("filebrowser_width"))document.getElementById("filebrowser_width").value=
a.getAttribute("objectwidth");if(document.getElementById("filebrowser_height"))document.getElementById("filebrowser_height").value=a.getAttribute("objectheight");if(document.getElementById("filebrowser_mediatype"))document.getElementById("filebrowser_mediatype").value=a.getAttribute("type");if(document.getElementById("filebrowser_filename"))document.getElementById("filebrowser_filename").value=a.getAttribute("filename");if(document.getElementById("filebrowser_xlinkhref"))document.getElementById("filebrowser_xlinkhref").value=
a.getAttribute("href")}PORTFOLIO.browser_show_imagethumb(a)};PORTFOLIO.browser_preview=function(){var a=document.getElementById("pf_browser_typeof_uuid").value,b=document.getElementById("pf_browser_uuid").value;window.open(document.getElementById("base_site").value+"/?cmd="+("read_"+a)+";"+a+"="+b+";basic_page=1","pf_preview","resizable=yes,menubar=no,toolbar=no,scrollbars=yes,hotkeys=no,width=450,height=300,top=100,left=50").window.focus()};
PORTFOLIO.create_window=function(a,b,c,d,f,e,g,h,j){if(j)PORTFOLIO.modalbox_targetinfo=j;d&&PORTFOLIO.ajaxpage(d,a+"InnerDiv")};PORTFOLIO.setCookie=function(a,b,c){$.cookie(a,b,{expires:c,path:"/"});return!0};PORTFOLIO.getCookie=function(a){return $.cookie(a)};PORTFOLIO.deleteCookie=function(a){$.cookie(a,null);return!0};PORTFOLIO.removePopup=function(){PORTFOLIO.pf_popwindow&&PORTFOLIO.pf_popwindow.open&&PORTFOLIO.pf_popwindow.close()};
PORTFOLIO.fileBrowser=function(a,b,c,d,f,e,g,h,j){var k=PORTFOLIO.site_url+"selector/?type="+b+";no_title=1";"select"!=a&&(k+=";callback_mode=tinymce");j||c&&(j=document.getElementById(c)?document.getElementById(c).value:"");e||(e=700);g||(g=450);if(window.showModalDialog){g+=52;a={mode:a,type:b,container:j,title_target:d,id_target:f};if(d&&document.getElementById(d))a.title_value=document.getElementById(d).value;if(f&&document.getElementById(f))a.id_value=document.getElementById(f).value;if(e=window.showModalDialog(k,
a,"dialogWidth:"+e+"px;dialogHeight:"+g+"px;scrollbars=no")){if(e.title&&""!=e.title&&document.getElementById(d))document.getElementById(d).value=e.title;if(e.uuid&&document.getElementById(f))document.getElementById(f).value=e.uuid}}else{if(!document.getElementById("filebrowser_args"))c=document.createElement("input"),c.type="hidden",c.id="filebrowser_args",document.getElementsByTagName("body")[0].appendChild(c);document.getElementById("filebrowser_args").value=[a,b,j,d,f,h].join();d=(PORTFOLIO.windowWidth()-
e)/2;f=(screen.height-g)/2;PORTFOLIO.pf_popwindow=window.open(k,"pf_popwindow","width="+e+(",height="+g)+(",top="+f)+(",left="+d)+",scrollbars=no,menubars=no,titlebar=no,modal=yes,dialog=yes,resizable=no");PORTFOLIO.pf_popwindow.focus()}return!0};
PORTFOLIO.windowWidth=function(){return"number"==typeof window.innerWidth?window.innerWidth:document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?document.documentElement.clientWidth:document.body&&(document.body.clientWidth||document.body.clientHeight)?document.body.clientWidth:0};
PORTFOLIO.getElementsByClassName=function(a,b,c){var b=b||"*",c=c||document,d=c.getElementsByTagName(b);if(!d.length&&"*"==b&&c.all)d=c.all;for(var b=[],c=-1!=a.indexOf("|")?"|":" ",a=a.split(c),f=0,e=d.length;f<e;f++)if("undefined"!=typeof d[f].className){var g=d[f].className.split(" ");if(!(" "==c&&a.length>g.length)){var h=0,j=0,k=g.length;a:for(;j<k;j++)for(var l=0,m=a.length;l<m;l++)if(a[l]==g[j]&&h++,"|"==c&&1==h||" "==c&&h==a.length){b.push(d[f]);break a}}}return b};
PORTFOLIO.toggleEditorMode=function(a){if(!tinyMCE)return!1;!1==tinyMCE.get(a).isHidden()?tinyMCE.get(a).hide():tinyMCE.get(a).show()};PORTFOLIO.setWysiwygMode=function(a,b){b?tinyMCE.get(a).show():b||tinyMCE.get(a).hide()};
PORTFOLIO.setEditEnvironment=function(a){var b=!1,c=!0,d=!0;switch(a){case "document":c=b=!0;d=!1;break;case "page":b=!1;c=!0;d=!1;break;case "image":c=b=!1;d=!0;break;case "audio":c=b=!1;d=!0;break;case "binary":c=b=!1;d=!0;break;case "text":b=!1;c=!0;d=!1;break;case "link":b=!1;c=!0;d=!1;break;case "forum":c=b=!0;d=!1;break;case "stylesheet":b=!1;c=!0;d=!1;break;case "javascript":b=!1;c=!0;d=!1;break;case "template":b=!1;c=!0;d=!1;break;case "script":b=!1;c=!0;d=!1;break;case "java-settings":b=
!1;c=!0;d=!1;break;case "java-data":c=b=!1;d=!0;break;case "flash-settings":b=!1;c=!0;d=!1;break;case "flash-data":c=b=!1,d=!0}c?(document.getElementById("content_div").style.display="block",document.getElementById("content").style.display="block",PORTFOLIO.setWysiwygMode("content",b)):(PORTFOLIO.setWysiwygMode("content",!1),document.getElementById("content").style.display="none",document.getElementById("content_div").style.display="none");if(d)document.getElementById("content_file_div").style.display=
"block",document.getElementById("content_file").style.display="block";else{if(document.getElementById("content_file"))document.getElementById("content_file").style.display="none";if(document.getElementById("content_file_div"))document.getElementById("content_file_div").style.display="none"}};PORTFOLIO.toggleVisibility=function(a){if(document.getElementById(a))a=document.getElementById(a),a.style.display="block"!=a.style.display?"block":"none"};
PORTFOLIO.stripe_table=function(a,b,c){var d=!1,b=b?b:"#eee",c=c?c:"#fff";if(a=document.getElementById(a))for(var a=a.getElementsByTagName("tbody"),f=0;f<a.length;f++)for(var e=a[f].getElementsByTagName("tr"),g=0;g<e.length;g++){if(!e[g].style.backgroundColor)for(var h=e[g].getElementsByTagName("td"),j=0;j<h.length;j++){var k=h[j];if(!k.style.backgroundColor)k.style.backgroundColor=d?b:c}d=!d}};
PORTFOLIO.do_decoding=function(a){var a=document.getElementById(a),b=a.innerHTML,b=b.replace(/&lt;/g,"<"),b=b.replace(/&gt;/g,">"),b=b.replace(/&quot;/g,'"'),b=b.replace(/&amp;/g,"&"),b=unescape(b);a.innerHTML=b};PORTFOLIO.POPUP={};
PORTFOLIO.POPUP.init=function(){$("a.popup").each(function(){var a=$(this).metadata?$(this).metadata():null;if(!(a&&"object"===typeof a))return!1;if(!a.event_type)throw new SyntaxError("You need to specify event type");a.popup_id="tooltip";a.iframe_id="tooltip_iframe";a.offsetX=16;a.offsetY=13;a.zIndex=100;$(this).bind(a.event_type,function(b){PORTFOLIO.POPUP.show(PORTFOLIO.POPUP.getContent(this),a,b)});$(this).mouseout(function(){PORTFOLIO.POPUP.invoke_playback_action("tooltip","stop");$("#tooltip,#tooltip_iframe").fadeOut().remove();
$(document).unbind("mousemove")})});return!0};PORTFOLIO.POPUP.getContent=function(a){if(!a)throw new SyntaxError("Argument was not specified");if("object"!==typeof a)throw new TypeError("Argument is not an object");if(!(a.nextSibling&&"object"===typeof a.nextSibling))throw Error("nextSibling is not an object");if(8!==a.nextSibling.nodeType)throw Error("nextSibling is not a comment node");return a.nextSibling.data};
PORTFOLIO.POPUP.show=function(a,b,c){var d=b.popup_id,f=b.iframe_id;$("#"+d).remove();$("#"+f).remove();$("body").append('<div id="'+d+'" style="display: none; position: absolute;"><div id="tooltip_content"></div></div>');$("body").append("<iframe "+($.browser.msie?'frameborder="0"':"")+' id="'+f+'" style="display: none; position: absolute;"></iframe>');var e=$("#"+d);e.css("z-index",b.zIndex);$("#"+d+"_content").html(a);b.width?e.width(b.width):e.css("max-width","40em");e.css("left",-1E4).css("top",
-1E4).show();c=PORTFOLIO.POPUP.calcPoint({mouseX:c.pageX,mouseY:c.pageY,offsetX:b.offsetX,offsetY:b.offsetY,popupWidth:e.width(),popupHeight:e.height()});e.hide();a=c.X;c=c.Y;e.css("left",a).css("top",c);$.browser.msie?e.show():e.fadeIn();$("#"+f).height(e.height()).width(e.width()).css("background-color","#fff").css("z-index",e.css("z-index")-1).css("left",a).css("top",c).show();PORTFOLIO.POPUP.invoke_playback_action(d,"play");$(document).mousemove(function(a){PORTFOLIO.POPUP.onMove(a,b)});return!0};
PORTFOLIO.POPUP.onMove=function(a,b){if(!(b&&"object"===typeof b))return!1;var c=b.popup_id,d=b.iframe_id;if(!$("#"+c).get(0))return!1;var f=PORTFOLIO.POPUP.calcPoint({mouseX:a.pageX,mouseY:a.pageY,offsetX:b.offsetX,offsetY:b.offsetY,popupWidth:$("#"+c).width(),popupHeight:$("#"+c).height()});$("#"+c+",#"+d).css("left",f.X).css("top",f.Y);return!0};
PORTFOLIO.POPUP.calcPoint=function(a){if(!(a&&"object"===typeof a))return!1;var b=a.mouseX+a.offsetX,c=a.mouseY+a.offsetY,d=c+a.popupHeight;b+a.popupWidth+20>$(window).width()&&(b=a.mouseX-a.offsetX-a.popupWidth);20>=b&&(b=20);d+20>$(window).height()&&(c=a.mouseY-a.offsetY-a.popupHeight);return{X:b,Y:c}};
PORTFOLIO.POPUP.invoke_playback_action=function(a,b){if("undefined"===typeof soundManager)return!1;if(!a)return!1;if(!b)return!1;var c=$("#"+a+" button.play_stop_button");if("play"===b&&0===c.length&&(PORTFOLIO.init_audio_mpeg($("#"+a).get(0)),c=$("#"+a+" button.play_stop_button"),0===c.length))return!1;var d=$("img",c).first();if(0===d.length)return!1;return d.attr("src").match(RegExp(b))?(c.trigger("click"),!0):!1};
PORTFOLIO.makeRequest=function(a,b,c){var d=!1;if(window.XMLHttpRequest)d=new XMLHttpRequest,d.overrideMimeType&&d.overrideMimeType("text/xml");else if(window.ActiveXObject)try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{d=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}if(!d)return alert("Cannot create XMLHTTP instance"),!1;d.onreadystatechange=c?function(){PORTFOLIO.give_report(d)}:function(){PORTFOLIO.get_portfolio_response(d)};d.open("GET",a+b,!0);d.send(null);return 1};
PORTFOLIO.give_report=function(a){if(!a)return!1;if(4==a.readyState){var b=a.responseXML.getElementsByTagName("portfolio").item(0);if(!b)return alert(PORTFOLIO.gettext("Unrecognized XML response")+"\n"+a.responseText),!1;a=b.getElementsByTagName("response").item(0);b=a.getAttribute("request");if("list_class"!=b&&"list_account"!=b)var c=a.firstChild.data,d=a.getAttribute("status"),f=a.getAttribute("code");199<f&&300>f?alert(c):alert(PORTFOLIO.gettext("Server response:")+" "+f+" "+d+"\n\n   "+c)}};
PORTFOLIO.xmldialog_table_id="group_list";
PORTFOLIO.get_portfolio_response=function(a){if(!a)return!1;if(4==a.readyState)if(200==a.status){var b=a.responseXML.getElementsByTagName("portfolio").item(0);if(!b)return alert(PORTFOLIO.gettext("Unrecognized XML response")+"\n"+a.responseText),!1;var c=b.getElementsByTagName("response").item(0),a=c.getAttribute("request");if("list_class"!=a&&"list_account"!=a)var d=c.firstChild.data,f=c.getAttribute("status"),e=c.getAttribute("code");if(199<e&&300>e)if("list_class"==a){d=b.getElementsByTagName("class");
document.getElementById("pf_popdiv").style.display="block";document.getElementById("pf_popdiv_content").innerHTML="<input type=\"button\" value=\"Ny\" onclick=\"var group_name=prompt('Navn p&aring; ny gruppe:','');if (group_name!=null) PORTFOLIO.do_ajax_cmd('cmd=write_class;name='+group_name+';response=xml','"+PORTFOLIO.xmldialog_table_id+'\');" /><br /><table id="'+PORTFOLIO.xmldialog_table_id+'" type="class" class="sort-table" cellspacing="0"><col style="width:100%" /><col style="text-align: center" /><col style="text-align: center" /><col style="text-align: center" /><col style="text-align: center" /><thead><tr><td pfFieldName="name">Gruppenavn</td><td>Slette</td><td>Redigere</td><td>Rettigheter</td><td>Tilh&oslash;righet</td></tr></thead><tbody><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table> ';
for(e=0;e<d.length;e++)b=d.item(e).getAttribute("id"),a=[d.item(e).firstChild.data,'<input type="button" value="Slette" command="delete_class" onclick="PORTFOLIO.ajax_command(this);">','<a href="/?cmd=edit_class;class_id='+b+'">[Rediger]</a>','<a href="/?cmd=list_class_permission;class_id='+b+'">[Rettighet]</a>','<a href="/?cmd=list_class_membership;class_id='+b+'">[Tilh&oslash;righet]</a>'],PORTFOLIO.addrow(PORTFOLIO.xmldialog_table_id,a,b);PORTFOLIO.st1=new SortableTable(document.getElementById(PORTFOLIO.xmldialog_table_id),
["CaseInsensitiveString","None","None","None","None"]);PORTFOLIO.st1.onsort=function(){for(var a=PORTFOLIO.st1.tBody.rows,b=a.length,c=0;c<b;c++)removeClassName(a[c],c%2?"odd":"even"),addClassName(a[c],c%2?"even":"odd")};PORTFOLIO.st1.sort(0,!1)}else if(-1<a.indexOf("account")){var g=b.getElementsByTagName("account").item(0),b=g.getAttribute("id"),f=g.getElementsByTagName("name").item(0).firstChild?g.getElementsByTagName("name").item(0).firstChild.data:"",c=g.getElementsByTagName("name").item(1).firstChild?
g.getElementsByTagName("name").item(1).firstChild.data:"",h=g.getElementsByTagName("name").item(2).firstChild?g.getElementsByTagName("name").item(2).firstChild.data:"",g=g.getElementsByTagName("email").item(0).firstChild?g.getElementsByTagName("email").item(0).firstChild.data:"";switch(a){case "write_account":"200"<=e&&"299">=e?(document.getElementsByTagName("body")[0].removeChild(document.getElementById("coverDiv")),document.getElementsByTagName("body")[0].removeChild(document.getElementById("tempDiv")),
a=[unescape(h),unescape(c),unescape(f),unescape(g),"**********",'<input  onclick="PORTFOLIO.doCommand(this)" type="image" src="'+PORTFOLIO.static_url+'theme/crystal/16x16/actions/edit.png" />','<input type="checkbox" class="delete" />',"","","",""],PORTFOLIO.addrow(PORTFOLIO.xmldialog_table_id,a,b),PORTFOLIO.st1.sort(0,!1)):alert(d);break;case "delete_account":a=PORTFOLIO.findRow(PORTFOLIO.xmldialog_table_id,b);null!=a&&PORTFOLIO.delRow(a);PORTFOLIO.st1.sort(0,!1);break;case "update_account":allTds=
PORTFOLIO.findRow(PORTFOLIO.xmldialog_table_id,b).getElementsByTagName("td");if(allTds[0].lastChild.data!=unescape(h))allTds[0].lastChild.data=unescape(h);if(allTds[1].lastChild.data!=unescape(c))allTds[1].lastChild.data=unescape(c);if(allTds[2].lastChild.data!=unescape(f))allTds[2].lastChild.data=unescape(f);if(allTds[3].lastChild.data!=unescape(g))allTds[3].lastChild.data=unescape(g)}}else switch(e=b.getElementsByTagName("class").item(0),d=e.firstChild.data,e=e.getAttribute("id"),a){case "write_class":a=
[unescape(d),'<input type="button" value="Slette" command="delete_class" onclick="PORTFOLIO.ajax_command(this);">','<a href="/?cmd=edit_class;class_id='+e+'">[Rediger]</a>','<a href="/?cmd=list_class_permission;class_id='+e+'">[Rettighet]</a>','<a href="/?cmd=list_class_membership;class_id='+e+'">[Tilh&oslash;righet]</a>'];PORTFOLIO.addrow(PORTFOLIO.xmldialog_table_id,a,e);PORTFOLIO.st1.sort(0,!1);break;case "delete_class":a=PORTFOLIO.findRow(PORTFOLIO.xmldialog_table_id,e);null!=a&&PORTFOLIO.delRow(a);
PORTFOLIO.st1.sort(0,!1);break;case "update_class":if(a=PORTFOLIO.findRow(PORTFOLIO.xmldialog_table_id,e),null!=a)a.firstChild.innerHTML=d}else alert(e+" - "+f+"\n"+d)}else alert("Unknown error!\nThere was a problem with the request.");return 1};
PORTFOLIO.ajax_command=function(a){var b=a.getAttribute("command"),a=a.parentNode.parentNode,c=a.getAttribute("id");PORTFOLIO.xmldialog_table_id=a.parentNode.parentNode.getAttribute("id");var d;if(d="delete_class"==b){d=a.style.backgroundColor;a.style.backgroundColor="red";var f=a.style.color;a.style.color="yellow";var e=confirm("Markert rad vil bli slettet...");a.style.backgroundColor=d;a.style.color=f;d=!1==e}if(d)return!1;PORTFOLIO.makeRequest("/","?cmd="+b+";class_id="+c+";response=xml");return 1};
PORTFOLIO.do_ajax_cmd=function(a,b){if(b)PORTFOLIO.xmldialog_table_id=b;PORTFOLIO.makeRequest("/","?"+a)};PORTFOLIO.findRow=function(a,b){for(var c=document.getElementById(a).getElementsByTagName("TR"),d=0;d<c.length;d++)if(uuid=c[d].getAttribute("id"),uuid==b)return c[d];return null};
PORTFOLIO.addrow=function(a,b,c){var a=document.getElementById(a),d=a.rows.length,a=a.insertRow(d);0==d%2?a.setAttribute("class","even"):a.setAttribute("class","odd");a.setAttribute("id",c);for(c=0;c<b.length;c++)d=a.insertCell(c),0==c&&(d.setAttribute("class","editable"),d.setAttribute("className","editable")),d.innerHTML=b[c]};PORTFOLIO.delRow=function(a){a.parentNode.parentNode.deleteRow(a.rowIndex)};
PORTFOLIO.createModalDialog=function(a,b){var c=screen.width,d=screen.height,f=document.getElementsByTagName("body")[0],e=document.createElement("iframe");e.setAttribute("id","coverDiv");e.style.position="absolute";e.style.width=c+"px";e.style.height=d+"px";e.style.top="0";e.style.left="0";e.style.background="white";e.style.filter="alpha(opacity=50)";e.style.mozOpacity=".50";e.style.opacity=".50";e.style.border="solid 1px";f.appendChild(e);e=document.createElement("div");e.setAttribute("id","tempDiv");
e.style.position="absolute";e.style.background="#D4D0C8";e.style.color="black";e.style.border="outset 2px silver";e.style.zIndex="30";e.style.left="150px";e.style.top="100px";e.style.width="450px";e.style.height="350px";f.appendChild(e);f=document.createElement("div");f.style.background="#41629C";f.style.color="white";f.style.padding="0";a='<img src="'+PORTFOLIO.static_url+'gfx/foldericon2.gif" style="border:none; margin-left:5px;margin-right:10px"/>'+a;f.innerHTML='<input type="button" style="float:right" value="x" onclick="document.getElementsByTagName(\'body\')[0].removeChild(document.getElementById(\'coverDiv\'));this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)" /><b>'+
a+"</b>";document.getElementById("tempDiv").appendChild(f);bodyContent=document.createTextNode(b);e.appendChild(bodyContent);PORTFOLIO.do_decoding("tempDiv");f=document.getElementById("tempDiv");e=f.offsetHeight;f.style.left=(c-f.offsetWidth)/2+"px";f.style.top=(d-e)/2+"px"};
PORTFOLIO.doCommand=function(a){var b=a.parentNode.getAttribute("id"),c=a.parentNode.parentNode.parentNode,a=c.rows[0].cells[+a.cellIndex].getAttribute("pfCommand"),c=c.getAttribute("type");a&&c&&b&&PORTFOLIO.createModalDialog(a+" "+c,"Her kommer dialogen "+("/?cmd="+a+"_"+c+";"+c+"_id="+b)+";response=xml")};var lastURL;PORTFOLIO.modalbox_targetinfo="";
PORTFOLIO.filebrowser_insertResult=function(){var a=document.getElementById("pf_browser_uuid").value,b=document.getElementById("pf_browser_insert_method").value;if(a){var c=PORTFOLIO.modalbox_targetinfo.split(","),d=document.getElementById("filebrowser_title").value,f=document.getElementById("filebrowser_mediatype").value,e=document.getElementById("filebrowser_mimetype").value,g="",g=document.getElementById("styleString")?document.getElementById("styleString").value:"";""!=g&&(g=", style => '"+g+
"'");for(var h=0;h<c.length;h+=3){var j=document.getElementById(c[h]),k="";switch(b){case "title":k=d;break;case "uuid":k=a;break;case "embed":k="";"audio"==f&&(k=",player => 'normal'");k="[% embed('"+a+"',{type => '"+f+"', mimetype => '"+e+"'"+k+g+"}) %]";break;case "link":var k=tinyMCEPopup.editor.selection.getContent(),l="read";document.getElementById("pf_browser_typeof_uuid")&&"container"==document.getElementById("pf_browser_typeof_uuid")&&(l="read_container");k=""!=k?'<a href="[% site_url %]'+
l+"/"+a+'">'+k+"</a>":"[% link('"+a+"') %]";break;case "uri":k="[% uri('"+a+"') %]";break;default:k=a}if("content"==c[h]){try{tinyMCE.execCommand("mcePFmacroedit_insert",!0,k)}catch(m){alert("Problems calling tinyMCE\n"+m)}document.getElementById("pf_fileBrowserInnerDiv").parentWindow&&document.getElementById("pf_fileBrowserInnerDiv").parentWindow.close()}else switch(c[h+2]){case "append":j.value+=k;break;case "replace":j.value=k}}PORTFOLIO.modalbox_targetinfo=""}else alert("No object chosen")};
PORTFOLIO.updateExternalLinks=function(){$("a[rel='external']").attr("target","_blank");return!0};PORTFOLIO.scrollContainerToElementByClass=function(a,b){if(!a)return!1;var c=$(a);if(!b)return!1;var d=$("."+b+":last",c);if(!d||!d.get(0))return!1;for(var f=0;d&&d.get(0)&&d.get(0)!==c.get(0);)f+=d.position().top,d=d.offsetParent();c.scrollTop(f);return!0};
PORTFOLIO.layout_fix_height=function(){var a=document.getElementById("element_bottom_info");if(!a)return!1;var b=document.getElementById("element_middle_row");if(!b)return!1;var c=a.offsetTop,d=b.offsetHeight+b.offsetTop,c=a.offsetTop,a=c-d;if(0!=a)b.style.height=b.offsetHeight+a+"px"};
PORTFOLIO.node_toggle_display=function(a){var b=a.parentNode.getElementsByTagName("ul")[0],a=a.parentNode.getElementsByTagName("div")[0];"block"==b.style.display?(b.style.display="none",a.innerHTML="+"):(b.style.display="block",a.innerHTML="-")};
PORTFOLIO.activate_folder_menu=function(a){if(!a)return!1;var b=document.getElementById(a);if(!b)return!1;var a=document.createElement("div"),c=document.createTextNode(" ");a.appendChild(c);a.className="spacer";for(var c=PORTFOLIO.getCookie("PF_expandable_elements"),b=b.getElementsByTagName("li"),d=1;d<b.length;d++)if(1<b[d].innerHTML.length){null==c||c.indexOf(b[d].id);b[d].insertBefore(a.cloneNode(!0),b[d].firstChild);li_ul=b[d].getElementsByTagName("ul");for(var f=1;f<li_ul.length;f++)li_ul[f].style.display=
"block";if(0<li_ul.length){for(var f=b[d].getElementsByTagName("a"),e=!1,g=0;g<f.length;g++)if("highlight"==f[g].className){b[d].firstChild.innerHTML="-";li_ul[0].style.display="block";e=!0;break}if(!e)b[d].firstChild.innerHTML="+",li_ul[0].style.display="none";if(!document.all&&document.getElementById)b[d].firstChild.setAttribute("onclick","PORTFOLIO.node_toggle_display(this,false);");else if(document.all&&document.getElementById)b[d].firstChild.onclick=new Function("PORTFOLIO.node_toggle_display(this.nextSibling,false);");
b[d].firstChild.style.borderColor="#eee"}else b[d].firstChild.style.cursor="default"}else b[d].style.display="none"};PORTFOLIO.agt=navigator.userAgent.toLowerCase();PORTFOLIO.is_major=parseInt(navigator.appVersion,10);PORTFOLIO.is_ie=-1!=PORTFOLIO.agt.indexOf("msie");PORTFOLIO.is_ie4up=PORTFOLIO.is_ie&&4<=PORTFOLIO.is_major;PORTFOLIO.is_opera=-1!=PORTFOLIO.agt.indexOf("opera");
PORTFOLIO.searchForText=function(a,b){var c=null,d=null,f=null,f=-1!=PORTFOLIO.agt.indexOf("mac"),d=-1!=PORTFOLIO.agt.indexOf("gecko"),e=0;d&&(e=PORTFOLIO.agt.split("rv:"),e=parseFloat(e[1]));var g=self;if(PORTFOLIO.is_ie4up&&f)alert("We are sorry, but your browser has not documented this functionality");else if(d&&1>e)alert("We are sorry, but your browser has not documented this functionality");else if(PORTFOLIO.is_opera)alert("We are sorry, but your browser has not documented this functionality");
else if(null!=a.value&&""!=a.value){str=a.value;a.value="";f=b?b:g;g=!1;f!=self&&(g=!0,f=parent.frames[b]);var h,j=-1!=navigator.appName.toLowerCase().indexOf("netscape")&&4==PORTFOLIO.is_major,k=parseFloat(navigator.appVersion);j&&5>k&&(h=f.find(str));d&&1<=e&&(!1!=g&&f.focus(),h=f.find(str,!1,!1,!0,!1,g,!1));if(PORTFOLIO.is_ie4up&&(null!=c&&(d=f.document.body.createTextRange(),null.inRange(d)||(c=f.document.body.createTextRange()),c.collapse(!1),(h=c.findText(str))&&c.select()),null==c||0==h))c=
f.document.body.createTextRange(),c.duplicate(),(h=c.findText(str))&&(1>c.boundingWidth?alert('"'+str+'" '+PORTFOLIO.gettext("found in hidden element.")+" "+PORTFOLIO.gettext("Unable to higlight.")):c.select());a.value=str;h||alert('"'+str+'" '+PORTFOLIO.gettext("not found!"))}};PORTFOLIO.convert_utf8_encoded_to_latin1_encoded=function(a){return escape(decodeURIComponent(a))};
PORTFOLIO.searchEngine=function(){var a=document.getElementById("whereToSearch"),b=document.getElementById("categories"),c=document.getElementById("whatToSearchFor").value,d=a.options[a.selectedIndex].value;({"http://www.nob-ordbok.uio.no/perl/ordbok.cgi?ordbok=bokmaal&OPP=":!0,"http://www.nob-ordbok.uio.no/perl/ordbok.cgi?ordbok=nynorsk&OPP=":!0,"http://www.gulesider.no/tk/search.c?q=":!0,"http://www.vilbli.no/4daction/WA_Oppslag/?x=0&y=0&ASP=6887067&Ran=93305&Niva=V&Return=WA_kurstilbud&TP=06-04-08&find=":!0,
"http://www.leksikon.org/search2.php?val=":!0,"http://norge.no/sok/?txtQueryString=":!0,"http://www.ssb.no/cgi-bin/swish_no.cgi?submit=S%F8k%21&sokebase=www&sort=swishrank&query=":!0,"http://www.alltheweb.com/cgi-bin/search?type=all&query=":!0})[d]&&(c=PORTFOLIO.convert_utf8_encoded_to_latin1_encoded(c));d+=c;""!=c?"clientside"==a.options[a.selectedIndex].value?(PORTFOLIO.searchForText(document.getElementById("whatToSearchFor"),self),document.getElementById("whatToSearchFor").value=c):0<b.selectedIndex?
(externalSearch=window.open(d,"externalSearch","location=yes,resizable=yes,scrollbars=yes,toolbar=yes,directories=no,menubar=no,width=810,height=600"),externalSearch.focus()):window.open(d,"_self"):(alert("Empty search!"),document.getElementById("whatToSearch").focus())};
PORTFOLIO.getSelected=function(a){if(!PORTFOLIO.is_opera){if(PORTFOLIO.is_ie4up)var b=window.document.selection.createRange().text;else window.getSelection()&&(b=window.getSelection());if(""!=b)b=new String(b),document.getElementById(a).value=b}};
search_select=[PORTFOLIO.gettext("Search:"),"whereToSearch",[PORTFOLIO.gettext("Local search"),["clientside",PORTFOLIO.gettext("This document")],[PORTFOLIO.site_url+"search/inside_container/"+PORTFOLIO.current_container+"/?query=",PORTFOLIO.gettext("This folder")],[PORTFOLIO.site_url+"search/inside_course/"+PORTFOLIO.current_course+"/?query=",PORTFOLIO.gettext("This course")],[PORTFOLIO.site_url+"search/site/?query=",PORTFOLIO.gettext("This site")],[PORTFOLIO.site_url+"search/inside_container/?query=",
PORTFOLIO.gettext("Entire database")],[PORTFOLIO.site_url+"read_glossary/?code=",PORTFOLIO.gettext("Portfolio glossary")],[PORTFOLIO.site_url+"search/user/?query=",PORTFOLIO.gettext("Users")],[PORTFOLIO.site_url+"search/group/?query=",PORTFOLIO.gettext("Groups")],[PORTFOLIO.site_url+"search/course/?query=",PORTFOLIO.gettext("Courses")]],[PORTFOLIO.gettext("Dictionaries and Glossaries"),["http://www.nob-ordbok.uio.no/perl/ordbok.cgi?ordbok=bokmaal&OPP=","Bokm\u00e5lsordboka (UiO)"],["http://www.nob-ordbok.uio.no/perl/ordbok.cgi?ordbok=nynorsk&OPP=",
"Nynorskordboka (UiO)"],["http://dictionary.reference.com/search?db=dictionary&q=","Dictionary.com"],["http://thesaurus.reference.com/search?db=thesaurus&q=","Thesaurus.com"],["http://www.ordboka.net/?q=","Ordboka.net (norsk-engelsk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&run-search=&search=","Lexin (norsk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-ara-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=ARA&run-search=&search=",
"Lexin (norsk-arabisk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-kku-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=KKU&run-search=&search=","Lexin (norsk-kurdisk/kurmanji)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-kso-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=KSO&run-search=&search=","Lexin (norsk-kurdisk/sorani)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-per-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=PER&run-search=&search=",
"Lexin (norsk-persisk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-pol-maxi&ui-lang=NBO&startingfrom=0&count=5&checked-languages=E&checked-languages=N&checked-languages=Pol&search=","Lexin (norsk-polsk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-ru-maxi&ui-lang=NBO&startingfrom=0&count=5&checked-languages=E&checked-languages=N&checked-languages=RU&search=","Lexin (norsk-russisk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-som-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=SOM&run-search=&search=",
"Lexin (norsk-somali)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-tam-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=T&run-search=&search=","Lexin (norsk-tamil)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-th-maxi&ui-lang=NBO&startingfrom=0&count=5&checked-languages=E&checked-languages=N&checked-languages=TH&search=","Lexin (norsk-thai)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-tir-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=TIR&run-search=&search=",
"Lexin (norsk-tigrinja)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-tur-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=TUR&run-search=&search=","Lexin (norsk-tyrkisk)"],["http://decentius.aksis.uib.no/lexin.html?dict=nbo-ur-maxi&ui-lang=nbo&checked-languages=E&checked-languages=N&checked-languages=UR&run-search=&search=","Lexin (norsk-urdu)"]],[PORTFOLIO.gettext("Search engines"),["http://www.altavista.com/web/results?itag=ody&kgs=1&kls=1&q=","AltaVista"],["http://no.altavista.com/web/results?itag=ody&kgs=1&kls=1&q=",
"AltaVista Norge "],["http://www.ask.com/main/askJeeves.asp?Source=0&site_name=Jeeves&scope=web&metasearch=yes&r=x&frames=no&spellcheck=on&ask=","Ask Jeeves"],["http://www.google.com/search?hl=no&q=","Google ("+PORTFOLIO.gettext("Norwegian - Bokmaal")+")"],["http://www.google.com/search?hl=nn&q=","Google ("+PORTFOLIO.gettext("Norwegian - Nynorsk")+")"],["http://scholar.google.no/scholar?hl=no&lr=&q=","Google Scholar"],["http://books.google.com/books?as_brr=0&q=","Google Book Search"],["http://video.google.com/videosearch?q=",
"Google Video"],["http://www.hotbot.com/?&ps=&loc=searchbox&tab=web&mode=search&query=","HotBot"],["http://www.alltheweb.com/cgi-bin/search?type=all&query=","FAST - All the Web"],["http://www.kvasir.no/nettsok/searchResult.html?x=61&y=19&searchRegion=country&searchExpr=","Kvasir"],["http://www.metacrawler.com/metacrawler/ws/redir/rfcp=Other/rfcid=999915/_iceUrlFlag=11?_IceUrl=true&qcat=web&qkw=","MetaCrawler / WebCrawler"],["http://www.bing.com/search?q=","Microsoft Bing search"],["http://no.search.yahoo.com/search;_ylt=A1f4cff6BNdKbOoANZ0qNAx.?fr=sfp&fr2=&rd=r1&p=",
"Yahoo (Norge)"],["http://search.yahoo.com/search?q=","Yahoo (verden)"]],[PORTFOLIO.gettext("Graphic Resources"),["http://www.altavista.com/image/results?pg=q&stype=simage&imgset=2&avkw=xytx&q=","AltaVista graphics"],["http://images.google.no/images?hl=en&q=","Google Images"],["http://www.morguefile.com/archive/browse/#/?qury=","MorgueFile"]],[PORTFOLIO.gettext("Indexes and Start Pages"),["http://abcsok.no/index.html?lr=www-en-us&q=","ABC Startsiden"],["http://origo.no/-/explore/posts?q=","Origo Index"]],
[PORTFOLIO.gettext("Public Services"),["http://www.nav.no/systemsider/S\u00f8k?queryparameter=","NAV"],["http://norge.no/sok/?txtQueryString=","Norge.no"],["http://www.regjeringen.no/nb/sok.html?id=86008&quicksearch=","Regjeringen.no"],["http://www.ssb.no/cgi-bin/swish_no.cgi?submit=S%F8k%21&sokebase=www&sort=swishrank&query=","Statistisk sentralbyr\u00e5"]],[PORTFOLIO.gettext("Encyclopedias"),["http://encarta.msn.com/encnet/refpages/search.aspx?q=","Encarta"],["http://www.google.com/custom?domains=www.pantheon.org&sitesearch=www.pantheon.org&client=pub-4733091037612954&forid=1&channel=6911122456&ie=UTF-8&oe=UTF-8&safe=active&cof=GALT%3A%23000088%3BGL%3A1%3BDIV%3A%23FFFFFF%3BVLC%3A000088%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A4B82CC%3BALC%3A000088%3BLC%3A000088%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A50%3BLW%3A164%3BL%3Ahttp%3A%2F%2Fwww.pantheon.org%2Fimages%2Fmythica_small.png%3BS%3Ahttp%3A%2F%2Fwww.pantheon.org%2F%3BFORID%3A1%3B&hl=en&q=",
"Encyclopaedia Mythica"],["http://www.bartleby.com/cgi-bin/texis/webinator/sitesearch?FILTER=col65&query=","Columbia Encyclopedia"],["http://www.leksikon.org/search2.php?val=","Leksikon.org ("+PORTFOLIO.gettext("danish")+")"],["http://en.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+PORTFOLIO.gettext("english")+")"],["http://fr.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+PORTFOLIO.gettext("french")+")"],["http://no.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+
PORTFOLIO.gettext("norwegian")+")"],["http://pt.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+PORTFOLIO.gettext("portugis")+")"],["http://es.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+PORTFOLIO.gettext("spanish")+")"],["http://de.wikipedia.org/wiki/Spesial:Search/?search=","Wikipedia ("+PORTFOLIO.gettext("german")+")"]],[PORTFOLIO.gettext("Religious Scriptures"),["http://www.islam.no/newsite/content/default.asp?Action=NewSearch&nTopPage=52&searchstring=","Koranen (norsk database)"]],
[PORTFOLIO.gettext("School and Education"),["http://utdanning.no/finn/?s=","Utdanning.no"],["http://www.utdanningsnytt.no/templates/Search20____307.aspx?quicksearchquery=","Utdanning.ws"],["http://utdanningsdirektoratet.no/templates/udir/TM_S%C3%B8k.aspx?id=197&quicksearchquery=","Utdanningsdirektoratet"],["http://www.vilbli.no/4daction/WA_Oppslag/?x=0&y=0&ASP=6887067&Ran=93305&Niva=V&Return=WA_kurstilbud&TP=06-04-08&find=","vilbli.no"]],[PORTFOLIO.gettext("Media"),["http://search.bbc.co.uk/cgi-bin/search/results.pl?uri=%2F&scope=all&go=toolbar&q=",
"BBC"],["http://search.cnn.com/search.jsp?type=web&sortBy=date&intl=false&query=","CNN"],["http://www.mylder.no/newssearch.php?kategori=&limit=50&search=","Mylder.no (nyheter)"],["http://partner.sesam.no/nrk/?c=n&ss_lt=sitesearch&ss_ss=nrk.no&ss_pid=nrk&ss_vpos=top&userSortBy=datetime&q=","NRK"],["http://www.wired.com/search?siteAlias=all&x=0&y=0&query=","Wired News"],["http://no.news.search.yahoo.com/search/news?fr=sfp&ei=UTF-8&p=","Yahoo nyheter"]],[PORTFOLIO.gettext("Phone Books"),["http://www.gulesider.no/tk/search.c?q=",
"Gule sider"],["http://www.1881.no/?qt=8&Query=","1881"]]];
PORTFOLIO.populateSelect=function(a,b,c,d){if(d)document.forms.element_search.remember_search_engine.checked="";a=document.getElementById(a).selectedIndex+2;b=document.getElementById(b);b.options.length=0;for(var f=1;f<c[a].length;f++)if(b.options[b.options.length]=new Option(search_select[a][f][1],search_select[a][f][0]),0<=search_select[a][f][0].indexOf("undefined")&&b.options[f-1].setAttribute("disabled","true"),d&&c[a][f][0]==PORTFOLIO.default_search)b.options[f-1].selected="selected",document.forms.element_search.remember_search_engine.checked=
"checked"};
PORTFOLIO.write_search_config=function(a){var b="",a=document.getElementById(a),b=document.forms.element_search.whereToSearch,c=b.options[b.selectedIndex].value;if(a.checked)if(confirm(PORTFOLIO.gettext("Set as preferred search engine?")+"\n\n     "+b.options[b.selectedIndex].text))b="xml/write_config/?type=account;code=default_search;value="+encodeURIComponent(c)+";force_overwrite=1";else return a.checked="",!1;else if(confirm(PORTFOLIO.gettext("Remove preferred search engine?")+"\n\n     "+b.options[b.selectedIndex].text))b=
"xml/delete_config/?type=account;code=default_search";else return a.checked="checked",!1;""!=b&&PORTFOLIO.makeRequest("/",b,!0)};PORTFOLIO.uncheck_search_checkbox=function(){document.forms.element_search.remember_search_engine.checked=""};
PORTFOLIO.create_search_form=function(a,b){var c=document.getElementById(a);if(!c)return!1;var d=document.createElement("form");d.setAttribute("id","element_search");d.setAttribute("action","javascript:PORTFOLIO.searchEngine();");d.setAttribute("method","post");if(!document.all&&document.getElementById)d.setAttribute("onclick",'PORTFOLIO.getSelected("whatToSearchFor");');else if(document.all&&document.getElementById)d.onclick=new Function('PORTFOLIO.getSelected("whatToSearchFor");');var f=document.createElement("fieldset"),
e=document.createTextNode(PORTFOLIO.gettext("Search:")+" ");f.appendChild(e);e=document.createElement("select");e.id="categories";e.name="categories";for(var g=2;g<search_select.length;g++){e.options[e.options.length]=new Option(search_select[g][0]);for(var h=1;h<search_select[g].length;h++)if(search_select[g][h][0]==PORTFOLIO.default_search)e.options[g-2].selected="selected"}if(!document.all&&document.getElementById)e.setAttribute("onchange",'PORTFOLIO.populateSelect("categories","whereToSearch",search_select,'+
b+");");else if(document.all&&document.getElementById)e.onchange=new Function('PORTFOLIO.populateSelect("categories","whereToSearch",search_select,'+b+");");f.appendChild(e);e=document.createElement("select");e.id="whereToSearch";e.name="whereToSearch";if(b)if(!document.all&&document.getElementById)e.setAttribute("onchange","PORTFOLIO.uncheck_search_checkbox();");else if(document.all&&document.getElementById)e.onchange=new Function("PORTFOLIO.uncheck_search_checkbox();");f.appendChild(e);if(b){e=
document.createElement("input");e.type="checkbox";e.id="remember_search_engine";e.name="remember_search_engine";if(!document.all&&document.getElementById)e.setAttribute("onclick",'PORTFOLIO.write_search_config("remember_search_engine");');else if(document.all&&document.getElementById)e.onclick=new Function('PORTFOLIO.write_search_config("remember_search_engine");');e.title=PORTFOLIO.gettext("Remember selected");f.appendChild(e)}e=document.createElement("input");e.setAttribute("type","text");e.setAttribute("id",
"whatToSearchFor");e.setAttribute("name","whatToSearchFor");e.setAttribute("value","");f.appendChild(e);e=document.createElement("input");e.setAttribute("type","button");e.setAttribute("id","goSearch");e.setAttribute("name","goSearch");e.setAttribute("value",PORTFOLIO.gettext("Search"));e.setAttribute("accesskey","s");if(!document.all&&document.getElementById)e.setAttribute("onclick",'PORTFOLIO.getSelected("whatToSearchFor");PORTFOLIO.searchEngine();'),e.setAttribute("onkeypress",'PORTFOLIO.getSelected("whatToSearchFor");PORTFOLIO.searchEngine();');
else if(document.all&&document.getElementById)e.onclick=new Function('PORTFOLIO.getSelected("whatToSearchFor");PORTFOLIO.searchEngine();'),e.onkeypress=new Function('PORTFOLIO.getSelected("whatToSearchFor");PORTFOLIO.searchEngine();');f.appendChild(e);d.appendChild(f);c.appendChild(d);PORTFOLIO.populateSelect("categories","whereToSearch",search_select,b);if(b&&PORTFOLIO.default_search&&""!=PORTFOLIO.default_search)document.getElementById("remember_search_engine").checked="checked"};
PORTFOLIO.checkAllCheckboxes=function(a,b){for(var c=a.split(/\,/g),d=0;d<c.length;d++){var f=0;do{var e=b.elements[f];if(e.name==c[d]&&"checkbox"==e.type)e.checked=!0;f++}while(f<b.length)}};PORTFOLIO.uncheckAllCheckboxes=function(a,b){for(var c=a.split(/\,/g),d=0;d<c.length;d++){var f=0;do{var e=b.elements[f];if(e.name==c[d]&&"checkbox"==e.type)e.checked=!1;f++}while(f<b.length)}};
PORTFOLIO.getPFxcellContent=function(a,b){if(!document.getElementById(b)&&document.getElementById(a))return!1;var c=document.getElementById(b);c.value=document.getElementById(a).getPFxcell_content("");if(!c.form)return!1;c=c.form;if(!c.elements.type||!c.elements.mimetype)return!1;c.elements.type.value="spreadsheet";c.elements.mimetype.value="application/vnd.ms-excel";return!0};PORTFOLIO.MATCHBOX={};
PORTFOLIO.MATCHBOX.shuffle_array=function(a){var b,c,d=a.length;if(!d)return!1;for(;--d;)c=Math.floor(Math.random()*(d+1)),b=a[c],a[c]=a[d],a[d]=b;return!0};
PORTFOLIO.MATCHBOX.make=function(a,b){if("object"!==typeof b)return!1;b.reset_prev_cell=function(){this.prev_cell_type="";this.prev_pair_index=-1;return!0};b.reset_prev_cell();b.pairs_used=Math.floor(b.cols*b.rows/2);b.pair_score=100/b.pairs_used;b.pairs_solved=0;b.correct_count=0;b.wrong_count=0;b.width=500;var c=b.width/b.cols;PORTFOLIO.MATCHBOX.shuffle_array(b.pairs);var d=[];$.each(b.pairs,function(f,e){if("object"!==typeof e)return!0;if(d.length>=2*b.pairs_used)return!1;var g=$("<td/>",{id:a+
"_A"+f,"class":"cell_a",click:function(){PORTFOLIO.MATCHBOX.check(this,a,b);return!0},width:c,height:c,css:{"background-color":"#FFFFCC"}}).append($("<div/>",{"class":"cell_content",width:c-10,html:e.word1})).data("cell_type","A").data("pair_index",f);g.find("img").attr("title","");d.push(g);g=$("<td/>",{id:a+"_B"+f,"class":"cell_b",click:function(){PORTFOLIO.MATCHBOX.check(this,a,b);return!0},width:c,height:c}).data("cell_type","B").data("pair_index",f);if(!e.word2||(e.language||b.language)&&!e.word2.match(/^</))var h=
$("<img/>",{src:PORTFOLIO.site_url+"get_icon/object/audio",alt:PORTFOLIO.gettext("Audio"),title:PORTFOLIO.gettext("Click to listen"),click:function(){PORTFOLIO.MATCHBOX.talkbook(e.word2||e.word1,e.language||b.language||PORTFOLIO.current_object_content_language||PORTFOLIO.content_language,e.use_letter_name);return!0}}),h=$("<div/>",{"class":"cell_content"}).append(h);else h=$("<div/>",{"class":"cell_content"}).append(e.word2),h.find("img").attr("title","");h.width(c-10);g.append(h);d.push(g)});PORTFOLIO.MATCHBOX.shuffle_array(d);
var f=$("<table/>",{id:a+"_matchbox","class":"matchbox",width:b.width}),e=$("<tr/>");$.each(d,function(a,c){e.append(c);0==(a+1)%b.cols&&(f.append(e),e=$("<tr/>"))});e.children().length&&f.append(e);f.find("dl.object_license img").unwrap().unwrap().next().remove();var g=$("<th/>",{colspan:b.cols-1,"class":"progress",height:10}).append($("<img/>",{src:PORTFOLIO.static_url+"gfx/matchbox_greengraph.jpg",id:a+"_matchbox_correct"})),h=$("<th/>",{colspan:b.cols-1,"class":"progress",height:10}).append($("<img/>",
{src:PORTFOLIO.static_url+"gfx/matchbox_redgraph.jpg",id:a+"_matchbox_wrong"})),j=$("<th/>",{rowspan:2,"class":"reshuffle_container"}).append($("<button/>",{type:"button",id:a+"_matchbox_reshuffle",disabled:"disabled",click:function(){f.remove();$("#"+a).val("");PORTFOLIO.MATCHBOX.make(a,b);PORTFOLIO.init_audio_mpeg();return!0},text:PORTFOLIO.gettext("Reshuffle")}));f.append($("<tr/>").append(g).append(j));f.append($("<tr/>").append(h));g=$("input#"+a).parent();g.append(f).show();g.find(".cell_content img").each(function(){var a=
$(this);a.width()>c-10&&(a.width(c-10),a.height("auto"));a.height()>c-10&&(a.width("auto"),a.height(c-10))});return!0};
PORTFOLIO.MATCHBOX.talkbook=function(a,b,c){if("string"!==typeof a)return!1;if(!b)return!1;b=PORTFOLIO.site_url+"talkbook/"+b+"/"+encodeURIComponent(PORTFOLIO.trim(a))+(c?"/1":"");if("undefined"===typeof soundManager)return alert(PORTFOLIO.gettext("Page template does not include sound playback component.")),!1;b=soundManager.createSound({id:b,url:b,onload:function(b){if(b)return!0;alert(PORTFOLIO.gettext("Sound playback failed because of an error.")+"\n"+PORTFOLIO.gettext("Word:")+" "+a);return!1}});
soundManager.stopAll();b.play();return!0};
PORTFOLIO.MATCHBOX.check=function(a,b,c){a=$(a);if("hidden"===a.children().css("visibility"))return!1;var d=a.data("cell_type"),f=a.data("pair_index"),e=function(){$("#"+b+"_matchbox_reshuffle").removeAttr("disabled");return!0},g=function(a){if(a)c.correct_count+=c.pair_score,$("#"+b+"_matchbox_correct").width(c.correct_count+"%"),c.pairs_solved++,a={cursor:"default",background:"url('"+PORTFOLIO.static_url+"gfx/matchbox_cardback.jpg') #ffff00"},$("#"+b+"_A"+f).css(a).find(":first-child").css("visibility",
"hidden"),$("#"+b+"_B"+f).css(a).find(":first-child").css("visibility","hidden");else if(c.wrong_count+=c.pair_score,$("#"+b+"_matchbox_wrong").width(c.wrong_count+"%"),100<=c.wrong_count)c.wrong_count=100,alert(PORTFOLIO.gettext("You may have misunderstood this exercise.")+"\n"+PORTFOLIO.gettext('Try clicking on "Reshuffle" and start over again.')),e();return!0},h=function(){var a=parseInt(c.correct_count-c.wrong_count,10);0>a&&(a=0);var d=$("#"+b);d.val()<a&&d.val(a);return!0};c.prev_cell_type?
(c.prev_cell_type===d?c.prev_pair_index!==f&&g(!1):c.prev_pair_index===f?g(!0):g(!1),"undefined"!==typeof soundManager&&soundManager.stopAll(),$("#"+b+"_"+c.prev_cell_type+c.prev_pair_index).css({"border-color":"","background-color":"A"===c.prev_cell_type?"#ffffcc":"",color:""}),c.reset_prev_cell(),c.pairs_solved===c.pairs_used&&(h(),$("#"+b+"_matchbox td").css("background","url('"+PORTFOLIO.static_url+"gfx/matchbox_joker.gif') no-repeat center center #ffff00"),e())):(a.css({"border-color":"yellow",
"background-color":"red",color:"white"}),c.prev_cell_type=d,c.prev_pair_index=f);return!0};PORTFOLIO.toggleCheckboxes=function(a,b){var c,d,f;if(!a)return!1;c=a.elements;for(d=0;d<c.length;d++)if(f=c[d],"checkbox"==f.type)if(b){if(f.name==b)f.checked=f.checked?!1:!0}else f.checked=f.checked?!1:!0;return!0};
PORTFOLIO.toggleCheckboxesWithin=function(a,b,c){var d,f;if(!a)return!1;if(!c)return!1;a=a.elements;for(d=0;d<a.length;d++)if(f=a[d],!(0>$(f).parents().index(c))&&"checkbox"==f.type)if(b){if(f.name==b)f.checked=f.checked?!1:!0}else f.checked=f.checked?!1:!0;return!0};PORTFOLIO.submitXHR=function(a,b){if(!a)return!1;$.ajax({url:a.action,type:a.method,data:$(a).serialize(),success:b.success,error:b.failure});return!0};
PORTFOLIO.helpSuccessHandler=function(a,b){var c=a.documentElement,d=document.getElementById(b+"DIV");if(d&&c.getElementsByTagName("content")){if(PORTFOLIO.is_ie){if(document.getElementById(b+"Title")&&c.getElementsByTagName("title"))document.getElementById(b+"Title").innerHTML=c.getElementsByTagName("title")[0].text;$(d).children().filter(":last").get(0).innerHTML=c.getElementsByTagName("content")[0].text}else{if(document.getElementById(b+"Title")&&c.getElementsByTagName("title"))document.getElementById(b+
"Title").innerHTML=c.getElementsByTagName("title")[0].textContent;$(d).children().filter(":last").get(0).innerHTML=c.getElementsByTagName("content")[0].textContent}c=$(d).children().filter(":last").find("a").get();for(i=0;i<c.length;i++)c[i].title=PORTFOLIO.gettext("Links are disabled in this view"),$(c[i]).click(function(){return!1});d.style.display="block";if(c=document.getElementById(b+"IFRAME"))c.style.display="block",c.style.width=d.offsetWidth+"px",c.style.height=d.offsetHeight+"px"}};
PORTFOLIO.helpFailureHandler=function(a){alert(PORTFOLIO.gettext("Failed: ")+a.status+" "+a.statusText)};PORTFOLIO.getAjaxObject=function(a,b){$.ajax({url:a,dataType:"xml",success:function(a){return PORTFOLIO.helpSuccessHandler(a,b)},error:PORTFOLIO.helpFailureHandler})};
PORTFOLIO.PopDocAjax=function(a,b){var c=document.getElementById(b+"DIV");c&&"block"==c.style.display?(c.style.display="none",document.getElementById(b+"IFRAME").style.display="none"):a?PORTFOLIO.getAjaxObject(PORTFOLIO.site_url+"xml/read/"+a,b):alert(PORTFOLIO.gettext("No help is configured on this topic."))};
PORTFOLIO.contentSuccessHandler=function(a,b){var c=a.responseXML.documentElement,d=document.getElementById("element_content");if(d&&c.getElementsByTagName("content"))PORTFOLIO.is_ie?(c.getElementsByTagName("title")&&(myHTML="<h1>"+c.getElementsByTagName("title")[0].text+"</h1>"),myHTML+='<div id="wrapper_object_content">',c.getElementsByTagName("description")&&(myHTML+='<div class="introduction">'+c.getElementsByTagName("title")[0].text+"</div>"),myHTML+=c.getElementsByTagName("content")[0].text):
(c.getElementsByTagName("title")&&(myHTML="<h1>"+c.getElementsByTagName("title")[0].textContent+"</h1>"),myHTML+='<div id="wrapper_object_content">',c.getElementsByTagName("description")&&(myHTML+='<div class="introduction">'+c.getElementsByTagName("title")[0].textContent+"</div>"),myHTML+=c.getElementsByTagName("content")[0].textContent),myHTML+="</div>",d.innerHTML=myHTML,c=window.document.location.href.split("#"),window.document.location.href=c[0]+"#"+b};
PORTFOLIO.txtSuccessHandler=function(a){$("#element_content").html('<div id="wrapper_all_content">'+a+"</div>")};PORTFOLIO.getAjaxContent=function(a){var b=a.href,b=b.replace(PORTFOLIO.site_url,PORTFOLIO.site_url+"xml/read/"),b=a.href.replace(PORTFOLIO.site_url+"?",PORTFOLIO.site_url+"?html_fragment=1;");$.ajax({url:b,success:function(){return PORTFOLIO.txtSuccessHandler(data,a.href)},error:PORTFOLIO.helpFailureHandler})};
PORTFOLIO.changeAjaxAble=function(){var a=document.getElementById("element_menu"),a=PORTFOLIO.getElementsByClassName("AjaxAble","a",a);for(i=0;i<a.length;i++)if(a[i].title="AjaxAble",!document.all&&document.getElementById)a[i].setAttribute("onclick","PORTFOLIO.getAjaxContent(this);return false;");else if(document.all&&document.getElementById)a[i].onclick=new Function("PORTFOLIO.getAjaxContent(this);return false;")};
PORTFOLIO.initTableSorter=function(){if($.fn.tablesorter){$.tablesorter.defaults.widgets=["zebra"];var a={};if($.fn.metadata)a.textExtraction=function(a){var c=$(a).metadata();return void 0!==c.sortValue?c.sortValue:a.innerHTML};$("table.tablesorter").tablesorter(a)}};
PORTFOLIO.initBuilder=function(){$(".builder").children().hide();$(".builder").after('<button class="builder_button" type="button">'+PORTFOLIO.gettext("Show next element")+"</button>").next().click(function(){var a=$(this).prev().children(":hidden");a.eq(0).show("slow");a.get(1)||$(this).remove()})};PORTFOLIO.initClickableObjectHeaders=function(){$(".portfolio_object_header").each(function(){$(this).css("cursor","pointer");$(this).click(function(a){if(a.target===this)window.location=$(this).find("a.portfolio_object_link").attr("href")})})};
PORTFOLIO.FLAG={defaults:{},prefix:"portfolio_flag_",elementPrefix:"element_",wrapperSelector:"#wrapper_middle_row"};PORTFOLIO.FLAG.isSet=function(a){var b=PORTFOLIO.getCookie(PORTFOLIO.FLAG.prefix+a+"_"+PORTFOLIO.site_hostname);null==b&&(b=PORTFOLIO.FLAG.getDefault(a));return"1"==b};PORTFOLIO.FLAG.set=function(a){PORTFOLIO.setCookie(PORTFOLIO.FLAG.prefix+a+"_"+PORTFOLIO.site_hostname,"1");if(a=$("#"+PORTFOLIO.FLAG.prefix+a).get(0))a.checked=!0;return!0};
PORTFOLIO.FLAG.unset=function(a){PORTFOLIO.setCookie(PORTFOLIO.FLAG.prefix+a+"_"+PORTFOLIO.site_hostname,"0");if(a=$("#"+PORTFOLIO.FLAG.prefix+a).get(0))a.checked=!1;return!0};PORTFOLIO.FLAG.getDefault=function(a){return"string"===typeof PORTFOLIO.FLAG.defaults[a]?PORTFOLIO.FLAG.defaults[a]:"1"};PORTFOLIO.FLAG.setDefault=function(a,b){PORTFOLIO.FLAG.defaults[a]=b?"1":"0";return!0};
PORTFOLIO.FLAG.showElement=function(a,b){PORTFOLIO.FLAG.set(a);b||(b="#"+PORTFOLIO.FLAG.elementPrefix+a);$(b).show();PORTFOLIO.FLAG.wrapperHack(a,$(b).width());PORTFOLIO.layout_fix_height();return!0};PORTFOLIO.FLAG.hideElement=function(a,b){PORTFOLIO.FLAG.unset(a);b||(b="#"+PORTFOLIO.FLAG.elementPrefix+a);$(b).hide();PORTFOLIO.FLAG.wrapperHack(a,0);PORTFOLIO.layout_fix_height();return!0};
PORTFOLIO.FLAG.toggleElement=function(a,b){PORTFOLIO.FLAG.isSet(a)?PORTFOLIO.FLAG.hideElement(a,b):PORTFOLIO.FLAG.showElement(a,b);return!0};
PORTFOLIO.FLAG.wrapperHack=function(a,b){0===b?("cell_left"===a&&$(PORTFOLIO.FLAG.wrapperSelector).addClass("wrapper_middle_row_margin_left_hack"),"cell_right"===a&&$(PORTFOLIO.FLAG.wrapperSelector).addClass("wrapper_middle_row_margin_right_hack")):("cell_left"===a&&$(PORTFOLIO.FLAG.wrapperSelector).removeClass("wrapper_middle_row_margin_left_hack"),"cell_right"===a&&$(PORTFOLIO.FLAG.wrapperSelector).removeClass("wrapper_middle_row_margin_right_hack"));return!0};
PORTFOLIO.hideMOTD=function(){$("#element_motd").css("display","none");$.cookie("MOTD_invisible","1",{path:"/",expires:7})};
PORTFOLIO.init_audio_mpeg=function(a,b){"object"===typeof b&&b||(b={});b.play_image_url=b.play_image_url||PORTFOLIO.site_url+"get_icon/media/play";b.stop_image_url=b.stop_image_url||PORTFOLIO.site_url+"get_icon/media/stop";b.pause_image_url=b.pause_image_url||PORTFOLIO.site_url+"get_icon/media/pause";var c=function(a){var b=$('<span style="margin-left: 0.5em;"></span>');b.append($(a).contents());$(a).replaceWith(b);return!0},d=function(a){var c=PORTFOLIO.gettext("Button");"play"===a?c=PORTFOLIO.gettext("Play"):
"stop"===a?c=PORTFOLIO.gettext("Stop"):"pause"===a&&(c=PORTFOLIO.gettext("Pause"));return $("<img/>",{src:b[a+"_image_url"]||"#",alt:c,css:{padding:"0",margin:"0"}})},f=function(a){$(a).removeAttr("disabled")},e=function(a){$(a).attr("disabled","disabled")},g=function(a){$.each(soundManager.soundIDs,function(b,c){if(a===c)return!0;var d=soundManager.getSoundById(c);d&&d.pause();return!0})},h=function(a,b,c){return function(){e(a);f(b);f(c);g(this.sID)}},j=function(a,b,c){return function(){f(a);e(b);
f(c)}},k=function(a,b,c){return function(){f(a);e(b);e(c)}},l=function(a){if(!a)return null;var b=a.play_handler?a.play_handler:h(a.play_button,a.pause_button,a.stop_button),c=a.pause_handler?a.pause_handler:j(a.play_button,a.pause_button,a.stop_button),d=a.stop_handler?a.stop_handler:k(a.play_button,a.pause_button,a.stop_button),e=a.autoplay,f=a.url+"#"+a.index;soundManager.getSoundById(f)&&soundManager.destroySound(f);$.each(soundManager.soundIDs,function(a,b){var c=soundManager.getSoundById(b);
return c&&1===c.playState?e=!1:!0});return soundManager.createSound({id:f,url:a.url,stream:!0,volume:100,autoPlay:e,onplay:b,onresume:b,onpause:c,onstop:d,onfinish:d})},m=function(a){return"inline"===a?$('<span class="audio_mpeg"></span>'):"block"===a?$('<div class="audio_mpeg"></div>'):null},n=function(a){var b=$("<button/>",{type:"button","class":a+"_button",css:{padding:"0"}});("pause"===a||"stop"===a)&&b.attr("disabled","disabled");return b},s=function(a,b,c,e){var f=m("inline"),h=n("play_stop"),
j=d("play"),k=d("stop");$(h).append(j);$(f).append(h);$(b).replaceWith(f);var b=function(){$(h).empty();$(h).append(j)},o=l({index:a,url:c,autoplay:e,play_handler:function(){g(this.sID);$(h).empty();$(h).append(k)},pause_handler:b,stop_handler:b});$(h).click(function(a){a.preventDefault();o.playState?o.stop():o.play()});$(f).show();return!0},t=function(a,b,f,e){var g=m("block"),h=n("play"),j=n("pause"),k=n("stop"),o=d("play"),q=d("pause"),r=d("stop");$(h).append(o);$(j).append(q);$(k).append(r);$(b).before(g);
$(g).append(h);$(g).append(j);$(g).append(k);$(g).append(b);c(b);var p=l({index:a,url:f,autoplay:e,play_button:h,pause_button:j,stop_button:k});$(h).click(function(a){a.preventDefault();p.play()});$(j).click(function(a){a.preventDefault();p.pause()});$(k).click(function(a){a.preventDefault();p.stop()});$(g).show();return!0},u=function(a,b,f,e){var g=m("block"),h=n("play"),j=n("pause"),k=n("stop"),o=d("play"),q=d("pause"),r=d("stop");$(h).append(o);$(j).append(q);$(k).append(r);$(b).before(g);$(g).append(h);
$(g).append(j);$(g).append(k);$(g).append(b);c(b);var p=l({index:a,url:f,autoplay:e,play_button:h,pause_button:j,stop_button:k});$(h).click(function(a){a.preventDefault();p.play()});$(j).click(function(a){a.preventDefault();p.pause()});$(k).click(function(a){a.preventDefault();p.stop()});$(g).show();return!0};return soundManager.onready(function(b){if(!b.success)return!1;$("a.audio_mpeg",a).each(function(a,b){var c=$(b).attr("href"),d=$(b).hasClass("autoplay")?!0:!1;$(b).hasClass("small_audio_player")&&
s(a,b,c,d);$(b).hasClass("normal_audio_player")&&t(a,b,c,d);$(b).hasClass("large_audio_player")&&u(a,b,c,d)});return!0})};PORTFOLIO.init_expand_contract_effect=function(a,b){var c=$(a),d=function(){c.height(b?b:c.css("lineHeight"));c.css("overflow","hidden")};c.hover(function(){c.height("auto");c.css("overflow","auto")},d);d();c.css("display","block");return!0};PORTFOLIO.init_object_license=function(){$("dl.object_license dd").each(function(a,b){return PORTFOLIO.init_expand_contract_effect(b)})};
PORTFOLIO.parse_url=function(a){var b=document.createElement("a");b.href=a;for(var c=b.protocol.replace(":",""),d=b.hostname,f=b.port,e=b.search,g={},h=b.search.replace(/^\?/,"").split(";"),j=h.length,k=0,l;k<j;k++)h[k]&&(l=h[k].split("="),g[l[0]]=l[1]);return{source:a,protocol:c,host:d,port:f,query:e,params:g,file:(b.pathname.match(/\/([^\/?#]+)$/i)||[,""])[1],hash:b.hash.replace("#",""),path:b.pathname.replace(/^([^\/])/,"/$1"),relative:(b.href.match(/tps?:\/\/[^\/]+(.+)/)||[,""])[1],segments:b.pathname.replace(/^\//,
"").split("/")}};PORTFOLIO.init_confirm_delete=function(){$("a.confirm_delete").live("click",function(){return confirm(PORTFOLIO.gettext("Do you really want to delete?"))?!0:!1});return!0};
PORTFOLIO.init_tabs=function(){$("div.tab-pane").each(function(){var a="";$("div.tab-page",this).each(function(){var b=$(this).attr("id"),c=$(this).children("h2").first(),d=c.html();c.remove();a=a+'<li><a href="#'+b+'">'+d+"</a></li>\n";return!0});a&&(a="<ul>\n"+a+"</ul>\n",$(this).prepend(a),$(this).tabs());return!0});return!0};
PORTFOLIO.init_content_editor=function(){if(!PORTFOLIO.content_editor)return!1;if(!PORTFOLIO.content_editor.selector)return!1;var a=$(PORTFOLIO.content_editor.selector).get(0);if(!a)return!1;if(!PORTFOLIO.content_editor.editor)return!1;$.get(PORTFOLIO.site_url+"fragment/read/"+PORTFOLIO.content_editor.editor,{no_comments:1},function(b){$(a).before(b);var c=$(a).prev().get(0);if(!c)return!1;var d=a.form;if(!d)return!1;var b=d.custom_init.value.split("|"),f="";for(i=0;i<b.length;i++){var e=b[i].split("=");
"player"==e[0]&&(f=e[1])}$(d).submit(function(){if(!c.isValidExercise())return alert(PORTFOLIO.gettext("Invalid exercise, check syntax.")),!1;$(a).val(c.getExercise());for(var b="player="+c.getAppID(),b=b.replace("applet_",""),f=d.custom_init.value.split("|"),e=0;e<f.length;e++)"player"!=f[e].split("=")[0]&&(b=b+"|"+f[e]);d.custom_init.value=b;return!0});$(a).hide();c.setExercise(f,$(a).val());return!0});return!0};
PORTFOLIO.fix_rtl=function(){$.browser.msie7=$.browser.msie&&/MSIE 7\.0/i.test(window.navigator.userAgent);$.browser.msie7&&$("div[dir=rtl]").css({direction:"rtl"})};
PORTFOLIO.init_text_to_speech=function(a){$(a).textNodes().each(function(){for(var a=$(this).text().split(" "),c=0;c<a.length;c++)a[c]&&a[c].length&&!a[c].match(/^\s+$/)&&(a[c]=a[c].replace(a[c],'<span class="tts">'+a[c]+"</span>"));$(this).replaceWith(a.join(" "))});$("span.tts").live("click",function(){PORTFOLIO.play_tts_word($(this).text())});$("span.tts").live("dblclick",function(){PORTFOLIO.play_tts_word($(this).text())})};
jQuery.fn.textNodes=function(){var a=[];this.contents().each(function(){var b=arguments.callee;3==this.nodeType||$.nodeName(this,"br")?0==$(this).parents("a, option, select, textarea, input, iframe, button, label, script, style").length&&a.push(this):$(this).contents().each(b)});return $(a)};
PORTFOLIO.play_tts_word=function(a){if("undefined"===typeof soundManager)return!1;a=a.replace(/((&\w+;|[-\/+*=?:.,;()\[\]{}|%^!])+)/g,"");a=soundManager.createSound({id:"tts_"+a,url:PORTFOLIO.site_url+"tts/"+encodeURIComponent($.trim(a))});soundManager.stopAll();a.play();return!0};
PORTFOLIO.create_contact_manager=function(a,b,c){if(!typeof $.dialog)return alert("jQuery UI dialog support not detected!"),!1;$(a).click(function(a){a.preventDefault();var a='<div class="contact-manager-dialog" title="'+PORTFOLIO.gettext("Contact Manager")+'"></div>',f=$(a);$(document.body).append(f);var e=f.dialog({autoOpen:!1,modal:!0,width:350,buttons:b,close:function(){f.remove()}}),a=PORTFOLIO.site_url+"fragment/contact_manager";c&&(a=a+"?"+$.param(c,!0));f.load(a,function(){e.dialog("open")})})};
PORTFOLIO.TINYMCE={};PORTFOLIO.TINYMCE.save_callback=function(a,b){return tinyMCE.get(a).isHidden()?document.getElementById(a).value:b};
PORTFOLIO.TINYMCE.execcommand_callback=function(a,b,c){switch(c){case "mcePreview":return b=encodeURIComponent(document.getElementById("title").value),c=encodeURIComponent(document.getElementById("description_alias").value),tinyMCE.get(a),a=encodeURIComponent(tinyMCE.activeEditor.getContent()),window.open(PORTFOLIO.site_url+"preview_content/?title="+b+";description="+c+";content="+a,"pf_preview","scrollbars=yes,menubars=no,resizable=yes,width=630,height=450").window.focus(),!0}return!1};
PORTFOLIO.inherit_from=function(a,b){var c=function(){};c.prototype=a;var d=new c;$.isPlainObject(b)&&$.each(b,function(a,c){b.hasOwnProperty(a)&&(d[a]=c);return!0});return d};
PORTFOLIO.trigger_quiz_alert=function(a){if(!typeof $.dialog)return alert(a),!0;var b=$("<div/>",{text:a}).appendTo("body"),a={title:PORTFOLIO.gettext("Quiz message"),modal:!0,width:350,resizable:!1,draggable:!1,closeOnEscape:!0,buttons:[{text:PORTFOLIO.gettext("Ok"),click:function(){$(this).dialog("close");return!0}}],close:function(){b.remove();return!0},open:function(){$(".ui-dialog-titlebar-close").hide();return!0}};b.dialog(a);return!0};
PORTFOLIO.get_text_selection=function(){var a="";window.getSelection?a=window.getSelection()+"":document.getSelection?a=document.getSelection()+"":document.selection&&(a=document.selection.createRange().text+"");return a};PORTFOLIO.strip_excess_whitespace=function(a){"string"!==typeof a&&(a+="");a=a.replace(/^\s*(.*)/,"$1");a=a.replace(/(.*)\s*$/,"$1");a=a.replace(/[\t ]+/g," ");a=a.replace(/[\v\f\r\n]+/g,"\n");a=a.replace(/ *\n/g,"\n");return a=a.replace(/[\v\f\r\n]+/g,"\r\n")};
PORTFOLIO.play_m3u_playlist=function(a,b){if("string"!==typeof a)return!1;if("string"!==typeof b)return!1;if("undefined"===typeof soundManager)return!1;var c=a.split(/\r?\n/),d=function(){var a=c.shift();if(!a)return soundManager.stopAll(),!1;soundManager.createSound({id:a,url:a,type:b,onfinish:d}).play();return!0};soundManager.stopAll();d();return!0};
PORTFOLIO.leseweb_init=function(a,b){if(!a)return!1;var c=$(a);$("<a/>",{href:"#","class":"flush_left play_button",html:function(){return $("<img/>",{src:PORTFOLIO.site_url+"get_icon/media/play","class":"icon",title:PORTFOLIO.gettext("Start speech synthesis")})}}).click(function(a){a.preventDefault();var b=$("#leseweb"),c=PORTFOLIO.get_text_selection();c||(c=$("#element_content").text());c=PORTFOLIO.strip_excess_whitespace(c);if(!c)return alert("Please specify some text to speak."),!1;a=PORTFOLIO.site_url+
"leseweb/mp3";b=b.serialize()+"&text="+encodeURIComponent(c);$.post(a,b,function(a){return PORTFOLIO.play_m3u_playlist(a,'audio/mpeg; codecs="mp3"')});return!1}).appendTo(c);$("<a/>",{href:"#","class":"flush_left stop_button",html:function(){return $("<img/>",{src:PORTFOLIO.site_url+"get_icon/media/stop","class":"icon",title:PORTFOLIO.gettext("Stop speech synthesis")})}}).click(function(a){a.preventDefault();"undefined"!==typeof soundManager&&soundManager.stopAll();return!1}).appendTo(c);var d='<form id="leseweb"><div><label>'+
PORTFOLIO.gettext("Language:")+'<br/><select name="language"><option value="" selected="selected">'+PORTFOLIO.gettext("Automatic language detection")+'</option><option value="en_GB">'+PORTFOLIO.gettext("English (Great Britain)")+'</option><option value="nb_NO">'+PORTFOLIO.gettext("Norwegian Bokmal")+'</option><option value="nn_NO">'+PORTFOLIO.gettext("Norwegian Nynorsk")+"</option></select></label><br/><label>"+PORTFOLIO.gettext("Voice:")+'<br/><select name="voice"><option value="female" selected="selected">'+
PORTFOLIO.gettext("Female")+'</option><option value="male">'+PORTFOLIO.gettext("Male")+"</option></select></label><br/><label>"+PORTFOLIO.gettext("Reading speed:")+'<br/><select name="rate"><option value="fast">'+PORTFOLIO.gettext("Fast")+'</option><option value="normal" selected="selected">'+PORTFOLIO.gettext("Normal")+'</option><option value="slow" >'+PORTFOLIO.gettext("Slow")+"</option></select></label><br/><label>"+PORTFOLIO.gettext("Bandwidth speed:")+'<br/><select name="bandwidth"><option value="high" selected="selected">'+
PORTFOLIO.gettext("High")+'</option><option value="medium">'+PORTFOLIO.gettext("Medium")+'</option><option value="low">'+PORTFOLIO.gettext("Low")+"</option></select></label><br/></div></form>",f=$("<div/>").html(d).dialog({autoOpen:!1,title:PORTFOLIO.gettext("Speech synthesis configuration"),width:300,height:225,modal:!0,resizable:!0,autoResize:!0,overlay:{opacity:0.5,background:"black"}});$("<a/>",{href:"#","class":"flush_left config_button",html:function(){return $("<img/>",{src:PORTFOLIO.site_url+
"get_icon/speech/config","class":"icon",title:PORTFOLIO.gettext("Speech synthesis configuration")})}}).click(function(a){a.preventDefault();f.dialog("open");return!1}).appendTo(c);if(b){var e=$("<div/>").dialog({autoOpen:!1,width:600,height:540,modal:!0,resizable:!0,autoResize:!0,overlay:{opacity:0.5,background:"black"}}),g=!1;$("<a/>",{href:"#","class":"flush_left help_button",html:function(){return $("<img/>",{src:PORTFOLIO.site_url+"get_icon/speech/help","class":"icon",title:PORTFOLIO.gettext("Speech synthesis help")})}}).click(function(a){a.preventDefault();
if(!g)return $.get(PORTFOLIO.site_url+"fragment/read/"+b,function(a){g=!0;e.html(a);var a=e.find("h2"),b=a.text();e.dialog("option","title",b);a.remove();e.dialog("open");return!0}),!1;e.dialog("open");return!1}).appendTo(c)}return!0};
PORTFOLIO.init_flowplayer=function(a){if(!$.fn.flowplayer)return!1;a=$("a.video.flowplayer",a);a.flowplayer(PORTFOLIO.static_url+"flowplayer/flowplayer-3.2.7.swf",{debug:!1,log:{level:"error"},plugins:{controls:{url:PORTFOLIO.static_url+"flowplayer/flowplayer.controls-3.2.5.swf"}},clip:{autoPlay:!0,scaling:"scale",fadeInSpeed:0,fadeOutSpeed:0}});a.each(function(){var a=$(this);if(!a.hasClass("autoplay"))return!0;a=a.flowplayer(0);if(!a)return!0;a.play();return!0});return!0};

