// <script>
var EasyCMS_jsLibVersion = 150;
// To cover IE 5.0's lack of the push method
if(typeof Array.prototype.push != "function"){
Array.prototype.push = ArrayPush;
function ArrayPush(value){
this[this.length] = value;
}
}
// ---
/*
ELO - Encapsulated Load Object, by Robert Nyman, http://www.robertnyman.com
Inspired and influenced by Dean Edwards, Matthias Miller, and John Resig: http://dean.edwards.name/weblog/2006/06/again/
*/
var ELO = {
loaded : false,
timer : null,
functionsToCallOnload : [], // Type in functions as strings here. e.g. "myFunction()"
init : function (){
if(ELO.loaded) return;
ELO.loaded = true;
ELO.load();
},
load : function (){
if(this.timer){
clearInterval(this.timer);
}
for(var i=0; i<this.functionsToCallOnload.length; i++){
try{
eval(this.functionsToCallOnload[i]);
}
catch(e){
// Handle error here
}
}
}
};
// ---
/* Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
if(document.getElementById){
document.write("<script id=\"ieScriptLoad\" defer src=\"javascript:void(0)\"><\/script>");
document.getElementById("ieScriptLoad").onreadystatechange = function() {
if (this.readyState == "complete") {
ELO.init();
}
};
}
/*@end @*/
// ---
/* Mozilla/Opera 9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", ELO.init, false);
}
// ---
/* Safari */
if(navigator.userAgent.search(/WebKit/i) != -1){
ELO.timer = setInterval(function (){
if(document.readyState.search(/loaded|complete/i) != -1) {
ELO.init();
}
}, 10);
}
// ---
/* Other web browsers */
window.onload = ELO.init;
// ---
if(typeof Array.prototype.inArray != "function"){
Array.prototype.inArray = function (value) {
var i;
for (i=0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
}
}
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
EventCache.add(obj, type, fn);
}
else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
EventCache.add(obj, type, fn);
}
else {
obj["on"+type] = obj["e"+type+fn];
}
}
var EventCache = function(){
var listEvents = [];
return {
listEvents : listEvents,
add : function(node, sEventName, fHandler){
listEvents.push(arguments);
},
flush : function(){
var i, item;
for(i = listEvents.length - 1; i >= 0; i = i - 1){
item = listEvents[i];
if(item[0].removeEventListener){
item[0].removeEventListener(item[1], item[2], item[3]);
};
if(item[1].substring(0, 2) != "on"){
item[1] = "on" + item[1];
};
if(item[0].detachEvent){
item[0].detachEvent(item[1], item[2]);
};
item[0][item[1]] = null;
};
}
};
}();
addEvent(window,'unload',EventCache.flush);function $(o) {
if (typeof(o) == "string")
return document.getElementById(o)
else
return o;
};
function applyStyleString (obj,str) {
if(document.all && !window.opera) {
obj.style.setAttribute("cssText",str);
} else {
obj.setAttribute("style",str);
}
};
function hideLayer(whichLayer) {
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.display = "none";
} else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.display = "none";
} else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].display = "none";
}
};
function showLayer(whichLayer) {
//   alert(whichLayer);
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.display = "block";
} else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.display = "block";
} else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].display = "block";
}
};
function sw_add (id) {
thenumber = document.setting[id].value;
thenumber = thenumber*(-1);
thenumber = thenumber-1;
thenumber = thenumber*(-1);
document.setting[id].value = thenumber;
}
function sw_sub (id) {
thenumber = document.setting[id].value;
if(validateLOW(id,1)){
thenumber = thenumber-1;
document.setting[id].value = thenumber;
}
};
function chkData() {
if(document.sw.usr.value <= 0){
alert("Skriv inn ditt brukernavn");
document.sw.usr.value = '';
document.sw.usr.focus();
return false;
}
if(document.sw.pas.value <= 0){
alert("Skriv inn ditt passord");
document.sw.pas.value = '';
document.sw.pas.focus();
return false;
}
};
function chkUpload() {
box = document.form_upload.bildegruppe;
temp = box.options[box.selectedIndex].value;
if (temp) {
if(document.form_upload.bildegruppeny.value){
alert("Du kan ikke både velge bilde kategori å lage ny bilde kategori, velg en av dem.");
return false;
}
} else {
if(!document.form_upload.bildegruppeny.value)
document.form_upload.bildegruppeny.value = 'mine bilder'
}
if(document.form_upload.file1.value <= 0){
alert("Du må velge en bildefil før du kan fortsette.");
document.form_upload.file1.value = '';
//document.form_upload.file1.value.focus();
return false;
}
};
function chkFileUpload() {
box = document.myXUploadForm.filgruppe;
temp = box.options[box.selectedIndex].value;
if (temp) {
if(document.myXUploadForm.filgruppeny.value){
alert("Du kan ikke både velge fil kategori å lage ny fil kategori, velg en av dem.");
return false;
}
} else {
if(!document.myXUploadForm.filgruppeny.value)
document.myXUploadForm.filgruppeny.value = 'mine filer'
}
if(document.myXUploadForm.file1.value <= 0){
alert("Du må velge en fil før du kan fortsette.");
document.myXUploadForm.file1.value = '';
//document.myXUploadForm.file1.value.focus();
return false;
}
};
function validateig(){
if(validate(document.setting.pimgsize_mainX.value,'Auto resize max large (L) dimensjon'))
return false;
if(document.setting.pimgsize_mainX.value > 1280){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha stort bilde bredere en 1280px.\n\nVerdien stilles ned til 1280px.");
document.setting.pimgsize_mainX.focus();
document.setting.pimgsize_mainX.value = '1280';
return false;
}
if(validate(document.setting.pimgsize_mainY.value,'Auto resize max large (L) dimensjon'))
return false
if(document.setting.pimgsize_mainY.value > 1280){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha stort bilde høyere en 1280px.\n\nVerdien stilles ned til 1280px.");
document.setting.pimgsize_mainY.value = '1280';
document.setting.pimgsize_mainY.focus();
return false;
}
if(document.setting.pimgsize_mainX.value < 200){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha stort bilde mindre en 200px i bredden.\n\nVerdien stilles opp til 200px.");
document.setting.pimgsize_mainX.focus();
document.setting.pimgsize_mainX.value = '200';
return false;
}
if(document.setting.pimgsize_mainY.value < 200){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å stort bilde mindre en 200px i høyden.\n\nVerdien stilles opp til 200px.");
document.setting.pimgsize_mainY.value = '200';
document.setting.pimgsize_mainY.focus();
return false;
}
if(validate(document.setting.pimgsize_thumbX.value,'Auto-resize max medium (M) dimensjon'))
return false
if(document.setting.pimgsize_thumbX.value > 500){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha medium bildene bredere en 500px.\n\nVerdien stilles opp til 500px.");
document.setting.pimgsize_thumbX.focus();
document.setting.pimgsize_thumbX.value = '500';
return false;
}
if(validate(document.setting.pimgsize_thumbY.value,'Auto-resize max medium (M) dimensjon'))
return false
if(document.setting.pimgsize_thumbY.value > 500){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha medium bildene høyere en 500px.\n\nVerdien stilles opp til 500px.");
document.setting.pimgsize_thumbY.value = '500';
document.setting.pimgsize_thumbY.focus();
return false;
}
if(document.setting.pimgsize_thumbX.value < 75){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha medium bildene mindre en 75px i bredden.\n\nVerdien stilles opp til 75px.");
document.setting.pimgsize_thumbX.focus();
document.setting.pimgsize_thumbX.value = '75';
return false;
}
if(document.setting.pimgsize_thumbY.value < 75){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha medium bildene mindre en 75px i høyden.\n\nVerdien stilles opp til 75px.");
document.setting.pimgsize_thumbY.value = '75';
document.setting.pimgsize_thumbY.focus();
return false;
}
if(validate(document.setting.pimgsize_systemX.value,'Auto-resize max small (S) dimensjon'))
return false
if(document.setting.pimgsize_systemX.value > 100){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha de minste bildene bredere en 100px.\n\nVerdien stilles ned til 100px.");
document.setting.pimgsize_systemX.focus();
document.setting.pimgsize_systemX.value = '100';
return false;
}
if(validate(document.setting.pimgsize_systemY.value,'Auto-resize max small (S) dimensjon'))
return false
if(document.setting.pimgsize_systemY.value > 130){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha de minste bildene høyere en 130px.\n\nVerdien stilles ned til 130px.");
document.setting.pimgsize_systemY.value = '130';
document.setting.pimgsize_systemY.focus();
return false;
}
if(document.setting.pimgsize_systemX.value < 25){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha de minste bildene mindre en 25px i bredden.\n\nVerdien stilles opp til 25px.");
document.setting.pimgsize_systemX.focus();
document.setting.pimgsize_systemX.value = '25';
return false;
}
if(document.setting.pimgsize_systemY.value < 25){
alert("    --- BILDE OPPLASTNING ---\n\nDu får ikke lov å ha de minste bildene mindre en 25px i høyden.\n\nVerdien stilles opp til 25px.");
document.setting.pimgsize_systemY.value = '25';
document.setting.pimgsize_systemY.focus();
return false;
}
if(validate(document.setting.richsize_defaultX.value,'Standard bredde artikkel full'))
return false
if(document.setting.richsize_defaultX.value > 1024){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha arbeidsfeltet bredere en 1024px.\n\nFeltet stilles ned til 1024px.");
document.setting.richsize_defaultX.value = '1024';
document.setting.richsize_defaultX.focus();
return false;
}
if(document.setting.richsize_defaultX.value < 300){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha arbeidsfeltet smalere en 300px.\n\nFeltet stilles ned til 300px.");
document.setting.richsize_defaultX.value = '300';
document.setting.richsize_defaultX.focus();
return false;
}
if(validate(document.setting.richsize_defaultY.value,'Standard høyde artikkel full'))
return false
if(document.setting.richsize_defaultY.value > 750){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha artikkel full feltet høyere en 750px.\n\nFeltet stilles ned til 750px.");
document.setting.richsize_defaultY.value = '750';
document.setting.richsize_defaultY.focus();
return false;
}
if(document.setting.richsize_defaultY.value < 100){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha artikkel full feltet lavere en 100px.\n\nFeltet stilles ned til 100px.");
document.setting.richsize_defaultY.value = '100';
document.setting.richsize_defaultY.focus();
return false;
}
if(validate(document.setting.richsize_ingress.value,'Standard høyde ingress'))
return false
if(document.setting.richsize_ingress.value > 400){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha ingress feltet høyere en 400px.\n\nFeltet stilles ned til 400px.");
document.setting.richsize_ingress.value = '400';
document.setting.richsize_ingress.focus();
return false;
}
if(document.setting.richsize_ingress.value < 25){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha ingress feltet lavere en 25px.\n\nFeltet stilles ned til 25px.");
document.setting.richsize_ingress.value = '25';
document.setting.richsize_ingress.focus();
return false;
}
if(validate(document.setting.richsize_extraX.value,'Utvidet bredde artikkel full'))
return false
if(document.setting.richsize_extraX.value > 1024){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha det ekstra arbeidsfeltet bredere en 1024px.\n\nFeltet stilles ned til 1024px.");
document.setting.richsize_extraX.value = '1024';
document.setting.richsize_extraX.focus();
return false;
}
if(document.setting.richsize_extraX.value < 300){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha det ekstra arbeidsfeltet smalere en 300px.\n\nFeltet stilles ned til 300px.");
document.setting.richsize_extraX.value = '300';
document.setting.richsize_extraX.focus();
return false;
}
if(validate(document.setting.richsize_extraY.value,'Utvidet høyde artikkel full'))
return false
if(document.setting.richsize_extraY.value > 750){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha det ekstra artikkel full feltet høyere en 750px.\n\nFeltet stilles ned til 750px.");
document.setting.richsize_extraY.value = '750';
document.setting.richsize_extraY.focus();
return false;
}
if(document.setting.richsize_extraY.value < 100){
alert("    --- ARTIKKEL OG SIDE EDITOR ---\n\nDu får ikke lov å ha det ekstra artikkel full feltet lavere en 100px.\n\nFeltet stilles ned til 100px.");
document.setting.richsize_extraY.value = '100';
document.setting.richsize_extraY.focus();
return false;
}
};
function InstGenArt(mode){
if(mode){
document.setting.richsize_defaultX.value = '620';
document.setting.richsize_ingress.value  = '120';
document.setting.richsize_defaultY.value = '300';
document.setting.richsize_extraX.value   = '750';
document.setting.richsize_extraY.value   = '500';
} else {
document.setting.pimgsize_mainX.value    = '500';
document.setting.pimgsize_mainY.value    = '500';
document.setting.pimgsize_thumbX.value   = '200';
document.setting.pimgsize_thumbY.value   = '200';
document.setting.pimgsize_systemX.value  = '75';
document.setting.pimgsize_systemY.value  = '75';
}
};
function swPOP(url,Xvalue,Yvalue,scroll) {
var w = 480, h = 340;if (document.all || document.layers) { w = screen.availWidth;h = screen.availHeight; }
var popW = Xvalue, popH = Yvalue;var leftPos = (w-popW)/2, topPos = (h-popH)/2;
if (scroll) { i = open(url, "displayWindow","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=1,menubar=no,resize=no,dependent=yes,scrollbars=yes");} else { i = open(url, "displayWindow","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=1,toolbar=1,menubar=0,resize=no,dependent=yes,scrollbars=no");}
};
function zoom(header,alt,url,Xvalue,Yvalue,scroll) {
Xvalue = Number(Xvalue) + 20;
Yvalue = Number(Yvalue) + 60;
if (scroll) {
i = open("", "EUindow","top=50,left=50,width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=yes");
} else {
i = open("", "EUindow","top=50,left=50,width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=no");
}
i.focus();
i.document.open();
i.document.write('<html>\n')
i.document.write('<head>\n')
i.document.write('<title>EasyCMS bilde forhåndsvisning</title>\n')
i.document.write('<style><!--\n')
i.document.write('body { \n')
i.document.write('margin : 0px 0px 0px 0px;\n')
i.document.write('}\n')
i.document.write('--></style>\n')
i.document.write('<\head>\n')
i.document.write('<body bgcolor="#ffffff" text="#000000">\n')
i.document.write('<center>\n')
i.document.write('<div style="font-size:14px; font-weight:bold; font-family:verdana,arial,sans-serif,helvetica;">',header,'</div><a href="javascript:window.close();"><img src="',url,'" border="2" style="border:2px solid white;" alt="',alt,'"></a>\n')
i.document.write('<div style="font-size:10px;font-family:verdana;color:#808080;">&copy; Easy CMS (c) Steinhaug AS</div></center>\n')
i.document.write('</body>\n')
i.document.write('</html>\n');
i.document.close();
};
function validate(string,felt) {
var valid="1234567890";
for (var i=0; i<string.length; i++) {
if (valid.indexOf(string.charAt(i)) < 0) {
alert(felt+' inneholder ugyldige tegn!');
return true;
}
}
return false;
};
function _pullAndReplaceIt(theUrl,replacement){
var req = new XMLHttpRequest();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
document.getElementById(replacement).innerHTML = req.responseText;
}
};
req.open('GET', theUrl);
req.send(null);
}
};
/* -------------------------------------------------- */
/* Følgende funksjoner kan slettes, men legger inn en */
/* backfall i tilfelle man trenger dem er ibruk       */
/* -------------------------------------------------- */
function validateNR(theform,felt) {
alert('Easy Webshop function');
return false;
}
function validateNRd(theform,felt) {
alert('Easy Webshop function');
return false;
}
function validateLOW (id,range){
alert('Easy Webshop function');
return false;
}
function search(keyword, where){
alert('Easy Webshop function');
return false;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  XMLHttpRequestHeartBeat v1.0                                     *
*  Simple system for giving a steady heartbeat to the webserver     *
*  to avoid session timeout and loosing work on pages a user might  *
*  spend a long time working on                                     *
*                                                                   *
*  Revised : 19 August 2005                                         *
*  Author  : kim@steinhaug.com                                      *
*                                                                   *
*  Start :                                                          *
*  XMLHttpRequestHeartBeatInit([int seconds]);                      *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function XMLHttpRequestHeartBeat(replacement,heartbeatUrl) {
var currentTime = new Date();
var req = new XMLHttpRequest();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
// To debug remove and add <div id="heartbeat"></div> somewhere on the page
// document.getElementById(replacement).innerHTML = req.responseText;
};
};
req.open('GET', heartbeatUrl + '?' + currentTime.getDay() + currentTime.getHours() + currentTime.getMinutes() + currentTime.getSeconds());
req.send(null);
}
}
function XMLHttpRequestHeartBeatInit(seconds){
var heartbeatUrl = 'heartbeat.php';
seconds = seconds * 1000;
//sw_heartbeat_alert = setTimeout('alert("Serverpuls ble ikke aktivert, du må derfor lagre arbeidet innen 20 minutter for å unngå å bli logget ut automatisk.")',15000);
sw_heartbeat_alert = setTimeout('alert("SERVERPULS BLE IKKE AKTIVERT\\n\\nDet har nå gått 15 minutter og du vil snart (typisk om ca. 5-10 minutter) automatisk bli logget ut av serveren,\\nvi anbefaler deg lagre arbeidet ditt så langt å så velge å redigere siden på nytt.\\nDa har du en ny periode innen du automatisk blir logget ut.\\n\\nVi gjør også oppmerksom på at denne feilmeldingen dukker opp ettersom serverPuls ikke ble aktivert,\\nnoe som tyder på en feil med din installasjon av Easy CMS.\\n\\nTa kontakt med support for å løse dette problemet, så slipper du også denne meldingen.")',900000);
var currentTime = new Date();
var req = new XMLHttpRequest();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
if(req.responseText=='ready'){
clearTimeout(sw_heartbeat_alert);
sw_heartbeat = setInterval('XMLHttpRequestHeartBeat("heartbeat","' + heartbeatUrl + '")',seconds);
};
};
};
req.open('GET', heartbeatUrl + '?status=initialize&' + currentTime.getDay() + currentTime.getHours() + currentTime.getMinutes() + currentTime.getSeconds());
req.send(null);
}
}
/* TAGG : content_cms.php */
function UpdateGroupAssignments(){
if (document.CMS.boxchecked.value == 0){
alert('Vennligst velg hvilke elementer du vil endre gruppetilhørighet på');
} else {
document.CMS.action.value = "UpdateGroupAssignments";
document.CMS.unit.value = $('groupid').value;
document.CMS.submit();
}
}
function UpdateGroupAssignments_intranet(){
if (document.CMS.boxchecked.value == 0){
alert('Vennligst velg hvilke elementer du vil endre intranett gruppetilhørighet på');
} else {
document.CMS.action.value = "UpdateGroupAssignments_intranet";
document.CMS.unit.value = $('groupid_intranet').value;
document.CMS.submit();
}
}
function publishItems(){
if (document.CMS.boxchecked.value == 0){
alert('Vennligst velg hvilke elementer du vil publisere');
} else {
document.CMS.action.value="publish";
document.CMS.submit();
}
}
function unpublishItems(){
if (document.CMS.boxchecked.value == 0){
alert('Vennligst velg hvilke elementer du vil deaktivere');
} else {
document.CMS.action.value="unpublish";
document.CMS.submit();
}
}
function publishItem(unit){
document.CMS.action.value="publish_single";
document.CMS.unit.value=unit;
document.CMS.submit();
}
function unpublishItem(unit){
document.CMS.action.value="unpublish_single";
document.CMS.unit.value=unit;
document.CMS.submit();
}
function deleteItems(){
if (document.CMS.boxchecked.value == 0){
alert('Vennligst velg hva du vil slette');
} else if (confirm('Er du sikker på at du vil slette de valgte elementene? ')){
document.CMS.action.value="delete";
document.CMS.submit();
}
}
function ElementalChaos(ShaZaM,KabloM){
if (document.getElementById) {
document.getElementById(ShaZaM).src = 'images/' + KabloM;
}
}
function isChecked(isitchecked){
if (isitchecked == true){
document.CMS.boxchecked.value++;
} else {
document.CMS.boxchecked.value--;
}
}
function moveUp(unit){
document.CMS.action.value="reorder";
document.CMS.direction.value="up";
document.CMS.unit.value=unit;
document.CMS.submit();
}
function moveDown(unit){
document.CMS.action.value="reorder";
document.CMS.direction.value="down";
document.CMS.unit.value=unit;
document.CMS.submit();
}
function moveUpSub(unit,category){
document.CMS.action.value="reorder";
document.CMS.direction.value="up";
document.CMS.category.value=category;
document.CMS.unit.value=unit;
document.CMS.submit();
}
function moveDownSub(unit,category){
document.CMS.action.value="reorder";
document.CMS.direction.value="down";
document.CMS.category.value=category;
document.CMS.unit.value=unit;
document.CMS.submit();
}
function moveUpSubSub(me,daddy,grandaddy){
document.CMS.action.value="reorder";
document.CMS.direction.value="up";
document.CMS.subcategory.value=daddy;
document.CMS.category.value=grandaddy;
document.CMS.unit.value=me;
document.CMS.submit();
}
function moveDownSubSub(me,daddy,grandaddy){
document.CMS.action.value="reorder";
document.CMS.direction.value="down";
document.CMS.subcategory.value=daddy;
document.CMS.category.value=grandaddy;
document.CMS.unit.value=me;
document.CMS.submit();
}
/* Autoresize textarea while typing */
function autoResize(el, lines){
var row = (el.value + "a").split(/\n/).length;
applyStyleString(el,'height: ' + (15 * ((row < lines) ? lines : row + 1)) + 'px');
}
function checkAll(n) {
var f = document.CMS;
var c = f.toggle.checked;
var n2 = 0;
for (i=0; i < n; i++) {
cb = eval( 'f.cb' + i );
if (cb) {
cb.checked = c;
n2++;
}
}
if (c) {
document.CMS.boxchecked.value = n2;
} else {
document.CMS.boxchecked.value = 0;
}
}
function confirm_cms_convert(cid,ctype){
if(ctype==1){
if(confirm('Er du sikker på du vil konvertere siden?' + "\n" + 'Vær oppmerksom at denne konverteringen sletter siden, du kan ikke få siden tilbake!')){
window.location.href = 'content_cms.php?convert=' + cid + '&type=' + ctype;
}
} else {
if(confirm('Er du sikker på du vil konvertere siden')){
window.location.href = 'content_cms.php?convert=' + cid + '&type=' + ctype;
}
}
}
var cookieNames = new Array();
function Get_Cookie(name) {
var start = document.cookie.indexOf(name+"=");
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
if (start == -1) return null;
var end = document.cookie.indexOf(";",len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name,value,expires,path,domain,secure) {
expires = expires * 60*60*24*1000;
var today = new Date();
var expires_date = new Date( today.getTime() + (expires) );
var cookieString = name + "=" +escape(value) +
( (expires) ? ";expires=" + expires_date.toGMTString() : "") +
( (path) ? ";path=" + path : "") +
( (domain) ? ";domain=" + domain : "") +
( (secure) ? ";secure" : "");
document.cookie = cookieString;
}
function init_size(id){
cookieValue = Get_Cookie(id);
el = document.getElementById(id);
if(parseInt(cookieValue)){
el.height = parseInt(cookieValue);
}
}
function size_it(id,direction){
var step = 50;
el = document.getElementById(id);
var currentY = parseInt(el.style.height);
if(direction=='down'){
if(currentY>75){
el.style.height = (parseInt(currentY) - parseInt(step)) + "px";
} else {
el.style.height = 50;
}
} else {
el.style.height = (parseInt(currentY) + parseInt(step)) + "px";
}
Set_Cookie(id,el.style.height,100000);
}
function confirmDelete(title,uri){
if (confirm('Er du sikker på at du vil slette ' + title + '?')){
location.href=uri;
}
}
/* TAGG : content_cms.php */
/* Quick IE version */
function CheckTabIE(el){
// Run only in IE
// and if tab key is pressed
// and if the control key is pressed
//  if ((document.all) && (9==event.keyCode) && (event.ctrlKey)) {
if ((document.all) && (9==event.keyCode)) {
// Cache the selection
el.selection=document.selection.createRange();
setTimeout("ProcessTabIE('" + el.id + "')",0);
}
}
function ProcessTabIE(id){
// Insert tab character in place of cached selection
document.all[id].selection.text=String.fromCharCode(9);
// Set the focus
document.all[id].focus();
}
/* Other version */
// Set desired tab- defaults to four space softtab
var tab = "    ";
function checkTab(evt) {
var t = evt.target;
var ss = t.selectionStart;
var se = t.selectionEnd;
// Tab key - insert tab expansion
if (evt.keyCode == 9) {
evt.preventDefault();
// Special case of multi line selection
if (ss != se && t.value.slice(ss,se).indexOf("\n") != -1) {
// In case selection was not of entire lines (e.g. selection begins in the middle of a line)
// we ought to tab at the beginning as well as at the start of every following line.
var pre = t.value.slice(0,ss);
var sel = t.value.slice(ss,se).replace(/\n/g,"\n"+tab);
var post = t.value.slice(se,t.value.length);
t.value = pre.concat(tab).concat(sel).concat(post);
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
// "Normal" case (no selection or selection on one line only)
else {
t.value = t.value.slice(0,ss).concat(tab).concat(t.value.slice(ss,t.value.length));
if (ss == se) {
t.selectionStart = t.selectionEnd = ss + tab.length;
}
else {
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
}
}
// Backspace key - delete preceding tab expansion, if exists
else if (evt.keyCode==8 && t.value.slice(ss - 4,ss) == tab) {
evt.preventDefault();
t.value = t.value.slice(0,ss - 4).concat(t.value.slice(ss,t.value.length));
t.selectionStart = t.selectionEnd = ss - tab.length;
}
// Delete key - delete following tab expansion, if exists
else if (evt.keyCode==46 && t.value.slice(se,se + 4) == tab) {
evt.preventDefault();
t.value = t.value.slice(0,ss).concat(t.value.slice(ss + 4,t.value.length));
t.selectionStart = t.selectionEnd = ss;
}
// Left/right arrow keys - move across the tab in one go
else if (evt.keyCode == 37 && t.value.slice(ss - 4,ss) == tab) {
evt.preventDefault();
t.selectionStart = t.selectionEnd = ss - 4;
}
else if (evt.keyCode == 39 && t.value.slice(ss,ss + 4) == tab) {
evt.preventDefault();
t.selectionStart = t.selectionEnd = ss + 4;
}
}
// Constructor
function MCContextMenu() {
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isOpera = navigator.userAgent.indexOf("Opera") != -1;
this.doc = document;
this.win = window;
this.items = new Array();
this.settings = new Array();
this.menuDiv = null;
this.menuGenerated = false;
this.counter = 0;
this.oldItems = null;
this.temp_x  = 0;
this.temp_y  = 0;
this.temp_dx = 0;
this.temp_dy = 0;
}
// Methods
MCContextMenu.prototype = {
init : function(settings) {
this.settings = typeof(settings) == "undefined" ? new Array() : settings;
this.defParam("contain_within_body", true);
this.defParam("handle_iframe_events", true);
this.defParam("add_before_attrib", "contextmenuaddbefore");
this.defParam("add_after_attrib", "contextmenuaddafter");
this.defParam("contextmenu_attrib", "contextmenu");
this.defParam("ajax_attrib", "acm");
this.defParam("replace_browser_menu", true);
//		this.addEvent(window, "load", MCContextMenu.prototype.onLoad);
ELO.functionsToCallOnload.push("MCContextMenu.prototype.onLoad()");
},
onLoad : function() {
mcContextMenu.registerEventListeners(document);
if (mcContextMenu.getParam('handle_iframe_events')) {
for (var i=0; i<window.frames.length; i++) {
try {
var doc = window.frames[i].document;
doc.body.mcContextMenuBodyID = "mc" + mcContextMenu.counter++;
mcContextMenu.registerEventListeners(doc);
} catch (ex) {
// May throw security exception
}
}
}
},
registerEventListeners : function(doc) {
this.addEvent(doc, "contextmenu", mcContextMenu.showEvent);
this.addEvent(doc, "click", mcContextMenu.hideEvent);
this.addEvent(doc, "keypress", mcContextMenu.hideEvent);
},
showEvent : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var elm = e.srcElement ? e.srcElement : e.target;
var body = mcContextMenu.getBody(elm);
var lnk = mcContextMenu.getParentElement(elm, 'A');
if(!lnk){
var lnk = mcContextMenu.getParentElement(elm, 'IMG');
}
var x, y, dx = 0, dy = 0;
var modified = false;
// Restore default menu
if (mcContextMenu.oldItems) {
mcContextMenu.menuGenerated = false;
mcContextMenu.items = mcContextMenu.cloneArray(mcContextMenu.oldItems);
mcContextMenu.oldItems = null;
}
if (lnk) {
var before = lnk.getAttribute(mcContextMenu.getParam('add_before_attrib'));
var after = lnk.getAttribute(mcContextMenu.getParam('add_after_attrib'));
var replace = lnk.getAttribute(mcContextMenu.getParam('contextmenu_attrib'));
var acm = lnk.getAttribute(mcContextMenu.getParam('ajax_attrib'));  // Pick the new system
if (acm && acm != "") {                                             // If we infact have any data
mcContextMenu.showEventAjaxMode(e);                               // we cancel this and execute the
return true;                                                      // new Ajax-system.
}
mcContextMenu.oldItems = mcContextMenu.cloneArray(mcContextMenu.items);
if (after && after != "") {
var ar = mcContextMenu.explode(';', mcContextMenu.escapeCM(after));
for (var i=0; i<ar.length; i++)
mcContextMenu.addItem(ar[i]);
modified = true;
}
if (before && before != "") {
var ar = mcContextMenu.explode(';', mcContextMenu.escapeCM(before));
for (var i=ar.length-1; i>=0; i--)
mcContextMenu.addItemAtBeginning(ar[i]);
modified = true;
}
if (replace && replace != "") {
mcContextMenu.clear();
var ar = mcContextMenu.explode(';', mcContextMenu.escapeCM(replace));
for (var i=0; i<ar.length; i++)
mcContextMenu.addItem(ar[i]);
modified = true;
}
}
if (!mcContextMenu.getParam("replace_browser_menu") && !modified) {
mcContextMenu.hide();
return true;
}
if (mcContextMenu.isMSIE) {
dx = body.scrollLeft;
dy = body.scrollTop;
}
if (body.mcContextMenuBodyID) {
var iframe = mcContextMenu.getIFrameElement(body.mcContextMenuBodyID);
var pos = mcContextMenu.getAbsPosition(iframe);
dx = pos.absLeft;
dy = pos.absTop;
if (!mcContextMenu.isMSIE) {
dx -= body.scrollLeft;
dy -= body.scrollTop;
}
}
if (mcContextMenu.isMSIE) {
x = e.clientX;
y = e.clientY;
} else {
x = e.pageX;
y = e.pageY;
}
x += dx;
y += dy;
// Range check
x = x < 0 ? 0 : x;
y = y < 0 ? 0 : y;
// Show menu
if (mcContextMenu.getParam("replace_browser_menu") || mcContextMenu.items.length > 0) {
mcContextMenu.show(x, y);
mcContextMenu.cancelEvent(e);
return false;
} else
mcContextMenu.hide();
return true;
},
showEventAjaxMode : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var elm = e.srcElement ? e.srcElement : e.target;
var body = mcContextMenu.getBody(elm);
var lnk = mcContextMenu.getParentElement(elm, 'A');
if(!lnk){
var lnk = mcContextMenu.getParentElement(elm, 'IMG');
}
var x, y, dx = 0, dy = 0;
var modified = false;
// Restore default menu
if (mcContextMenu.oldItems) {
mcContextMenu.menuGenerated = false;
mcContextMenu.items = mcContextMenu.cloneArray(mcContextMenu.oldItems);
mcContextMenu.oldItems = null;
}
if (lnk) {
var acm = lnk.getAttribute(mcContextMenu.getParam('ajax_attrib'));              // Pick the new system
mcContextMenu.oldItems = mcContextMenu.cloneArray(mcContextMenu.items);
if (acm && acm != "") {
mcContextMenu.clear();
var ar = mcContextMenu.escapeCM(acm);
var req = new XMLHttpRequest();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
if (req.status && req.status != "" && req.status != 'no data!') {
mcContextMenu.showEventAjaxModeShow(e,req.responseText);
}
}
}
var currentTime = new Date();
if (ar && ar != "") {
var modified = true;
mcContextMenu.cancelEvent(e);  // Cancel the real context menu
}
if (!mcContextMenu.getParam("replace_browser_menu") && !modified) {
mcContextMenu.hide();
return true;
}
if (mcContextMenu.isMSIE) {
dx = body.scrollLeft;
dy = body.scrollTop;
}
if (body.mcContextMenuBodyID) {
var iframe = mcContextMenu.getIFrameElement(body.mcContextMenuBodyID);
var pos = mcContextMenu.getAbsPosition(iframe);
dx = pos.absLeft;
dy = pos.absTop;
if (!mcContextMenu.isMSIE) {
dx -= body.scrollLeft;
dy -= body.scrollTop;
}
}
if (mcContextMenu.isMSIE) {
x = e.clientX;
y = e.clientY;
} else {
x = e.pageX;
y = e.pageY;
}
x += dx;
y += dy;
// Range check
x = x < 0 ? 0 : x;
y = y < 0 ? 0 : y;
mcContextMenu.ajax_x  = x;  // Store data
mcContextMenu.ajax_y  = y;  // Store data
mcContextMenu.ajax_dx = dx; // Store data
mcContextMenu.ajax_dy = dy; // Store data
req.open('GET', 'func.context-menu.php?data=' + ar + '&' + currentTime.getDay() + currentTime.getHours() + currentTime.getMinutes() + currentTime.getSeconds());
req.send(null);
} else {
// Error, output dummy menu
// Trigger contextmenu without nothing
}
}
} // if lnk end
},
showEventAjaxModeShow : function(e,val) {
// Debug
//document.forms.test.trigger.value = val;
e = typeof(e) == "undefined" ? window.event : e;
var elm = e.srcElement ? e.srcElement : e.target;
var body = mcContextMenu.getBody(elm);
var x = mcContextMenu.ajax_x;
var y = mcContextMenu.ajax_y;
var dx = mcContextMenu.ajax_dx;
var dy = mcContextMenu.ajax_dy;
var modified = true;
var ar = mcContextMenu.explode(';', mcContextMenu.escapeCM(val));
for (var i=0; i<ar.length; i++)
mcContextMenu.addItem(ar[i]);
// Show menu
if (mcContextMenu.getParam("replace_browser_menu") || mcContextMenu.items.length > 0) {
mcContextMenu.show(x, y);
return false;
} else
mcContextMenu.hide();
return true;
},
hideEvent : function(e) {
mcContextMenu.hide();
return true;
},
show : function(x, y) {
// Latest Dustin Diaz Sweet Tiles
var sweetTitles = document.getElementById('toolTip');
if ( sweetTitles ) {
sweetTitles.style.visibility = 'hidden';
}
// Create menu div
if (this.menuDiv == null) {
// Add iframe
if (this.isMSIE) {
this.iframe = this.doc.createElement("iframe");
this.iframe.src = "javascript:void(0);";
this.iframe.className = "mcContextMenuIFrame";
this.iframe.frameBorder = "0";
this.iframe.style.display = "none";
this.doc.body.appendChild(this.iframe);
}
this.menuDiv = this.doc.createElement("div");
this.menuDiv.className = "mcContextMenuContainer";
this.doc.body.appendChild(this.menuDiv);
}
// Fill menu with items
if (!this.menuGenerated) {
var html = "";
var anyIcons = false;
// Sprite is counted as Icon aswell
for (var i=0; i<this.items.length; i++) {
if (this.items[i].icon)
anyIcons = true;
if (this.items[i].sprite)
anyIcons = true;
}
html += '<div class="mcContextMenuInnerContainer">';
html += '<table border="0" cellpadding="0" cellspacing="0" class="mcContextMenu ' + (anyIcons ? '' : 'NoImagePadding') + '">';
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
var cls = "";
cls += " " + (item.class_name ? item.class_name : "");
cls += " " + (item.disabled ? "mcContextMenuItemDisabled" : "");
html += '<tr';
if (item.title == '--') {
html += '><td class="mcContextMenuSeparator" nowrap="nowrap"' + (anyIcons ? 'colspan="2"' : '') + ' align="center"><div></div></td>';
if(item.header){
html += '</tr>';
html += '<tr><td colspan="2" class="mcContextMenu-header">' + item.header + '</td>';
}
} else {
html += ' onmouseover="mcContextMenu.addCSSClass(this,\'mcContextMenuItemOver\');"';
html += ' onmouseout="mcContextMenu.removeCSSClass(this,\'mcContextMenuItemOver\');">';
if (anyIcons) {
html += '<td class="mcContextMenuItem' + cls + '" nowrap="nowrap"';
/* Added Kim */
if (item.url && !item.disabled)
html += ' onmouseup="document.location=\'' + this.jsEncode(item.url) + '\';"';
// Fires extra event in IE and indeed launches the URL twice which is bad
//						if (item.url && !item.disabled)
//							html += ' onmouseup="document.location=\'' + this.jsEncode(item.url) + '\';"';
html += '>';
if (item.sprite)
html += '<div class="cmCSS cm' + item.sprite + '"></div>';
else if (item.icon)
html += '<img src="' + item.icon + '" width="16" height="16" class="mcContextMenuImage" />';
else
html += '&nbsp;';
html += '</td>';
}
if (item.disabled){
html += '<td class="mcContextMenuItem' + cls + '" nowrap="nowrap"';
html += ' onmouseover="mcContextMenu.addCSSClass(this,\'mcContextMenuItemOverDisabled\');"';
html += ' onmouseout="mcContextMenu.removeCSSClass(this,\'mcContextMenuItemOverDisabled\');"';
} else {
/*
html += '<td class="mcContextMenuItem' + cls + '" nowrap="nowrap"';
html += ' onmouseover="mcContextMenu.addCSSClass(this,\'mcContextMenuItemOver\');"';
html += ' onmouseout="mcContextMenu.removeCSSClass(this,\'mcContextMenuItemOver\');"';
*/
html += '<td ';
}
// Fires extra event in IE and indeed launches the URL twice which is bad
if (item.url && !item.disabled)
html += ' onmouseup="document.location=\'' + this.jsEncode(item.url) + '\';"';
html += '>';
if (item.disabled)
html += '<span class="mcContextMenuItemText">' + this.xmlEncode(item.title) + '<span>' + this.xmlEncode(item.title) + '</span></span>';
else
html += '<span class="mcContextMenuItemText">' + this.xmlEncode(item.title) + '</span>';
//						html += '<a class="mcContextMenuItemText" href="' + this.xmlEncode(item.url) + '" onclick="return false;" onmousedown="return false;">' + this.xmlEncode(item.title) + '</a>';
html += '</td>';
}
html += '</tr>';
}
html += "</table>";
html += "</div>";
this.menuDiv.innerHTML = html;
// Debug
// document.forms.test.html.value = html;
this.menuGenerated = true;
}
// Measure it
this.menuDiv.style.left = "-1000px";
this.menuDiv.style.top = "-1000px";
this.menuDiv.style.display = 'block';
width = this.menuDiv.offsetWidth;
height = this.menuDiv.offsetHeight;
// Get max x, y
if (this.getParam("contain_within_body")) {
var x2 = this.doc.body.scrollLeft + this.doc.body.clientWidth;
var y2 = this.doc.body.scrollTop + this.doc.body.clientHeight;
// Move it inside view port
x = x + width > x2 ? x2 - width : x;
y = y + height > y2 ? y2 - height : y;
}
// Range check
x = x < 0 ? 0 : x;
y = y < 0 ? 0 : y;
// Make it visible
this.menuDiv.style.left = x + "px";
this.menuDiv.style.top = y + "px";
if (this.isMSIE) {
this.iframe.style.left = x + "px";
this.iframe.style.top = y + "px";
this.iframe.style.width = width + "px";
this.iframe.style.height = height + "px";
this.iframe.style.display = "block";
}
},
hide : function() {
if (this.menuDiv != null)
this.menuDiv.style.display = 'none';
if (this.iframe != null)
this.iframe.style.display = 'none';
},
clear : function() {
this.items = new Array();
this.menuGenerated = false;
},
addItemAtBeginning : function(s) {
this.addItem(s, true);
},
addItem : function(s, infront) {
if (infront)
this.items.unshift(this.parseItem(s));
else
this.items[this.items.length] = this.parseItem(s);
this.menuGenerated = false;
},
addSeparator : function() {
this.addItem('--:--');
this.menuGenerated = false;
},
getParam : function(name, default_value, type) {
var value = typeof(this.settings[name]) == "undefined" ? default_value : this.settings[name];
var type = typeof(type) == "undefined" ? "string" : type;
if (value == "true" || value == "false")
return value == "true";
return value;
},
defParam : function(k, v) {
this.settings[k] = this.getParam(k, v);
},
addEvent : function(obj, name, handler) {
if (typeof(obj.attachEvent) != "undefined")
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, false);
},
cancelEvent : function(e) {
if (typeof(e.preventDefault) != "undefined") {
e.preventDefault();
return;
}
e.returnValue = false;
e.cancelBubble = true;
},
getAbsPosition : function(node) {
var p = {absLeft : 0, absTop : 0};
var pn = node;
while (pn) {
p.absLeft += pn.offsetLeft;
p.absTop += pn.offsetTop;
pn = pn.offsetParent;
}
return p;
},
trim : function(s) {
return s.replace(/^\s*|\s*$/g, "");
},
xmlEncode : function(s) {
s = s.replace(/&/g, '&amp;');
s = s.replace(/\"/g, '&quot;');
s = s.replace(/</g, '&lt;');
s = s.replace(/>/g, '&gr;');
return s;
},
jsEncode : function(s) {
s = s.replace(new RegExp('"', 'g'), '\\"');
s = s.replace(new RegExp("'", 'g'), "\\'");
return s;
},
getBody : function(e) {
if (e == null)
return null;
if (e.nodeName == "HTML")
return e.getElementsByTagName("BODY")[0];
return this.getParentElement(e, "BODY");
},
getParentElement : function(e, name) {
var p = e;
do {
if (p.nodeName == name)
return p;
} while (p = p.parentNode);
return null;
},
getIFrameElement : function(id) {
var n = document.getElementsByTagName("iframe");
for (var i=0; i<n.length; i++) {
if (n[i].contentWindow.document.body.mcContextMenuBodyID == id)
return n[i];
}
return null;
},
addCSSClass : function(elm, cls) {
this.removeCSSClass(elm, cls);
var ar = this.explode(' ', elm.className);
ar[ar.length] = cls;
elm.className = ar.join(' ');
},
removeCSSClass : function(elm, cls) {
var ar = this.explode(' ', elm.className);
for (var i=0; i<ar.length; i++) {
if (ar[i] == cls)
ar[i] = '';
}
elm.className = ar.join(' ');
},
validateSpacer : function(s) {
/* Added by Kim Steinhaug
Extends the devider    */
if(s.search(new RegExp("^--:","gi"))>=0)
return true;
else if(s == '--'){
return true;
} else {
return false;
}
},
parseItem : function(s) {
s = this.escapeCM(s);
if (!this.validateSpacer(this.trim(s))) {
var ar = new RegExp('^\\s*?(.*?)\\s*?:', 'gi').exec(s);  // Corrected after email from Johan
// var ar = new RegExp('^\s*?(.*?)\s*?:', 'gi').exec(s); // Gives error
var title = ar != null && ar.length == 2 ? ar[1] : "";
} else {
title = '--';
}
var otitle = this.parseOption(s, 'title');
return {
title : otitle == "" ? title : otitle,
url : this.parseOption(s, 'url'),
header : this.parseOption(s, 'header'), // New one!
icon : this.parseOption(s, 'icon'),
sprite : this.parseOption(s, 'sprite'),
class_name : this.parseOption(s, 'class'),
disabled : s.indexOf('disabled') != -1
};
},
parseOption : function(s, n) {
var ar = new RegExp(n + '\\(\'(.*?)\'\\)', 'gi').exec(s);
return ar != null && ar.length == 2 ? this.unescapeCM(ar[1]) : '';
},
escapeCM : function(s) {
s = s.replace(new RegExp("''", 'gi'), '<<dquot>>');
s = s.replace(new RegExp(";;", 'gi'), '<<scolon>>');
return s;
},
unescapeCM : function(s) {
s = s.replace(/<<dquot>>/gi, "'");
s = s.replace(/<<scolon>>/gi, ";");
return s;
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
cleanArray : function(ar) {
for (var k in ar)
ar[k] = null;
},
cloneArray : function(ar) {
var oar = new Array();
this.cleanArray(oar);
for (var k in ar)
oar[k] = ar[k];
for (var i=0; i<ar.length; i++)
oar[i] = ar[i];
return oar;
}
};
// Setup context menu
mcContextMenu = new MCContextMenu();
mcContextMenu.init({
replace_browser_menu : false
});
// Setup default menu
mcContextMenu.addItem("Switch menu:url('http://www.somesite.com');");
mcContextMenu.addSeparator();
mcContextMenu.addItem("Cut:url('javascript:alert(''Cut'');') icon('images/cut.gif')");
mcContextMenu.addItem("Copy:url('http://www.somesite.com') icon('images/copy.gif");
mcContextMenu.addItem("Paste:url('http://www.somesite.com') icon('images/paste.gif') disabled");
/*
Sweet Titles (c) Creative Commons 2005
http://creativecommons.org/licenses/by-sa/2.5/
Author: Dustin Diaz | http://www.dustindiaz.com
*/
var sweetTitles = {
xCord : 0,								// @Number: x pixel value of current cursor position
yCord : 0,								// @Number: y pixel value of current cursor position
tipElements : ['a'],                    // @Array: Allowable elements that can have the toolTip, default : 'a','abbr','acronym'
obj : Object,							// @Element: That of which you're hovering over
tip : Object,							// @Element: The actual toolTip itself
active : 0,								// @Number: 0: Not Active || 1: Active
fadespeed : 40,                         // default : 10, amount of opacity increase
init : function() {
if ( !document.getElementById ||
!document.createElement ||
!document.getElementsByTagName ) {
return;
}
var i,j;
this.tip = document.createElement('div');
this.tip.id = 'toolTip';
document.getElementsByTagName('body')[0].appendChild(this.tip);
this.tip.style.top = '0';
this.tip.style.visibility = 'hidden';
var tipLen = this.tipElements.length;
for ( i=0; i<tipLen; i++ ) {
var current = document.getElementsByTagName(this.tipElements[i]);
var curLen = current.length;
for ( j=0; j<curLen; j++ ) {
// Only attach tooltips on A with IMG inside
if(current[j].firstChild != null){
var img = current[j].firstChild;
if(img.nodeName=='IMG'){
if(img.alt){
addEvent(current[j],'mouseover',this.tipOver);
addEvent(current[j],'mouseout',this.tipOut);
//                    current[j].setAttribute('tip',current[j].title);
//                    current[j].removeAttribute('title');
current[j].setAttribute('tip',img.alt);
img.removeAttribute('alt');
current[j].removeAttribute('title');
}
}
}
}
}
},
updateXY : function(e) {
if ( document.captureEvents ) {
sweetTitles.xCord = e.pageX;
sweetTitles.yCord = e.pageY;
} else if ( window.event.clientX ) {
xoffset = -20;
yoffset = 0;
sweetTitles.xCord = window.event.clientX+document.documentElement.scrollLeft + xoffset;
sweetTitles.yCord = window.event.clientY+document.documentElement.scrollTop + yoffset;
}
},
tipOut: function() {
if ( window.tID ) {
clearTimeout(tID);
}
if ( window.opacityID ) {
clearTimeout(opacityID);
}
sweetTitles.tip.style.visibility = 'hidden';
},
checkNode : function() {
var trueObj = this.obj;
if ( this.tipElements.inArray(trueObj.nodeName.toLowerCase()) ) {
return trueObj;
} else {
return trueObj.parentNode;
}
},
tipOver : function(e) {
sweetTitles.obj = this;
tID = window.setTimeout("sweetTitles.tipShow()",500);
sweetTitles.updateXY(e);
},
tipShow : function() {
var scrX = Number(this.xCord);
var scrY = Number(this.yCord);
var tp = parseInt(scrY+15);
var lt = parseInt(scrX+10);
var anch = this.checkNode();
//		var addy = '';
//		var access = '';
//		if ( anch.nodeName.toLowerCase() == 'a' ) {
//			addy = (anch.href.length > 25 ? anch.href.toString().substring(0,25)+"..." : anch.href);
//			var access = ( anch.accessKey ? ' <span>['+anch.accessKey+']</span> ' : '' );
//		} else {
//			addy = anch.firstChild.nodeValue;
//		}
//		this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"<em>"+access+addy+"</em></p>";
// Trimm down http://mysite.no/this to /this
//if ( anch.nodeName.toLowerCase() == 'a' ) {
//	var host = location.hostname.toString();
//	var pattern = new RegExp("(http://?)"+host,"gi");
//	var fullPath = anch.href.toString();
//	var path = fullPath.replace(pattern,'');
//	addy = (path.length > 25 ? path.toString().substring(0,25)+"..." : path);
//	var access = ( anch.accessKey ? " ["+anch.accessKey+"]" : "" );
//}
this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"</p>";
if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
} else {
this.tip.style.left = lt+'px';
}
if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
} else {
this.tip.style.top = tp+'px';
}
this.tip.style.visibility = 'visible';
this.tip.style.opacity = '.1';
this.tipFade(10);
},
tipFade: function(opac) {
var passed = parseInt(opac);
var newOpac = parseInt(passed+this.fadespeed);
if ( newOpac < 80 ) {
this.tip.style.opacity = '.'+newOpac;
this.tip.style.filter = "alpha(opacity:"+newOpac+")";
opacityID = window.setTimeout("sweetTitles.tipFade('"+newOpac+"')",20);
}
else {
this.tip.style.opacity = '.80';
this.tip.style.filter = "alpha(opacity:80)";
}
}
};
ELO.functionsToCallOnload.push("sweetTitles.init()");
/*
Cross-Browser XMLHttpRequest v1.2
=================================
Emulate Gecko 'XMLHttpRequest()' functionality in IE and Opera. Opera requires
the Sun Java Runtime Environment <http://www.java.com/>.
by Andrew Gregory
http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
This work is licensed under the Creative Commons Attribution License. To view a
copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or send
a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,
USA.
Not Supported in Opera
----------------------
* user/password authentication
* responseXML data member
Not Fully Supported in Opera
----------------------------
* async requests
* abort()
* getAllResponseHeaders(), getAllResponseHeader(header)
*/
// IE support
if (window.ActiveXObject && !window.XMLHttpRequest) {
window.XMLHttpRequest = function() {
var msxmls = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for (var i = 0; i < msxmls.length; i++) {
try {
return new ActiveXObject(msxmls[i]);
} catch (e) {
}
}
return null;
};
}
// Gecko support
/* ;-) */
// Opera support
if (window.opera && !window.XMLHttpRequest) {
window.XMLHttpRequest = function() {
this.readyState = 0; // 0=uninitialized,1=loading,2=loaded,3=interactive,4=complete
this.status = 0; // HTTP status codes
this.statusText = '';
this._headers = [];
this._aborted = false;
this._async = true;
this._defaultCharset = 'ISO-8859-1';
this._getCharset = function() {
var charset = _defaultCharset;
var contentType = this.getResponseHeader('Content-type').toUpperCase();
val = contentType.indexOf('CHARSET=');
if (val != -1) {
charset = contentType.substring(val);
}
val = charset.indexOf(';');
if (val != -1) {
charset = charset.substring(0, val);
}
val = charset.indexOf(',');
if (val != -1) {
charset = charset.substring(0, val);
}
return charset;
};
this.abort = function() {
this._aborted = true;
};
this.getAllResponseHeaders = function() {
return this.getAllResponseHeader('*');
};
this.getAllResponseHeader = function(header) {
var ret = '';
for (var i = 0; i < this._headers.length; i++) {
if (header == '*' || this._headers[i].h == header) {
ret += this._headers[i].h + ': ' + this._headers[i].v + '\n';
}
}
return ret;
};
this.getResponseHeader = function(header) {
var ret = getAllResponseHeader(header);
var i = ret.indexOf('\n');
if (i != -1) {
ret = ret.substring(0, i);
}
return ret;
};
this.setRequestHeader = function(header, value) {
this._headers[this._headers.length] = {h:header, v:value};
};
this.open = function(method, url, async, user, password) {
this.method = method;
this.url = url;
this._async = true;
this._aborted = false;
this._headers = [];
if (arguments.length >= 3) {
this._async = async;
}
if (arguments.length > 3) {
opera.postError('XMLHttpRequest.open() - user/password not supported');
}
this.readyState = 1;
if (this.onreadystatechange) {
this.onreadystatechange();
}
};
this.send = function(data) {
if (!navigator.javaEnabled()) {
alert("XMLHttpRequest.send() - Java must be installed and enabled.");
return;
}
if (this._async) {
setTimeout(this._sendasync, 0, this, data);
// this is not really asynchronous and won't execute until the current
// execution context ends
} else {
this._sendsync(data);
}
}
this._sendasync = function(req, data) {
if (!req._aborted) {
req._sendsync(data);
}
};
this._sendsync = function(data) {
this.readyState = 2;
if (this.onreadystatechange) {
this.onreadystatechange();
}
// open connection
var url = new java.net.URL(new java.net.URL(window.location.href), this.url);
var conn = url.openConnection();
for (var i = 0; i < this._headers.length; i++) {
conn.setRequestProperty(this._headers[i].h, this._headers[i].v);
}
this._headers = [];
if (this.method == 'POST') {
// POST data
conn.setDoOutput(true);
var wr = new java.io.OutputStreamWriter(conn.getOutputStream(), this._getCharset());
wr.write(data);
wr.flush();
wr.close();
}
// read response headers
// NOTE: the getHeaderField() methods always return nulls for me :(
var gotContentEncoding = false;
var gotContentLength = false;
var gotContentType = false;
var gotDate = false;
var gotExpiration = false;
var gotLastModified = false;
for (var i = 0; ; i++) {
var hdrName = conn.getHeaderFieldKey(i);
var hdrValue = conn.getHeaderField(i);
if (hdrName == null && hdrValue == null) {
break;
}
if (hdrName != null) {
this._headers[this._headers.length] = {h:hdrName, v:hdrValue};
switch (hdrName.toLowerCase()) {
case 'content-encoding': gotContentEncoding = true; break;
case 'content-length'  : gotContentLength   = true; break;
case 'content-type'    : gotContentType     = true; break;
case 'date'            : gotDate            = true; break;
case 'expires'         : gotExpiration      = true; break;
case 'last-modified'   : gotLastModified    = true; break;
}
}
}
// try to fill in any missing header information
var val;
val = conn.getContentEncoding();
if (val != null && !gotContentEncoding) this._headers[this._headers.length] = {h:'Content-encoding', v:val};
val = conn.getContentLength();
if (val != -1 && !gotContentLength) this._headers[this._headers.length] = {h:'Content-length', v:val};
val = conn.getContentType();
if (val != null && !gotContentType) this._headers[this._headers.length] = {h:'Content-type', v:val};
val = conn.getDate();
if (val != 0 && !gotDate) this._headers[this._headers.length] = {h:'Date', v:(new Date(val)).toUTCString()};
val = conn.getExpiration();
if (val != 0 && !gotExpiration) this._headers[this._headers.length] = {h:'Expires', v:(new Date(val)).toUTCString()};
val = conn.getLastModified();
if (val != 0 && !gotLastModified) this._headers[this._headers.length] = {h:'Last-modified', v:(new Date(val)).toUTCString()};
// read response data
var reqdata = '';
var stream = conn.getInputStream();
java.lang.System.err.println(stream);
if (stream) {
var reader = new java.io.BufferedReader(new java.io.InputStreamReader(stream, this._getCharset()));
var line;
while ((line = reader.readLine()) != null) {
if (this.readyState == 2) {
this.readyState = 3;
if (this.onreadystatechange) {
this.onreadystatechange();
}
}
reqdata += line + '\n';
}
reader.close();
this.status = 200;
this.statusText = 'OK';
this.responseText = reqdata;
this.readyState = 4;
if (this.onreadystatechange) {
this.onreadystatechange();
}
if (this.onload) {
this.onload();
}
} else {
// error
this.status = 404;
this.statusText = 'Not Found';
this.responseText = '';
this.readyState = 4;
if (this.onreadystatechange) {
this.onreadystatechange();
}
if (this.onerror) {
this.onerror();
}
}
};
};
}
// ActiveXObject emulation
if (!window.ActiveXObject && window.XMLHttpRequest) {
window.ActiveXObject = function(type) {
switch (type.toLowerCase()) {
case 'microsoft.xmlhttp':
case 'msxml2.xmlhttp':
case 'msxml2.xmlhttp.3.0':
case 'msxml2.xmlhttp.4.0':
case 'msxml2.xmlhttp.5.0':
return new XMLHttpRequest();
}
return null;
};
}/*
(C) www.dhtmlgoodies.com, September 2005
Version 1.2, November 8th - 2005 - Added <iframe> background in IE
Version 1.3, November 12th - 2005 - Fixed top bar position in Opera 7
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
Thank you!
www.dhtmlgoodies.com
Alf Magne Kalleland
*/
var languageCode = 'no';	// Possible values: 	en,ge,no
// en = english, ge = german, no = norwegian
var calendar_offsetTop = 0;		// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendar_offsetLeft = 0;	// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendarDiv = false;
var MSIE = false;
var Opera = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)MSIE=true;
if(navigator.userAgent.indexOf('Opera')>=0)Opera=true;
switch(languageCode){
case "en":
var monthArray = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var dayArray = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
var weekString = 'Week';
var todayString = 'Today is';
break;
case "ge":
var monthArray = ['Jänner','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'];
var dayArray = ['Mon','Die','Mit','Don','Fre','Sam','Son'];
var weekString = 'Woche';
var todayString = 'Heute';
break;
case "no":
var monthArray = ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'];
var dayArray = ['Man','Tir','Ons','Tor','Fre','L&oslash;r','S&oslash;n'];
var weekString = 'Uke';
var todayString = 'Dagen i dag er';
break;
}
var daysInMonthArray = [31,28,31,30,31,30,31,31,30,31,30,31];
var currentMonth;
var currentYear;
var calendarContentDiv;
var returnDateTo;
var returnFormat;
var activeSelectBoxMonth;
var activeSelectBoxYear;
var iframeObj = false;
var returnDateToYear;
var returnDateToMonth;
var returnDateToDay;
var inputYear;
var inputMonth;
var inputDay;
var selectBoxHighlightColor = '#D60808'; // Highlight color of select boxes
var selectBoxRolloverBgColor = '#E2EBED'; // Background color on drop down lists(rollover)
function cancelCalendarEvent()
{
return false;
}
function isLeapYear(inputYear)
{
if(inputYear%4==0)return true;
if(inputYear%100==0)return true;
if(inputYear%400==0)return true;
return false;
}
var activeSelectBoxMonth = false;
function highlightMonthYear()
{
if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
if(this.className=='monthYearActive'){
this.className='';
}else{
this.className = 'monthYearActive';
activeSelectBoxMonth = this;
}
}
function showMonthDropDown()
{
if(document.getElementById('monthDropDown').style.display=='block'){
document.getElementById('monthDropDown').style.display='none';
}else{
document.getElementById('monthDropDown').style.display='block';
document.getElementById('yearDropDown').style.display='none';
}
}
function showYearDropDown()
{
if(document.getElementById('yearDropDown').style.display=='block'){
document.getElementById('yearDropDown').style.display='none';
}else{
document.getElementById('yearDropDown').style.display='block';
document.getElementById('monthDropDown').style.display='none';
}
}
function selectMonth()
{
document.getElementById('calendar_month_txt').innerHTML = this.innerHTML
currentMonth = this.id.replace(/[^\d]/g,'');
document.getElementById('monthDropDown').style.display='none';
for(var no=0;no<monthArray.length;no++){
document.getElementById('monthDiv_'+no).style.color='';
}
this.style.color = selectBoxHighlightColor;
activeSelectBoxMonth = this;
writeCalendarContent();
}
function selectYear()
{
document.getElementById('calendar_year_txt').innerHTML = this.innerHTML
currentYear = this.innerHTML.replace(/[^\d]/g,'');
document.getElementById('yearDropDown').style.display='none';
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
activeSelectBoxYear=this;
this.style.color = selectBoxHighlightColor;
writeCalendarContent();
}
function switchMonth()
{
if(this.src.indexOf('left')>=0){
currentMonth=currentMonth-1;;
if(currentMonth<0){
currentMonth=11;
currentYear=currentYear-1;
}
}else{
currentMonth=currentMonth+1;;
if(currentMonth>11){
currentMonth=0;
currentYear=currentYear/1+1;
}
}
writeCalendarContent();
}
function createMonthDiv(){
var div = document.createElement('DIV');
div.className='monthYearPicker';
div.id = 'monthPicker';
for(var no=0;no<monthArray.length;no++){
var subDiv = document.createElement('DIV');
subDiv.innerHTML = monthArray[no];
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectMonth;
subDiv.id = 'monthDiv_' + no;
subDiv.style.width = '56px';
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentMonth && currentMonth==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxMonth = subDiv;
}
}
return div;
}
function changeSelectBoxYear()
{
var yearItems = this.parentNode.getElementsByTagName('DIV');
if(this.innerHTML.indexOf('-')>=0){
var startYear = yearItems[1].innerHTML/1 -1;
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
}else{
var startYear = yearItems[1].innerHTML/1 +1;
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
}
for(var no=1;no<yearItems.length-1;no++){
yearItems[no].innerHTML = startYear+no-1;
yearItems[no].id = 'yearDiv' + (startYear/1+no/1-1);
}
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
if(document.getElementById('yearDiv'+currentYear)){
activeSelectBoxYear = document.getElementById('yearDiv'+currentYear);
activeSelectBoxYear.style.color=selectBoxHighlightColor;;
}
}
}
function updateYearDiv()
{
var div = document.getElementById('yearDropDown');
var yearItems = div.getElementsByTagName('DIV');
for(var no=1;no<yearItems.length-1;no++){
yearItems[no].innerHTML = currentYear/1 -6 + no;
if(currentYear==(currentYear/1 -6 + no)){
yearItems[no].style.color = selectBoxHighlightColor;
activeSelectBoxYear = yearItems[no];
}else{
yearItems[no].style.color = '';
}
}
}
function updateMonthDiv()
{
for(no=0;no<12;no++){
document.getElementById('monthDiv_' + no).style.color = '';
}
document.getElementById('monthDiv_' + currentMonth).style.color = selectBoxHighlightColor;
activeSelectBoxMonth = 	document.getElementById('monthDiv_' + currentMonth);
}
function createYearDiv()
{
if(!document.getElementById('yearDropDown')){
var div = document.createElement('DIV');
div.className='monthYearPicker';
}else{
var div = document.getElementById('yearDropDown');
var subDivs = div.getElementsByTagName('DIV');
for(var no=0;no<subDivs.length;no++){
subDivs[no].parentNode.removeChild(subDivs[no]);
}
}
var d = new Date();
if(currentYear){
d.setFullYear(currentYear);
}
var startYear = d.getFullYear()/1 - 5;
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;- ';
subDiv.onclick = changeSelectBoxYear;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
for(var no=startYear;no<(startYear+10);no++){
var subDiv = document.createElement('DIV');
subDiv.innerHTML = no;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectYear;
subDiv.id = 'yearDiv' + no;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentYear && currentYear==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxYear = subDiv;
}
}
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;+ ';
subDiv.onclick = changeSelectBoxYear;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
return div;
}
function highlightSelect()
{
if(this.className=='selectBox'){
this.className = 'selectBoxOver';
this.getElementsByTagName('IMG')[0].src = 'images/jscal-down_over.gif';
}else{
this.className = 'selectBox';
this.getElementsByTagName('IMG')[0].src = 'images/jscal-down.gif';
}
}
function highlightArrow()
{
if(this.src.indexOf('over')>=0){
if(this.src.indexOf('left')>=0)this.src = 'images/jscal-left.gif';
if(this.src.indexOf('right')>=0)this.src = 'images/jscal-right.gif';
}else{
if(this.src.indexOf('left')>=0)this.src = 'images/jscal-left_over.gif';
if(this.src.indexOf('right')>=0)this.src = 'images/jscal-right_over.gif';
}
}
function highlightClose()
{
if(this.src.indexOf('over')>=0){
this.src = 'images/jscal-close.gif';
}else{
this.src = 'images/jscal-close_over.gif';
}
}
function closeCalendar(){
document.getElementById('yearDropDown').style.display='none';
document.getElementById('monthDropDown').style.display='none';
calendarDiv.style.display='none';
if(iframeObj)iframeObj.style.display='none';
if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
if(activeSelectBoxYear)activeSelectBoxYear.className='';
}
function writeTopBar()
{
var topBar = document.createElement('DIV');
topBar.className = 'topBar';
topBar.id = 'topBar';
calendarDiv.appendChild(topBar);
// Left arrow
var leftDiv = document.createElement('DIV');
leftDiv.style.marginRight = '1px';
var img = document.createElement('IMG');
img.src = 'images/jscal-left.gif';
img.onmouseover = highlightArrow;
img.onclick = switchMonth;
img.onmouseout = highlightArrow;
leftDiv.appendChild(img);
topBar.appendChild(leftDiv);
if(Opera)leftDiv.style.width = '16px';
// Right arrow
var rightDiv = document.createElement('DIV');
rightDiv.style.marginRight = '1px';
var img = document.createElement('IMG');
img.src = 'images/jscal-right.gif';
img.onclick = switchMonth;
img.onmouseover = highlightArrow;
img.onmouseout = highlightArrow;
rightDiv.appendChild(img);
if(Opera)rightDiv.style.width = '16px';
topBar.appendChild(rightDiv);
// Month selector
var monthDiv = document.createElement('DIV');
monthDiv.id = 'monthSelect';
monthDiv.onmouseover = highlightSelect;
monthDiv.onmouseout = highlightSelect;
monthDiv.onclick = showMonthDropDown;
var span = document.createElement('SPAN');
span.innerHTML = monthArray[currentMonth];
span.id = 'calendar_month_txt';
monthDiv.appendChild(span);
var img = document.createElement('IMG');
img.src = 'images/jscal-down.gif';
img.style.position = 'absolute';
img.style.right = '0px';
monthDiv.appendChild(img);
monthDiv.className = 'selectBox';
if(Opera){
img.style.cssText = 'float:right;position:relative';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
topBar.appendChild(monthDiv);
var monthPicker = createMonthDiv();
monthPicker.style.left = '37px';
monthPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
monthPicker.style.width ='60px';
monthPicker.id = 'monthDropDown';
calendarDiv.appendChild(monthPicker);
// Year selector
var yearDiv = document.createElement('DIV');
yearDiv.onmouseover = highlightSelect;
yearDiv.onmouseout = highlightSelect;
yearDiv.onclick = showYearDropDown;
var span = document.createElement('SPAN');
span.innerHTML = currentYear;
span.id = 'calendar_year_txt';
yearDiv.appendChild(span);
topBar.appendChild(yearDiv);
var img = document.createElement('IMG');
img.src = 'images/jscal-down.gif';
yearDiv.appendChild(img);
yearDiv.className = 'selectBox';
if(Opera){
yearDiv.style.width = '50px';
img.style.cssText = 'float:right';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
var yearPicker = createYearDiv();
yearPicker.style.left = '113px';
yearPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
yearPicker.style.width = '35px';
yearPicker.id = 'yearDropDown';
calendarDiv.appendChild(yearPicker);
var img = document.createElement('IMG');
img.src = 'images/jscal-close.gif';
img.style.styleFloat = 'right';
img.onmouseover = highlightClose;
img.onmouseout = highlightClose;
img.onclick = closeCalendar;
topBar.appendChild(img);
if(!document.all){
img.style.position = 'absolute';
img.style.right = '2px';
}
}
function writeCalendarContent()
{
if(!calendarContentDiv){
calendarContentDiv = document.createElement('DIV');
calendarDiv.appendChild(calendarContentDiv);
}
var d = new Date();
d.setMonth(currentMonth);
d.setFullYear(currentYear);
d.setDate(0);
document.getElementById('calendar_year_txt').innerHTML = currentYear;
document.getElementById('calendar_month_txt').innerHTML = monthArray[currentMonth];
var existingTable = calendarContentDiv.getElementsByTagName('TABLE');
if(existingTable.length>0){
calendarContentDiv.removeChild(existingTable[0]);
}
var calTable = document.createElement('TABLE');
calTable.cellSpacing = '0';
calendarContentDiv.appendChild(calTable);
var calTBody = document.createElement('TBODY');
calTable.appendChild(calTBody);
var row = calTBody.insertRow(-1);
var cell = row.insertCell(-1);
cell.innerHTML = weekString;
cell.style.backgroundColor = selectBoxRolloverBgColor;
for(var no=0;no<dayArray.length;no++){
var cell = row.insertCell(-1);
cell.innerHTML = dayArray[no];
}
var row = calTBody.insertRow(-1);
var cell = row.insertCell(-1);
cell.style.backgroundColor = selectBoxRolloverBgColor;
var week = getWeek(currentYear,currentMonth,1);
cell.innerHTML = week;		// Week
for(var no=0;no<d.getDay();no++){
var cell = row.insertCell(-1);
cell.innerHTML = '&nbsp;';
}
var colCounter = d.getDay();
var daysInMonth = daysInMonthArray[currentMonth];
if(daysInMonth==28){
if(isLeapYear(currentYear))daysInMonth=29;
}
for(var no=1;no<=daysInMonth;no++){
d.setDate(no-1);
if(colCounter>0 && colCounter%7==0){
var row = calTBody.insertRow(-1);
var cell = row.insertCell(-1);
var week = getWeek(currentYear,currentMonth,no);
cell.innerHTML = week;		// Week
cell.style.backgroundColor = selectBoxRolloverBgColor;
}
var cell = row.insertCell(-1);
if(currentYear==inputYear && currentMonth == inputMonth && no==inputDay){
cell.style.color = '#FF0000';
}
cell.innerHTML = no;
cell.onclick = pickDate;
colCounter++;
}
if(!document.all){
if(calendarContentDiv.offsetHeight)
document.getElementById('topBar').style.top = calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight -1 + 'px';
else{
document.getElementById('topBar').style.top = '';
document.getElementById('topBar').style.bottom = '0px';
}
}
if(iframeObj){
setTimeout('resizeIframe()',50);
}
}
function resizeIframe()
{
iframeObj.style.width = calendarDiv.offsetWidth + 'px';
iframeObj.style.height = calendarDiv.offsetHeight + 'px' ;
}
function pickDate()
{
var month = currentMonth/1 +1;
if(month<10)month = '0' + month;
var day = this.innerHTML;
if(day/1<10)day = '0' + day;
if(returnFormat){
returnFormat = returnFormat.replace('dd',day);
returnFormat = returnFormat.replace('mm',month);
returnFormat = returnFormat.replace('yyyy',currentYear);
returnDateTo.value = returnFormat;
}else{
for(var no=0;no<returnDateToYear.options.length;no++){
if(returnDateToYear.options[no].value==currentYear){
returnDateToYear.selectedIndex=no;
break;
}
}
for(var no=0;no<returnDateToMonth.options.length;no++){
if(returnDateToMonth.options[no].value==month){
returnDateToMonth.selectedIndex=no;
break;
}
}
for(var no=0;no<returnDateToDay.options.length;no++){
if(returnDateToDay.options[no].value==day){
returnDateToDay.selectedIndex=no;
break;
}
}
}
closeCalendar();
}
// This function is from http://www.codeproject.com/csharp/gregorianwknum.asp
// Only changed the month add
function getWeek(year,month,day){
day = day/1;
year = year /1;
month = month/1 + 1; //use 1-12
var a = Math.floor((14-(month))/12);
var y = year+4800-a;
var m = (month)+(12*a)-3;
var jd = day + Math.floor(((153*m)+2)/5) +
(365*y) + Math.floor(y/4) - Math.floor(y/100) +
Math.floor(y/400) - 32045;      // (gregorian calendar)
var d4 = (jd+31741-(jd%7))%146097%36524%1461;
var L = Math.floor(d4/1460);
var d1 = ((d4-L)%365)+L;
NumberOfWeek = Math.floor(d1/7) + 1;
return NumberOfWeek;
}
function writeBottomBar()
{
var d = new Date();
var topBar = document.createElement('DIV');
topBar.id = 'topBar';
topBar.className = 'todaysDate';
topBar.innerHTML = todayString + ': ' + d.getDate() + '.' + monthArrayShort[d.getMonth()] + '. ' +  d.getFullYear() ;
calendarDiv.appendChild(topBar);
}
function getTopPos(inputObj)
{
var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
return returnValue + calendar_offsetTop;
}
function getleftPos(inputObj)
{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
return returnValue + calendar_offsetLeft;
}
function positionCalendar(inputObj)
{
calendarDiv.style.left = getleftPos(inputObj) + 'px';
calendarDiv.style.top = getTopPos(inputObj) + 'px';
if(iframeObj){
iframeObj.style.left = calendarDiv.style.left;
iframeObj.style.top =  calendarDiv.style.top;
}
}
function initCalendar()
{
if(MSIE){
iframeObj = document.createElement('IFRAME');
iframeObj.style.position = 'absolute';
iframeObj.border='0px';
iframeObj.style.border = '0px';
iframeObj.style.backgroundColor = '#FF0000';
document.body.appendChild(iframeObj);
}
calendarDiv = document.createElement('DIV');
calendarDiv.id = 'calendarDiv';
calendarDiv.style.zIndex = 1000;
document.body.appendChild(calendarDiv);
writeBottomBar();
writeTopBar();
if(!currentYear){
var d = new Date();
currentMonth = d.getMonth();
currentYear = d.getFullYear();
}
writeCalendarContent();
}
function displayCalendar(inputField,format,buttonObj)
{
if(buttonObj == null)
buttonObj = inputField;
if(inputField.value.length==format.length){
var monthPos = format.indexOf('mm');
currentMonth = inputField.value.substr(monthPos,2)/1 -1;
var yearPos = format.indexOf('yyyy');
currentYear = inputField.value.substr(yearPos,4);
var dayPos = format.indexOf('dd');
tmpDay = inputField.value.substr(dayPos,2);
}else{
var d = new Date();
currentMonth = d.getMonth();
currentYear = d.getFullYear();
tmpDay = 1;
}
inputYear = currentYear;
inputMonth = currentMonth;
inputDay = tmpDay/1;
if(!calendarDiv){
initCalendar();
}else{
writeCalendarContent();
}
returnFormat = format;
returnDateTo = inputField;
positionCalendar(buttonObj);
calendarDiv.style.visibility = 'visible';
calendarDiv.style.display = 'block';
if(iframeObj){
iframeObj.style.display = '';
iframeObj.style.height = calendarDiv.offsetHeight + 'px';
iframeObj.style.width = calendarDiv.offsetWidth + 'px';
}
updateYearDiv();
updateMonthDiv();
}
function displayCalendarSelectBox(yearInput,monthInput,dayInput,buttonObj)
{
currentMonth = monthInput.options[monthInput.selectedIndex].value/1-1;
currentYear = yearInput.options[yearInput.selectedIndex].value;
inputYear = yearInput.options[yearInput.selectedIndex].value;
inputMonth = monthInput.options[monthInput.selectedIndex].value/1 - 1;
inputDay = dayInput.options[dayInput.selectedIndex].value/1;
if(!calendarDiv){
initCalendar();
}else{
writeCalendarContent();
}
returnDateToYear = yearInput;
returnDateToMonth = monthInput;
returnDateToDay = dayInput;
returnFormat = false;
returnDateTo = false;
positionCalendar(buttonObj);
calendarDiv.style.visibility = 'visible';
calendarDiv.style.display = 'block';
if(iframeObj){
iframeObj.style.display = '';
iframeObj.style.height = calendarDiv.offsetHeight + 'px';
iframeObj.style.width = calendarDiv.offsetWidth + 'px';
}
updateYearDiv();
updateMonthDiv();
}
/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005
Version 1.2: Updated, November 12th. 2005
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
Thank you!
www.dhtmlgoodies.com
Alf Magne Kalleland
************************************************************************************************************/
var panelWidth = 158;	// Width of help panel
var slideSpeed = 15;		// Higher = quicker slide
var slideTimer = 5;	// Lower = quicker slide
var slideActive = true;	// Slide active ?
var initBodyMargin = 0;	// Left or top margin of your <body> tag (left if panel is at the left, top if panel is on the top)
var pushMainContentOnSlide = false;	// Push your main content to the right when sliding
var panelPosition = 0; 	// 0 = left , 1 = top
/*	Don't change these values */
var slideLeftPanelObj=false;
var slideInProgress = false;
var startScrollPos = false;
var panelVisible = false;
function initSlideLeftPanel(expandOnly)
{
if(slideInProgress)return;
if(!slideLeftPanelObj){
if(document.getElementById('helpDesk-container')){	// Object exists in HTML code?
slideLeftPanelObj = document.getElementById('helpDesk-container');
if(panelPosition == 1)slideLeftPanelObj.style.width = '100%';
}else{	// Object doesn't exist -> Create <div> dynamically
slideLeftPanelObj = document.createElement('DIV');
slideLeftPanelObj.id = 'helpDesk-container';
slideLeftPanelObj.style.display='none';
document.body.appendChild(slideLeftPanelObj);
}
if(panelPosition == 1){
slideLeftPanelObj.style.top = "-" + panelWidth + 'px';
slideLeftPanelObj.style.left = '0px';
slideLeftPanelObj.style.height = panelWidth + 'px';
}else{
slideLeftPanelObj.style.left = "-" + panelWidth + 'px';
slideLeftPanelObj.style.top = '0px';
slideLeftPanelObj.style.width = panelWidth + 'px';
}
if(!document.all || navigator.userAgent.indexOf('Opera')>=0)slideLeftPanelObj.style.position = 'fixed';;
}
if(panelPosition == 0){
if(document.documentElement.clientHeight){
slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
}else if(document.body.clientHeight){
slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
}
var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
}else{
if(document.documentElement.clientWidth){
slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
}else if(document.body.clientHeight){
slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
}
var leftPos = slideLeftPanelObj.style.top.replace(/[^0-9\-]/g,'')/1;
}
slideLeftPanelObj.style.display='block';
if(panelPosition==1)
startScrollPos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
else
startScrollPos = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
if(leftPos<(0+startScrollPos)){
if(slideActive){
slideLeftPanel(slideSpeed);
}else{
document.body.style.marginLeft = panelWidth + 'px';
slideLeftPanelObj.style.left = '0px';
}
}else{
if(expandOnly)return;
if(slideActive){
slideLeftPanel(slideSpeed*-1);
}else{
if(panelPosition == 0){
if(pushMainContentOnSlide)document.body.style.marginLeft =  initBodyMargin + 'px';
slideLeftPanelObj.style.left = (panelWidth*-1) + 'px';
}else{
if(pushMainContentOnSlide)document.body.style.marginTop =  initBodyMargin + 'px';
slideLeftPanelObj.style.top = (panelWidth*-1) + 'px';
}
}
}
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0){
window.onscroll = repositionHelpDiv;
repositionHelpDiv();
}
window.onresize = resizeLeftPanel;
}
function resizeLeftPanel()
{
if(panelPosition == 0){
if(document.documentElement.clientHeight){
slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
}else if(document.body.clientHeight){
slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
}
}else{
if(document.documentElement.clientWidth){
slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
}else if(document.body.clientWidth){
slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
}
}
}
function slideLeftPanel(slideSpeed){
slideInProgress =true;
var scrollValue = 0;
if(panelPosition==1)
var leftPos = slideLeftPanelObj.style.top.replace(/[^0-9\-]/g,'')/1;
else
var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
leftPos+=slideSpeed;
okToSlide = true;
if(slideSpeed<0){
if(leftPos < ((panelWidth*-1) + startScrollPos)){
leftPos = (panelWidth*-1) + startScrollPos;
okToSlide=false;
}
}
if(slideSpeed>0){
if(leftPos > (0 + startScrollPos)){
leftPos = 0 + startScrollPos;
okToSlide = false;
}
}
if(panelPosition==0){
slideLeftPanelObj.style.left = leftPos + startScrollPos + 'px';
if(pushMainContentOnSlide)document.body.style.marginLeft = leftPos - startScrollPos + panelWidth + 'px';
}else{
slideLeftPanelObj.style.top = leftPos + 'px';
if(pushMainContentOnSlide)document.body.style.marginTop = leftPos - startScrollPos + panelWidth + 'px';
}
if(okToSlide)setTimeout('slideLeftPanel(' + slideSpeed + ')',slideTimer); else {
slideInProgress = false;
if(slideSpeed>0)panelVisible=true; else panelVisible = false;
}
}
function repositionHelpDiv()
{
if(panelPosition==0){
var maxValue = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
slideLeftPanelObj.style.top = maxValue;
}else{
var maxValue = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
slideLeftPanelObj.style.left = maxValue;
var maxTop = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
if(!slideInProgress)slideLeftPanelObj.style.top = (maxTop - (panelVisible?0:panelWidth)) + 'px';
}
}
function cancelEvent()
{
return false;
}
function keyboardShowLeftPanel()
{
initSlideLeftPanel();
return false;
}
function leftPanelKeyboardEvent(e)
{
if(document.all)return;
if(e.keyCode==63236){
initSlideLeftPanel();
return false;
}
if(navigator.userAgent.indexOf('Safari')>=0)return;
if(e.keyCode==112){
initSlideLeftPanel();
return false;
}
}
function sethelpDeskArea(text)
{
document.getElementById('helpDesk-content').innerHTML = text;
initSlideLeftPanel(true);
}
/*
::TODO::
Disabled into further notice, we still need to complete the function anyways.
// For Firefox
if(!document.all)document.documentElement.onkeypress = leftPanelKeyboardEvent;
// For IE
document.documentElement.onhelp  = keyboardShowLeftPanel;
*/
/************************************************************************************************************
(C) www.dhtmlgoodies.com, September 2005
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
Thank you!
www.dhtmlgoodies.com
Alf Magne Kalleland
************************************************************************************************************/
function BubbleTip(e,text){
if(document.all)e = event;
var obj = document.getElementById('bubble_tooltip');
var obj2 = document.getElementById('bubble_tooltip_content');
obj2.innerHTML = text;
obj.style.display = 'block';
var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
var leftPos = e.clientX - 500;
if(leftPos<0)leftPos = 0;
obj.style.left = leftPos + 'px';
obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
}
function hideBubbleTip() {
document.getElementById('bubble_tooltip').style.display = 'none';
}
bubble_url   = 'Navnet på lenken som skrives inn i nettleser for å få opp siden. En lenke kan bare bestå av bokstaver fra a-z, tall 0-9 og bindestrek. Søkemotorer legger stor vekt på navnet på lenken så pass på å ha nøkkelord med i lenkens navn. Om ikke du oppgir noen navn vil URL automatisk genereres utifra artikkeloverskrift.<br><br>Merk at om du allerede har laget en url er det ikke lurt å endre denne, ettersom foll allerede har tatt den ibruk. Om du endrer en eksisterende lenke betyr dette at alle som lenker til deg må oppdatere sin lenke';
bubble_title = 'Tittelen på siden som vises oppe i venstre hjørne i nettleseren. Søkemotorer legger stor vekt på tittelen på siden så pass på å ha en god tittel. Om ikke du oppgir noen navn vil URL automatisk genereres utifra artikkeloverskrift.';

