var db='misc/superdiver.nsf';
var returnField='';
function doRemoveDocument(str){if(str==''){alert('It is not possible to delete this document')}else{if(confirm('Are you sure that you want to delete this document?'))location.href='/'+db+'/($All)/'+str+'?DeleteDocument'}}
function doEditDocument(str){if(str==''){alert('It is not possible to edit this document')}else{location.href='/'+db+'/(edit)/'+str+'?EditDocument'}}
function doCreateCopy(str){if(str==''){alert('It is not possible to copy this document')}else{location.href='/'+db+'/CreateCopy?OpenAgent&ParentUNID='+str}}
function doSendNewsletter(str){if(str==''){alert('It is not possible to send this document as a newsletter')}else{window.open('http://82.183.160.90/'+db+'/ConfirmNewsletter?OpenForm&Login&ParentUNID='+str, 'Newsletter', 'scrollbar=0,width=380,height=300,left=200,top=200')}}
function startSearch(str){if(str!=''){location.href='/'+db+'/InfoPagesSearch?SearchView&SearchMax=9999&Count=20&Start=1&Query='+escape(str)}}
function ml(n,d){document.location.href='mailto:'+n+'@'+d}
function SelectAll(v){var o=document.view.elements;for(i=0;i<o.length;i++){if(o[i].type!=null){if(o[i].type=='checkbox')o[i].checked=v}}}
function RemoveDocs(){var o=document.view.elements;var v=false;for(i=0; i<o.length;i++){if(o[i].type!=null){if(o[i].type=='checkbox')v=v|o[i].checked}}if(v){if(confirm('Är du helt säker på detta?')) document.view.submit()}else{alert('Du har inte valt något dokument att ta bort')}}
function SaveCookie() {var f=document.forms[0];var Name=escape(f.Name.value);var MailAddress=escape(f.MailAddress.value);var Signature1=escape(f.Signature1.value);var Signature2=escape(f.Signature2.value);var the_date=new Date('December 31, 2023');var the_cookie_date=the_date.toGMTString();document.cookie='BKS_Gastbok='+Name + '&'+MailAddress+'&'+Signature1+'&'+Signature2+'; expires='+the_cookie_date;}
var pointer=0;var stop;var offset;var scrollWidth;
function SC(id,fromN,toN){id=document.getElementById(id);var old=id.className;id.className=(old==toN ? fromN : toN);}
function Dialog(url,action,init){}
function ReplaceAllTextareas() {var allTextAreas=document.getElementsByTagName('textarea');for (var i=0; i < allTextAreas.length; i++) {var className=allTextAreas[i].className;if(className !=''){CKEDITOR.replace(allTextAreas[i].name, { customConfig : '/'+db+'/ckmyconfig.js?Open' });}}}
function setImageField(f1,f2){if (f1){ if (f1.value !='') f2.value=f1.value;}}
function showRSS(queryString, count, container, title){
var rssStore=new dojox.data.GoogleFeedStore();
var rssDialog=new dijit.Dialog({id:"dojoRssPopUp", title: title});
rssStore.fetch({query:{url: queryString},count: 20,onComplete: function(items, request) {
var buffer=[''];
var bufferDialog=['<div style="width: 500px; height: 350px; overflow: auto;"><table class="t14" cellpadding="2" cellspacing="0">'];
var e=1;
var i=1;
dojo.forEach(items, function(item){
var title=rssStore.getValue(item, "title");
var content=rssStore.getValue(item, "content");
var date=new Date(rssStore.getValue(item, "published"));
var d1=date.toUTCString().split(" ")
var link=rssStore.getValue(item, "link");
if(i<=count){
buffer.push('<div class="t14BG' + (e+1) + '"><div class="date">' + d1[1]+' '+d1[2] + '</div><div class="title"><a href="' + link + '" target="rss">' + title + '</a></div></div>');
}
bufferDialog.push('<tr valign="top" class="t14BG' + (e+1) + '"><td style="width:5em;">' + d1[1]+' '+d1[2] + '</td><td class="rssImg"><h3><a href="' + link + '" target="rss">' + title + '</a></h3>' + content + '</td></tr>');
e=1-e;i++;});
container.innerHTML=buffer.join("");bufferDialog.push('</table></div>');rssDialog.attr("content", bufferDialog.join(""));
}})}
function showPopUp(href,title,width,height){popUpDialog=new dijit.Dialog({title: title,style: "width:"+(width==""?"auto":width)+";height:"+(height==""?"auto":height),href: href});popUpDialog.show()}
function getcss(cssfile){loadcss=document.createElement('link');loadcss.setAttribute("rel", "stylesheet");loadcss.setAttribute("type", "text/css");loadcss.setAttribute("href", cssfile);document.getElementsByTagName("head")[0].appendChild(loadcss)}
function pad(id,nr){
document.getElementById(id).style.left=nr;nr-=1;
if(nr < - offset) setText(id)
else{
if((nr<4)&&(stop==false)){stop=true;setTimeout("pad('"+id+"',"+nr+")",2000);}
else setTimeout("pad('"+id+"',"+nr+")",10);}}
function setText(id){
stop=false;
scrollWidth=document.getElementById('link').offsetWidth;
document.getElementById('scrolltext').innerHTML=newsarray[pointer];
offset=document.getElementById('scrolltext').offsetWidth;
pointer++;
if(pointer>=newsarray.length) pointer=0;
pad(id,scrollWidth);}
