//************************ PicturePreview *****************************
var intPriviewImageId;
var oPicturePreview;
function movePicturePreview()
{
getPicturePreviewSpan();
if(oPicturePreview.style.display == 'none')
oPicturePreview.style.display = '';
var rightedge = document.body.clientWidth-20;
var bottomedge = document.body.clientHeight+getPageScrollY()-20;
if (rightedge < (oPicturePreview.offsetWidth+event.clientX))
{
oPicturePreview.style.left = getPageScrollX() + event.clientX - oPicturePreview.offsetWidth - 5;
}else{
oPicturePreview.style.left = getPageScrollX() + event.clientX + 10;
}
if (bottomedge < (event.clientY+oPicturePreview.offsetHeight+getPageScrollY()))
{
oPicturePreview.style.top = getPageScrollY() + event.clientY - oPicturePreview.offsetHeight - 5;
}else{
oPicturePreview.style.top = getPageScrollY() + event.clientY + 10;
}
}
function showPicturePreview(intId, blnPicture)
{
getPicturePreviewSpan();
if(intPriviewImageId != intId)
{
intPriviewImageId = intId;
if(blnPicture == "True")
{
oPicturePreview.innerHTML = '
 |
';
oPicturePreview.style.display = '';
}else{
oPicturePreview.innerHTML = '';
hidePicturePreview()
}
}
}
function hidePicturePreview()
{
getPicturePreviewSpan();
oPicturePreview.style.display = 'none';
}
function getPicturePreviewSpan()
{
if(oPicturePreview == null)
oPicturePreview = document.getElementById('picturepreview');
if(oPicturePreview == null)
{
oPicturePreview = document.createElement('');
document.body.appendChild(oPicturePreview);
}
return oPicturePreview;
}
//*****************************************************
function changePage(strTagname, intPage)
{
document.all[strTagname].value = intPage;
document.all[strTagname + "_submit"].click();
}
function changeCharSort(strTagname, strSortletter)
{
document.all[strTagname].value = strSortletter;
document.all[strTagname + "_submit"].click();
}
function getPageScrollX(){
if(typeof window.pageXOffset == 'number'){
return window.pageXOffset;
}else{
if((window.document.compatMode) && (window.document.compatMode == 'CSS1Compat')){
return window.document.documentElement.scrollLeft;
}else{
return window.document.body.scrollLeft;
}
}
return 0;
}
function getPageScrollY(){
if(typeof window.pageXOffset == 'number'){
return window.pageYOffset;
}else{
if((window.document.compatMode) && (window.document.compatMode == 'CSS1Compat')){
return window.document.documentElement.scrollTop;
}else{
return window.document.body.scrollTop;
}
}
return 0;
}
function changeCBYNM(oCB)
{
oInput = document.all[oCB.id.slice(0,oCB.id.lastIndexOf("_"))];
if(oInput.value == "1")
{
oCB.src = "/global/graphics/basic/checkboxN.gif";
oInput.value = "";
}else if(oInput.value == "" && oCB.initValue == "2"){
oCB.src = "/global/graphics/basic/checkboxY2.gif";
oInput.value = "2";
}else{
oCB.src = "/global/graphics/basic/checkboxY.gif";
oInput.value = "1";
}
}
function toDouble(strValue)
{
strValue = trim(strValue);
strValue = strValue.replace(",", ".");
if(isNaN(strValue) || trim(strValue) == "")
{
return "";
}else{
return parseFloat(strValue);
}
}
function addUnique(strTagname, intId, strSplit)
{
var blnExists = false;
var arrValues;
var i;
oField = document.getElementById(strTagname);
if(intId != "" && oField)
{
if(!strSplit)
{
strSplit = ","
}
if(oField.value != "")
{
arrValues = oField.value.split(strSplit);
for(i=0; i');
document.body.appendChild(oPreviewSpan);
}
blnExists = false;
for(i=0; i';
oPreviewSpan.style.display = '';
}else{
oPreviewSpan.innerHTML = '';
oPreviewSpan.style.display = 'none';
}
}
}
}
var oCroparea;
function initCropArea(strTagname)
{
oCroparea = document.getElementById(strTagname);
oCropareaSpan = document.getElementById('cropAreaSpan');
oCropareaSpan.style.left = getPageScrollX() + event.clientX;
oCropareaSpan.style.top = getPageScrollY() + event.clientY-60;
oCropareaSpan.style.display = '';
drawCropArea();
}
function hideCropArea()
{
oCropareaSpan = document.getElementById('cropAreaSpan');
oCropareaSpan.style.display = 'none';
}
function changedCropArea(intId)
{
drawCropArea(intId);
setTimeout('hideCropArea()', 500);
}
function drawCropArea(intId)
{
if(intId == null){
intId = oCroparea.value;
}else{
oCroparea.value = intId;
}
for(i=1; i<=9; ++i)
{
oObj = document.getElementById("croparea_" + i);
if(intId < 4 && i < 4){
oObj.style.backgroundColor = "#F0F5FA";
}else if((intId > 3 && intId < 7) && (i > 3 && i < 7)){
oObj.style.backgroundColor = "#F0F5FA";
}else if((intId > 6) && (i > 6)){
oObj.style.backgroundColor = "#F0F5FA";
}else{
oObj.style.backgroundColor = "white";
}
if(i-3 == intId || i-6 == intId || i+3 == intId || i+6 == intId){
oObj.style.backgroundColor = "#F0F5FA";
}
if(i == intId){
oObj.style.backgroundColor = "#99a3b7";
}
}
}
function showEmail(intId)
{
window.open('/global/moduler/email/show_email.asp?id=' + intId, '_blank', 'width=800,height=600,location=0,menubar=0,resizable=0,scrollbars=1');
}
function newEmail(strToType, intId)
{
window.open('/global/moduler/email/new_email.asp?totype=' + strToType + '&id=' + intId, '', 'width=800,height=600,location=0,menubar=0,resizable=0,scrollbars=1');
}
function hideBrowserMenu(strUrl)
{
if(strUrl == null)
{
strUrl = document.location;
}
if(strUrl != "")
{
newWindow = window.open(strUrl, '', 'location=0,menubar=0,resizable=1,scrollbars=1,status=1');
newWindow.focus();
window.opener = self;
window.close();
}
}
function showBrowserMenu(strUrl)
{
if(strUrl == null)
{
strUrl = document.location;
}
if(strUrl != "")
{
newWindow = window.open(strUrl, '')
newWindow.focus();
window.opener = self;
window.close();
}
}
function openWebsiteFromInput(strTagname)
{
oObj = document.getElementById(strTagname);
strUrl = trim(oObj.value);
if(strUrl != "")
{
if(strUrl.indexOf("http://") == -1)
{
strUrl = "http://" + strUrl;
}
window.open(strUrl);
}
}
function openEmailFromInput(strTagname)
{
oObj = document.getElementById(strTagname);
strEmail = trim(oObj.value);
if(strEmail != "")
{
document.location = "mailto:" + strEmail;
}
}
function openMap(strType, intId)
{
if(strType == "firmdepartment"){
window.open("/global/moduler/map/open_firmdepartment.asp?id=" + intId, "MapPopup", "scrollbars=yes,width=800,height=700");
}else if(strType == "firm"){
window.open("/global/moduler/map/open_firm.asp?id=" + intId, "MapPopup", "scrollbars=yes,width=800,height=700");
}else if(strType == "person"){
window.open("/global/moduler/map/open_person.asp?id=" + intId, "MapPopup", "scrollbars=yes,width=800,height=700");
}else{
alert("Error");
}
}
var strSelectedTemplateImageId, strSelectedTemplateInputId;
var blnPageLoaded;
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
var gSafeOnload = new Array();
function AddOnload(f)
{
if (IEmac && IE4) // IE 4.5 blows out on testing window.onload
{
window.onload = SafeOnload;
gSafeOnload[gSafeOnload.length] = f;
}
else if (window.onload)
{
if (window.onload != SafeOnload)
{
gSafeOnload[0] = window.onload;
window.onload = SafeOnload;
}
gSafeOnload[gSafeOnload.length] = f;
}
else
window.onload = f;
}
function SafeOnload()
{
for (var i=0;i String(str).length) // Invalid bound, return
return str; // entire string
else { // Valid bound, return appropriate substring
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
function trim(strString) {
return strString.replace(/^\s+/,'').replace(/\s+$/,'');
}
function showLoadingPane()
{
if(!blnPageLoaded)
{
document.getElementById("loadingPane").style.display = "block";
}
}
function removeLoadingPane()
{
blnPageLoaded = true;
document.getElementById("loadingPane").style.display = "none";
}
function getFile(strTagName, intType, csvExtension)
{
wndX = ((screen.width/2) - (800/2));
wndY = ((screen.height/2) - (575/2));
if(csvExtension == undefined)
{
csvExtension = "";
}
window.open("/global/moduler/filepicture/chooser/chooser.asp?type=" + intType + "&formtagname="+strTagName + "&Extension=" + csvExtension, "Pictures","scrollbars=yes,width=800,height=575,top="+wndX+",left="+wndY+"");
}
function getImage(strTagName, blnMultiselect)
{
wndX = ((screen.width/2) - (800/2));
wndY = ((screen.height/2) - (575/2));
blnMultiselect!=undefined ? strAddToWindow="&multiselect="+blnMultiselect : strAddToWindow='';
window.open("/global/moduler/filepicture/chooser/chooser.asp?initselect=true&type=1&formtagname="+strTagName+strAddToWindow, "Pictures","scrollbars=yes,width=800,height=575,top="+wndX+",left="+wndY+"");
}
function getMpeg(strTagName, blnMultiselect)
{
wndX = ((screen.width/2) - (800/2));
wndY = ((screen.height/2) - (575/2));
blnMultiselect!=undefined ? strAddToWindow="&multiselect="+blnMultiselect : strAddToWindow='';
window.open("/global/moduler/filepicture/chooser/chooser.asp?initselect=true&extension=MPEG&formtagname="+strTagName+strAddToWindow, "Pictures","scrollbars=yes,width=800,height=575,top="+wndX+",left="+wndY+"");
}
function uploadFile(strTagName, intType, blnSelection)
{
wndX = ((screen.width/2) - (800/2));
wndY = ((screen.height/2) - (575/2));
if(blnSelection+'' != 'false')
blnSelection = '';
window.open("/global/moduler/filepicture/chooser/chooser.asp?type=" + intType + "&mode=upload&vmenuid-menu=1&formtagname="+strTagName+"&selection="+blnSelection, "Pictures","scrollbars=yes,width=800,height=575,top="+wndX+",left="+wndY+"");
}
function uploadImage(strTagName)
{
wndX = ((screen.width/2) - (800/2));
wndY = ((screen.height/2) - (575/2));
window.open("/global/moduler/filepicture/chooser/chooser.asp?type=1&mode=upload&formtagname="+strTagName, "Pictures","scrollbars=yes,width=800,height=575,top="+wndX+",left="+wndY+"");
}
function removeImage(strTagName)
{
var image_id = document.getElementById(strTagName);
var image_pane = document.getElementById(strTagName+'_image_pane');
var noimage_pane = document.getElementById(strTagName+'_noimage_pane');
var oAlt = document.getElementById(strTagName+'_alt');
var oLink = document.getElementById(strTagName+'_link');
image_pane.style.display = "none";
noimage_pane.style.display = "block";
image_id.value = "";
if(oAlt != null)
{
oAlt.value = "";
}
if(oLink != null)
{
oLink.value = "";
}
}
function changeImage(strTagName, intId, strName, strAltText)
{
var image_id = document.getElementById(strTagName);
var image_pane = document.getElementById(strTagName+'_image_pane');
var noimage_pane = document.getElementById(strTagName+'_noimage_pane');
var image_txt = document.getElementById(strTagName+'_txt');
var oImage = document.getElementById(strTagName+'_thumb');
var oAlt = document.getElementById(strTagName+'_alt');
var oTitle = document.getElementById(strTagName+'_title');
image_id.value = intId;
if(image_pane != null)
{
image_pane.style.display = "block";
}
if(noimage_pane != null)
{
noimage_pane.style.display = "none";
}
if(image_txt != null)
{
image_txt.innerHTML = strName;
}
if(oImage != null)
{
oImage.src = "/global/moduler/picture/getpicture.asp?xmax=72&id="+intId;
}
if(oAlt != null)
{
oAlt.value = strAltText;
}
if(oTitle != null)
{
oTitle.value = strName;
}
}
var blnIsChecking;
blnIsChecking = false;
function isValidDate(oObj, strTagName)
{
if(!blnIsChecking)
{
blnIsChecking = true;
strTag = strTagName.split("-")[0];
strType = strTagName.split("-")[1];
oDay = document.getElementById(strTag + "-" + strType + "-DateDay");
oYear = document.getElementById(strTag + "-" + strType + "-DateYear");
oMonth = document.getElementById(strTag + "-" + strType + "-DateMonth");
if(strType == 'from')
{
day = getFromDateDay(strTag);
month = getFromDateMonth(strTag);
year = getFromDateYear(strTag);
}else{
day = getToDateDay(strTag);
month = getToDateMonth(strTag);
year = getToDateYear(strTag);
}
if(day == "" && month == "" && year == "")
{
return true;
}
if(day == "")
{
if(event.srcElement == oDay)
{
alert('Day must be stated with 2 figures');
oDay.select();
oDay.focus();
return false;
}
}
else
{
if(day.length != 2 || isNaN(day))
{
alert('Day must be stated with 2 figures');
oDay.select();
oDay.focus();
return false;
}
if (day < 1 || day > 31) {
alert('Day must be betwen 01 and 31');
oDay.focus();
oDay.select();
return false;
}
}
if(month == "")
{
if(event.srcElement == oMonth)
{
alert('Month must be stated with 2 figures');
oMonth.focus();
oMonth.select();
return false;
}
}
else
{
if(month.length != 2 || isNaN(month))
{
alert('Month must be stated with 2 figures');
oMonth.select();
oMonth.focus();
return false;
}
if (month < 1 || month > 12) {
alert('Month must be betwen 01 and 12');
oMonth.focus();
oMonth.select();
return false;
}
}
if(year == "")
{
if(event.srcElement == oYear)
{
alert('Year must be stated with 4 figures');
oYear.focus();
oYear.select();
return false;
}
}
else
{
if(year.length != 4 || isNaN(year))
{
alert('Year must be stated with 4 figures');
oYear.focus();
oYear.select();
return false;
}
}
if((month==4 || month==6 || month==9 || month==11)&& day==31)
{
alert('Month ' + month + ' has not 31 days')
oDay.focus();
oDay.select();
return false;
}
if (month == 2)
{
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
alert('February ' + year + ' has not ' + day + ' days');
oDay.focus();
oDay.select();
return false;
}
}
document.getElementById(strTagName+"_dateholder").value = year+month+day;
return true;
}
}
function period_fromdate_changed(strTagName, intType)
{
fromYear = getFromDateYear(strTagName);
if(fromYear != '')
{
oBlnImg.src = '/global/graphics/basic/checkboxY.gif';
oBln.value = '1';
}
}
var arrPeriodNewsTxt = Array("The news are online", "The news are offline, but will be activated the", "clock", "The news will be offline the", "The news are offline");
var arrPeriodPageTxt = Array("The page is online", "The page is offline, but will be activated the", "clock", "The page will be offline the", "The page is offline");
var arrPeriodAfsnitTxt = Array("The section is online", "The section is offline, but will be activated the", "clock", "The section will be offline the", "The section is offline");
var arrPeriodActivityTxt = Array("The activity is online.", "The activity is offline, but will be activated the", "clock", "The activity will be offline the", "Aktiviteten er offline.");
var arrPeriodMediaTxt = Array("Mediet er online.", "Mediet er offline, men aktiveres den", "clock", "Mediet vil være offline den", "Mediet er offline.");
var arrPeriodCatalogTxt = Array("The catalogue is online.", "The catalogue is offline, but is activated the", "clock", "The catalogue will be offline the", "The catalogue is offline.");
var arrPeriodAnnonceTxt = Array("Annoncen er online.", "Annoncen er offline, men aktiveres den", "clock", "Annoncen vil være offline den", "Annoncen er offline.");
var arrPeriodTxt = Array(arrPeriodNewsTxt, arrPeriodPageTxt, arrPeriodAfsnitTxt, arrPeriodActivityTxt,arrPeriodMediaTxt,arrPeriodCatalogTxt, arrPeriodAnnonceTxt);
function period_changed(strTagName, intType)
{
oBln = document.getElementById(strTagName+'_online');
oBlnImg = document.getElementById(strTagName+'_online_img');
oTxt = document.getElementById(strTagName+'_status_txt');
if(oBln.value)
{
fromDay = getFromDateDay(strTagName);
fromMonth = getFromDateMonth(strTagName);
fromYear = getFromDateYear(strTagName);
fromHour = getFromDateHour(strTagName);
fromMinute= getFromDateMinute(strTagName);
oFromDate = new Date(fromMonth+"/"+fromDay+"/"+fromYear+" "+fromHour+":"+fromMinute);
toDay = getToDateDay(strTagName);
toMonth = getToDateMonth(strTagName);
toYear = getToDateYear(strTagName);
toHour = getToDateHour(strTagName);
toMinute = getToDateMinute(strTagName);
oToDate = new Date(toMonth+"/"+toDay+"/"+toYear+" "+toHour+":"+toMinute);
oNowDate = new Date();
//alert(oFromDate);
if(fromYear != '')
{
if(oFromDate < oNowDate)
{
oTxt.innerHTML = arrPeriodTxt[intType-1][0]; //"XX er online.";
}else{
oTxt.innerHTML = arrPeriodTxt[intType-1][1] + " " + fromDay + "." + fromMonth + "." + fromYear; //"XX er offline, men aktiveres den "
if(fromHour != '')
{
oTxt.innerHTML += " " + arrPeriodTxt[intType-1][2] + " " + fromHour + ":" + fromMinute; //"kl."
}
}
}else{
oTxt.innerHTML = arrPeriodTxt[intType-1][0]; //"XX er online.";
}
if(toYear != '')
{
oTxt.innerHTML += "
" +arrPeriodTxt[intType-1][3] + " " + toDay + "." + toMonth + "." + toYear; //"Siden vil være offline den"
if(toHour != '')
{
oTxt.innerHTML += " " + arrPeriodTxt[intType-1][2] + " " + toHour + ":" + toMinute; //"kl."
}
}
}else{
/*if(event)
{
alert();
if(event.type == 'click')
{
changeFromDateStyle(strTagName, "color3");
}
}*/
oTxt.innerHTML = arrPeriodTxt[intType-1][4]; //"Nyheden er offline."
}
}
function setCookie(strTagname, strValue) {
var strCookie = strTagname + "=" + escape(strValue);
document.cookie = strCookie;
}
function deleteCookie(strTagname) {
var strCookie = strTagname + "=";
document.cookie = strCookie;
}
function showhide(img, divname){
val = document.getElementById(divname+'id').value;
if(val == 1){
document.getElementById(divname).style.display = 'none';
img.src = '/global/graphics/basic/symbols/maximize.gif';
img.alt = 'Maximer';
document.getElementById(divname+'id').value = 0;
setCookie(divname+'_border', '0');
}
else{
document.getElementById(divname).style.display = 'block';
img.src = '/global/graphics/basic/symbols/minimize.gif';
img.alt = 'Minimer';
document.getElementById(divname+'id').value = 1;
setCookie(divname+'_border', '1');
}
}
function swapCheckBox(cb, cbid, cbvalue){
val = document.getElementById(cbid).value;
if(val == ''){
cb.src = '/global/graphics/basic/checkboxY.gif';
document.getElementById(cbid).value = cbvalue;
}
else{
cb.src = '/global/graphics/basic/checkboxN.gif';
document.getElementById(cbid).value = '';
}
}
function switchRadioBox(strImg, str_InputTag, str_Value)
{
arrImages = document.images;
strImagesTagname = strImg.split("_")[0];
for(i=0; i1||(intEndYear-intStartYear)<-1){
intMonth = ((oDateEnd.getFullYear())-(oDateStart.getFullYear()+1))*12
}
intMonth = intMonth+12-oDateStart.getMonth();
intMonth = intMonth+12-(12-oDateEnd.getMonth());
return intMonth;
}
case "yyyy":
return oDateEnd.getFullYear()-oDateStart.getFullYear();
}
}
function DateToString(dtmDate){
//Example of dateformat: 06/15/2004 12:31
var oDate = new Date(dtmDate);
var strYear = new String(oDate.getYear());
var strMonth = Right(new String('00') + new String(oDate.getMonth()+1), 2);
var strDay = Right(new String('00') + new String(oDate.getDate()), 2);
var strHour = Right(new String('00') + new String(oDate.getHours()), 2);
var strMinute = Right(new String('00') + new String(oDate.getMinutes()), 2);
return strYear + strMonth + strDay + strHour + strMinute;
}
function StringToDate(str_Date){
if(str_Date != ''&&str_Date.length>=8){
var intYear = str_Date.substr(0,4);
var intMonth = str_Date.substr(4,2);
var intDay = str_Date.substr(6,2);
if(str_Date.length>=12){
var intHour = str_Date.substr(8,2);
var intMinute = str_Date.substr(10,2);
var oDate = new Date(intMonth+"/"+intDay+"/"+intYear+" "+intHour+":"+intMinute);
}
else{
var oDate = new Date(intMonth+"/"+intDay+"/"+intYear);
}
return oDate.getVarDate();
}
else{
return '';
}
}
function showDateLayer(obj,e,dateId,oParent)
{
editDateObj = dateId;
var x = 0;
var y = 0;
var oBodyElement;
if(oParent)
{
oBodyElement = eval(oParent+".document.body");
}
else
{
oBodyElement = document.body;
}
var rightedge = oBodyElement.clientWidth-event.clientX;
var bottomedge = oBodyElement.clientHeight-event.clientY;
if (rightedge < datoLayer.offsetWidth){
x = oBodyElement.scrollLeft + event.clientX - datoLayer.offsetWidth;
}else{
x = oBodyElement.scrollLeft + event.clientX;
}
if (bottomedge < datoLayer.offsetHeight){
y = oBodyElement.scrollTop + event.clientY - datoLayer.offsetHeight;
}else{
y = oBodyElement.scrollTop + event.clientY;
}
if(x<0){
x = 10;
}
datoLayer.style.left = x;
datoLayer.style.top = y;
datoLayer.style.visibility = "visible";
}
function ansoegningsFristSaettes()
{
datoLayer.style.visibility = "hidden";
dato = document.all.scrDatoObj.getDate();
aar = charAtTest(1,dato)+charAtTest(2,dato)+charAtTest(3,dato)+charAtTest(4,dato);
maaned = charAtTest(5,dato)+charAtTest(6,dato);
dag = charAtTest(7,dato)+charAtTest(8,dato);
document.getElementById(editDateObj+"Day").value = dag;
document.getElementById(editDateObj+"Month").value = maaned;
document.getElementById(editDateObj+"Year").value = aar;
document.getElementById(editDateObj+"_dateholder").value = aar+maaned+dag;
}
function checkHour(objInput, strTagName)
{
if(objInput.value.length == 1 || isNaN(objInput.value))
{
alert("Time skal være to cifret");
objInput.focus();
objInput.select();
return false;
}else{
if(objInput.value>23 || objInput.value<0)
{
alert("Time skal være mellem 00 og 23");
objInput.focus();
objInput.select();
return false;
}else{
return true;
}
}
}
function checkMinute(objInput, strTagName)
{
strType = objInput.name.split("-")[1];
objHour = document.getElementById(strTagName+"-"+strType+"-DateHour");
if(objHour.value != "" && objHour.value.length == 2)
{
if(objInput.value.length < 2 || isNaN(objInput.value))
{
alert("Minut skal være to cifret");
objInput.focus();
objInput.select();
return false;
}else{
if(objInput.value>59 || objInput.value<0)
{
alert("Minut skal være mellem 00 og 59");
objInput.focus();
objInput.select();
return false;
}else{
return true;
}
}
}
}
function checkHourKeyUp(objInput, strTagName)
{
strType = objInput.name.split("-")[1];
if(objInput.value.length == 2)
{
if(checkHour(objInput, strTagName))
{
objMinute = document.getElementById(strTagName+"-"+strType+"-DateMinute");
objMinute.focus();
objMinute.select();
}
}
}
function checkSelectHour(objInput, strTagName)
{
strType = objInput.name.split("-")[1];
objHour = document.getElementById(strTagName+"-"+strType+"-DateDay");
if(objHour)
{
if(objHour.value == "")
{
alert("Angiv først dato");
return false;
}
}
}
function checkSelectMinute(objInput, strTagName)
{
strType = objInput.name.split("-")[1];
objDay = document.getElementById(strTagName+"-"+strType+"-DateDay");
if(objDay && objDay.value == "")
{
alert("Angiv først dato");
return false;
}else{
objHour = document.getElementById(strTagName+"-"+strType+"-DateHour");
if(objHour.value == "")
{
objHour.focus();
objHour.select();
return false;
}
}
}
var strFromToDateChanged = false;
function fromToDateChanged(strTagName)
{
if(strFromToDateChanged)
{
strFromToDateTagChanged = false;
var strStartDate = getFromDate(strTagName);
var strEndDate = getToDate(strTagName);
if(strStartDate.length==12 && strEndDate.length==12 && strStartDate>=strEndDate){
var dtmStartDate = StringToDate(strStartDate);
var oDateStart = new Date(dtmStartDate);
strDiff = DateDiff("n", StringToDate(strOldStartDate), StringToDate(strOldEndDate));
var oDateEnd = new Date(StringToDate(strStartDate));
strDiff = strDiff + oDateEnd.getMinutes();
oDateEnd.setMinutes(strDiff);
setToDate(strTagName, DateToString(oDateEnd.getVarDate()));
}else if(strStartDate.length==12 && strEndDate.length==12){
strOldStartDate = getFromDate(strTagName);
strOldEndDate = getToDate(strTagName);
}
}
}
function fromToDatePropertychange(){
strFromToDateChanged = true;
setTimeout("fromToDateChanged('date')", 1);
}
function clearFromTime(strTagName)
{
document.getElementById(strTagName+"-from-DateHour").value = "";
document.getElementById(strTagName+"-from-DateMinute").value = "";
}
function clearToTime(strTagName)
{
document.getElementById(strTagName+"-to-DateHour").value = "";
document.getElementById(strTagName+"-to-DateMinute").value = "";
}
function clearFromDate(strTagName)
{
try{
document.getElementById(strTagName+"-from-DateDay").value = "";
document.getElementById(strTagName+"-from-DateMonth").value = "";
document.getElementById(strTagName+"-from-DateYear").value = "";
document.getElementById(strTagName+"-from-date_dateholder").value = "";
}catch(e){}
try{
document.getElementById(strTagName+"-from-DateHour").value = "";
document.getElementById(strTagName+"-from-DateMinute").value = "";
}catch(e){}
}
function clearToDate(strTagName)
{
document.getElementById(strTagName+"-to-DateDay").value = "";
document.getElementById(strTagName+"-to-DateMonth").value = "";
document.getElementById(strTagName+"-to-DateYear").value = "";
try{
document.getElementById(strTagName+"-to-DateHour").value = "";
document.getElementById(strTagName+"-to-DateMinute").value = "";
}catch(e){}
}
function changeFromDateStyle(strTagName, strClass)
{
blnFromYearClassChanged = true;
document.getElementById(strTagName+"-from-DateDay").className = strClass;
blnFromYearClassChanged = true;
document.getElementById(strTagName+"-from-DateMonth").className = strClass;
blnFromYearClassChanged = true;
document.getElementById(strTagName+"-from-DateYear").className = strClass;
}
function getFromDateDay(strTagName)
{
oObj = document.getElementById(strTagName+"-from-DateDay");
if(oObj){
return oObj.value;
}
}
function getFromDateMonth(strTagName)
{
oObj = document.getElementById(strTagName+"-from-DateMonth");
if(oObj){
return oObj.value;
}
}
function getFromDateYear(strTagName)
{
oObj = document.getElementById(strTagName+"-from-DateYear");
if(oObj){
return oObj.value;
}
}
function getFromDateHour(strTagName)
{
oObj = document.getElementById(strTagName+"-from-DateHour");
if(oObj){
return oObj.value;
}
}
function getFromDateMinute(strTagName)
{
oObj = document.getElementById(strTagName+"-from-DateMinute");
if(oObj){
return oObj.value;
}
}
function getToDateDay(strTagName)
{
oObj = document.getElementById(strTagName+"-to-DateDay");
if(oObj){
return oObj.value;
}
}
function getToDateMonth(strTagName)
{
oObj = document.getElementById(strTagName+"-to-DateMonth");
if(oObj){
return oObj.value;
}
}
function getToDateYear(strTagName)
{
oObj = document.getElementById(strTagName+"-to-DateYear");
if(oObj){
return oObj.value;
}
}
function getToDateHour(strTagName)
{
oObj = document.getElementById(strTagName+"-to-DateHour");
if(oObj){
return oObj.value;
}
}
function getToDateMinute(strTagName)
{
oObj = document.getElementById(strTagName+"-to-DateMinute");
if(oObj){
return oObj.value;
}
}
function getFromTime(strTagName)
{
strTmp = "" + getFromDateHour(strTagName) + getFromDateMinute(strTagName);
if(strTmp == "")
{
}else{
if(strTmp.length == 4)
{
return "000000000000" + strTmp;
}
}
return "";
}
function getFromDate(strTagName)
{
strTmp = getFromDateYear(strTagName) + getFromDateMonth(strTagName) + getFromDateDay(strTagName)
if(strTmp == "")
{
return "";
}else{
if(getFromDateHour(strTagName) == "")
{
return strTmp + "0000";
}else{
return strTmp + getFromDateHour(strTagName) + getFromDateMinute(strTagName);
}
}
}
function getToDate(strTagName)
{
strTmp = getToDateYear(strTagName) + getToDateMonth(strTagName) + getToDateDay(strTagName)
if(strTmp == "")
{
return "";
}else{
if(getToDateHour(strTagName) == "")
{
return strTmp + "0000";
}else{
return strTmp + getToDateHour(strTagName) + getToDateMinute(strTagName);
}
}
}
function setFromDate(strTagName, strValue)
{
document.getElementById(strTagName+"-from-DateDay").value = strValue.substr(6,2);
document.getElementById(strTagName+"-from-DateMonth").value = strValue.substr(4,2);
document.getElementById(strTagName+"-from-DateYear").value = strValue.substr(0,4);
try{
document.getElementById(strTagName+"-from-DateHour").value = strValue.substr(8,2);
document.getElementById(strTagName+"-from-DateMinute").value = strValue.substr(10,2);
}catch(e){}
}
function setToDate(strTagName, strValue)
{
document.getElementById(strTagName+"-to-DateYear").value = strValue.substr(0,4);
document.getElementById(strTagName+"-to-DateMonth").value = strValue.substr(4,2);
document.getElementById(strTagName+"-to-DateDay").value = strValue.substr(6,2);
try{
document.getElementById(strTagName+"-to-DateHour").value = strValue.substr(8,2);
document.getElementById(strTagName+"-to-DateMinute").value = strValue.substr(10,2);
}catch(e){}
}
function charAtTest(n, streng){
var s;
s = streng.charAt(n - 1);
return(s);
}
var oHiddenIframe;
function addProductToRememberID(intProductId){
makeIframeIfNotExist();
hiddenIframe.location.href='/global/moduler/product/sortiment/rememberid.asp?productid=' + intProductId;
}
function resetRememberID(){
makeIframeIfNotExist();
hiddenIframe.location.href='/global/moduler/product/sortiment/rememberid.asp?mode=kill';
}
function makeIframeIfNotExist(){
if(oHiddenIframe==null){
oHiddenIframe = document.createElement('');
document.body.appendChild(oHiddenIframe);
}
}
//************** TEMPLATE PRE REMEMBER ID ****************
function changeRememberId(strName, strId)
{
makeIframeIfNotExist();
hiddenIframe.document.URL = '/global/pre/rememberid.asp?mode=change&name=' + strName + '&id=' + strId;
}
function addRememberId(strName, strId)
{
makeIframeIfNotExist();
hiddenIframe.document.URL = '/global/pre/rememberid.asp?mode=add&name=' + strName + '&id=' + strId;
}
function removeRememberId(strName, strId)
{
makeIframeIfNotExist();
hiddenIframe.document.URL = '/global/pre/rememberid.asp?mode=remove&name=' + strName + '&id=' + strId;
}
function clearRememberId(strName)
{
makeIframeIfNotExist();
hiddenIframe.document.URL = '/global/pre/rememberid.asp?mode=clear&name=' + strName;
}
//********************************************************
//************* RIGHTCLICK MENU ******************
var intRightClickMode;
var intRightClickType;
var strRightClickId;
var strRightClickText;
var blnRightClickCreate;
var blnRightClickRead;
var blnRightClickUpdate;
var blnRightClickDelete;
var menuSet;
var arrRightClick;
var blnRightClickOpen;
arrRightClick = new Array(5);
for (i=0; i<5; i++)
{
arrRightClick[i] = new Array(3);
}
function initRightClickMenu()
{
blnRightClickOpen = false;
arrRightClick[0][0] = 'Edit menu';
arrRightClick[0][1] = 'Create menu item';
arrRightClick[1][0] = 'Edit segment';
arrRightClick[1][1] = 'Create segment';
arrRightClick[2][0] = 'Edit news';
arrRightClick[2][1] = 'Make News';
arrRightClick[3][0] = 'Rediger aktivitet';
arrRightClick[3][1] = 'Create activity';
arrRightClick[4][0] = 'Tilføj til skilte'; //update
arrRightClick[4][1] = 'Nulstil skilte'; //create
document.oncontextmenu = showRightClickMenu;
document.body.onclick = hideRightClickMenu;
return true;
}
function hideRightClickMenu()
{
if(blnRightClickOpen)
{
rightClickMenu.style.visibility = 'hidden';
rightClickMenu_Edit.style.display = 'none';
rightClickMenu_New.style.display = 'none';
blnRightClickOpen = false;
if(oMenuDiv != null)
{
oMenuDiv.style.display = "none";
}
}
}
function setRightClickMenu(intType, strId, strCreate, strRead, strUpdate, strDelete)
{
if(window.event.returnValue == null)
{
window.event.returnValue = "done";
intRightClickMode = intType;
intRightClickType = intType;
strRightClickId = strId;
if(!isNaN(intType))
{
rightClickMenu_Edit_text.innerHTML = arrRightClick[intType][0];
rightClickMenu_New_text.innerHTML = arrRightClick[intType][1];
rightClickMenu_EditGray_text.innerHTML = arrRightClick[intType][0];
rightClickMenu_NewGray_text.innerHTML = arrRightClick[intType][1];
}
if(strCreate == "True" || strCreate == "1"){
strCreate = true;
}else{
strCreate = false;
}
if(strRead == "True" || strRead == "1"){
strRead = true;
}else{
strRead = false;
}
if(strUpdate == "True" || strUpdate == "1"){
strUpdate = true;
}else{
strUpdate = false;
}
if(strDelete == "True" || strDelete == "1"){
strDelete = true;
}else{
strDelete = false;
}
blnRightClickCreate = strCreate;
blnRightClickRead = strRead;
blnRightClickUpdate = strUpdate;
blnRightClickDelete = strDelete;
}
}
function showRightClickMenu()
{
if (window.event.ctrlKey) {
return true;
}
blnRightClickOpen = true;
if(intRightClickMode >= 0 )
{
rightClickMenu_Edit.style.display = 'block';
rightClickMenu_New.style.display = 'block';
if(blnRightClickUpdate)
{
rightClickMenu_EditA.style.display = 'block';
rightClickMenu_EditGray.style.display = 'none';
}else{
rightClickMenu_EditA.style.display = 'none';
rightClickMenu_EditGray.style.display = 'block';
}
if(blnRightClickCreate)
{
rightClickMenu_NewA.style.display = 'block';
rightClickMenu_NewGray.style.display = 'none';
}else{
rightClickMenu_NewA.style.display = 'none';
rightClickMenu_NewGray.style.display = 'block';
}
intRightClickMode = -1;
}else{
rightClickMenu_Edit.style.display = 'none';
rightClickMenu_New.style.display = 'none';
}
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
var intLeft;
var intTop;
if (rightedge < rightClickMenu.offsetWidth)
intLeft = getPageScrollX() + event.clientX - rightClickMenu.offsetWidth;
else
intLeft = getPageScrollX() + event.clientX;
if (bottomedge < rightClickMenu.offsetHeight)
intTop = getPageScrollY() + event.clientY - rightClickMenu.offsetHeight;
else
intTop = getPageScrollY() + event.clientY;
if(intTop<0){
intTop = 0;
}
rightClickMenu.style.left = intLeft;
rightClickMenu.style.top = intTop;
rightClickMenu.style.zIndex = 10000;
rightClickMenu.style.visibility = 'visible';
if(oMenuDiv != null)
{
oMenuDiv.style.display = "none";
}
return false;
}
function RightClickMenuEdit(objA)
{
if(intRightClickType == 0)
{
objA.href = "/global/moduler/menu/menu.asp?contextid=&treeid=" + strRightClickId;
}else if(intRightClickType == 1)
{
if(!isNaN(strRightClickId))
objA.href = "/global/moduler/page/editsection.asp?contextid=§ion_id=" + strRightClickId;
}else if(intRightClickType == 2)
{
objA.href = "/global/moduler/page/editsection.asp?section_id=" + strRightClickId;
}else if(intRightClickType == 3)
{
objA.href = "/global/moduler/calendar/activity/activity.asp?id=" + strRightClickId;
}else if(intRightClickType == 4)
{
objA.href = "javascript:addProductToRememberID('" + strRightClickId + "');"
}
}
function RightClickMenuNew(objA)
{
if(intRightClickType == 0)
{
objA.href = "/global/moduler/menu/menu.asp?contextid=&treeid=" + strRightClickId;
}else if(intRightClickType == 1)
{
objA.href = "/global/moduler/page/sections.asp?contextid=";
}else if(intRightClickType == 2)
{
objA.href = "/global/moduler/page/editsection.asp?mode=newnewssection";
}else if(intRightClickType == 3)
{
objA.href = "/global/moduler/calendar/activity/activity.asp";
}else if(intRightClickType == 4)
{
objA.href = "javascript:resetRememberID();"
}
}
var oMenuDiv = null;
function show_submenu(obj, strTagnameMenu)
{
intDivY = document.getElementById(strTagnameMenu+'_arrow').offsetTop;
if(oMenuDiv != null)
{
oMenuDiv.style.display = "none";
}
oMenuDiv = document.getElementById(strTagnameMenu);
oMenuDiv.style.display = "block";
oMenuDiv.style.zIndex = 10001;
var rightedge = document.body.clientWidth;
var bottomedge = document.body.clientHeight;
if (rightedge < (rightClickMenu.offsetLeft+rightClickMenu.offsetWidth+oMenuDiv.offsetWidth))
{
oMenuDiv.style.left = rightClickMenu.offsetLeft - oMenuDiv.offsetWidth+1;
}else{
oMenuDiv.style.left = rightClickMenu.offsetLeft + 189;
}
if (bottomedge < (rightClickMenu.offsetTop+intDivY+oMenuDiv.offsetHeight+25))
{
oMenuDiv.style.top = rightClickMenu.offsetTop+intDivY-oMenuDiv.offsetHeight+25; // oMenuDiv.offsetHeight+10;
}else{
oMenuDiv.style.top = rightClickMenu.offsetTop+intDivY-10;
}
}
//*****************************************************