function setReloadTime(secs)
{if(arguments.length==1){if(reloadTimer)clearTimeout(reloadTimer);reloadTimer=setTimeout("setReloadTime()",Math.ceil(parseFloat(secs)*1000));}
else{window.location.replace(window.location.href);}}
function open_window(url,myname,wt,ht,settings)
{LeftPosition=(screen.width)?(screen.width-wt)/2:0;TopPosition=(screen.height)?(screen.height-ht)/2:0;new_settings='height='+ht+',width='+wt+',top='+TopPosition+',left='+LeftPosition+','+',z-lock=yes,'+settings;win=window.open(url,myname,new_settings);return win;}
function timer(){var now=new Date();var the_timer=new Date(now.getTime()-start_date.getTime()+now.getTimezoneOffset()*60000);var minutes=the_timer.getMinutes();var seconds=the_timer.getSeconds();if(minutes<=9)minutes="0"+minutes;if(seconds<=9)seconds="0"+seconds;document.getElementById("timer").innerHTML=minutes+":"+seconds;timeout=setTimeout("timer()",1000);}
function clear_text(obj,standard_text){if(standard_text==obj.value)
{obj.value="";}}
function MultiSelector(list_target,max){this.list_target=list_target;this.count=0;this.id=0;if(max){this.max=max;}else{this.max=-1;};this.addElement=function(element){if(element.tagName=='INPUT'&&element.type=='file'){element.name='file_'+this.id++;element.multi_selector=this;element.onchange=function(){var new_element=document.createElement('input');new_element.type='file';this.parentNode.insertBefore(new_element,this);this.multi_selector.addElement(new_element);this.multi_selector.addListRow(this);this.style.position='absolute';this.style.left='-1000px';};if(this.max!=-1&&this.count>=this.max){element.disabled=true;};this.count++;this.current_element=element;}else{alert('Error: not a file input element');};};this.addListRow=function(element){var new_row=document.createElement('div');var new_row_button=document.createElement('input');new_row_button.type='button';new_row_button.className='btnn';new_row_button.value='Slett';new_row.element=element;new_row_button.onclick=function(){this.parentNode.element.parentNode.removeChild(this.parentNode.element);this.parentNode.parentNode.removeChild(this.parentNode);this.parentNode.element.multi_selector.count--;this.parentNode.element.multi_selector.current_element.disabled=false;return false;};new_row.innerHTML=element.value;new_row.appendChild(new_row_button);this.list_target.appendChild(new_row);};};
