/* 
WMS Lucrasoft Javascript Standaard functies
*/

function makeHttpRequest(url){ 
    if (window.XMLHttpRequest) { // Mozilla, Safari,... 
        http_request = new XMLHttpRequest(); 
        if (http_request.overrideMimeType) { 
            http_request.overrideMimeType('text/xml'); 
    } 
        } else if (window.ActiveXObject) { // IE 
            try { 
                http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
            } catch (e) { 
                try { 
                    http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
                } catch (e) {} 
            } 
        } 
    if (!http_request) { 
        alert('Helaas, jouw browser is te oud om deze pagina te kunnen laden.'); 
        return false; 
    } 
        http_request.open('GET', url, true); 
        http_request.send(null); 
}

function getField(fldName, strType) {
  var arrCheck = new Array;
  var blnFound = false;
  arrObjects = document.getElementsByTagName(strType.toUpperCase());

  for (i=0; i<arrObjects.length; i++) {
    if (arrObjects[i].id.split("_")[arrObjects[i].id.split("_").length - 1] == fldName) {
      blnFound = true;
      break;
    }
  }
	
  return arrObjects[i];
}

function PopUp(strPath) {
    window.open(strPath, 'WMSPOPUP', 'status=yes,resizable=yes,width=1024,height=764');
}

function MailTo(value) {
   if (value) {
		 var strTemp='';
		 for (i = value.length-1; i>=0; i--){
			 strTemp+=value.charAt(i);
		 }
		 strTemp = strTemp.split('|').join('@');
		 document.write('<a href=mailto:' + strTemp + '>' + strTemp + '</a>');
	 }
}

function MouseoverBackground(temp){ 
    var button = temp.firstChild.firstChild.firstChild.firstChild.childNodes;
    
    for(var i=0;i<button.length;i++)
    {   
        var element = button[i];
        var imageUrl = element.style.backgroundImage;
        if(imageUrl!==""){
            imageUrl = imageUrl.split("1.");
            var imgString = imageUrl[0];
            var ext = imageUrl[1];
            element.style.backgroundImage = imgString + "2." + ext;
        }
        else
        {
            element.style.color = "#881769";
            element.style.backgroundColor = "#ffffff";
        }
    }       
}
function MouseoutBackground(temp){
    var button = temp.firstChild.firstChild.firstChild.firstChild.childNodes;
    
    for(var i=0;i<button.length;i++)
    {   
        var element = button[i];
        var imageUrl = element.style.backgroundImage;
        if(imageUrl!==""){
            imageUrl = imageUrl.split("2.");
            var imgString = imageUrl[0];
            var ext = imageUrl[1];
            element.style.backgroundImage = imgString + "1." + ext;
        }
        else
        {
            element.style.color = "#ffffff";
            element.style.backgroundColor = "#881769";
        }
    }
}
function ClickMe(id, url){
    if (navigator.appName == "Netscape"){
        location.replace(url);
    
    } else {
        id.firstChild.focus();
        id.firstChild.click();
    }
}
function Mouseover(temp) {
    temp.style.backgroundColor = "#881769";
    temp.firstChild.style.color = "#ffffff";
}
function Mouseout(temp) {
    temp.style.backgroundColor = "transparent";
    temp.firstChild.style.color = "#881769";
}
function SetHeight(temp) {
    var id = document.getElementById("SubMenu");
    if(id.childNodes[id.childNodes.length - 1].clientHeight>0) {
        id.childNodes[0].style.height = id.childNodes[id.childNodes.length - 1].clientHeight + "px";
    }
    var html = document.getElementById("html");
    var SetHeight = document.getElementById("SetHeight");
    var RoundedBottom = document.getElementById("RoundedBottom");
    var RequireHeight = document.getElementById("RequireHeight");
    var MainPanel = document.getElementById("MainPanel");
    var StretchHeight = document.getElementById("StretchHeight");
    var HomeMainBackground = document.getElementById("HomeMainBackground");
    var HomeMainBackgroundFiller = document.getElementById("HomeMainBackgroundFiller");
    var HomeMainBackgroundBottom = document.getElementById("HomeMainBackgroundBottom");
    var HomeMainBackgroundTop = document.getElementById("HomeMainBackgroundTop");
    var NieuwsText = document.getElementById("NieuwsText");
    var MoveUp = document.getElementById("MoveUp");
    var ContentText = document.getElementById("ContentText");
    var varHeight = document.getElementById("varHeight");
    var ContentImage = document.getElementById("ContentImage");
    var DonwloadsSection = document.getElementById("DonwloadsSection");
    var LengthToHigh = false;
    var HomeMainRightInner = document.getElementById("HomeMainRightInner");
    
    var PersBottomLeft = document.getElementById("PersBottomLeft");
    var PersBottomRight = document.getElementById("PersBottomRight");

    var unexplainableHeight = 164;
    
    var OldHeight = 314
    var OldStretchHeight = 244
    var OldContentHeight = 270
    
    if(navigator.userAgent.indexOf("Opera")!=-1) {
        if (RoundedBottom.clientHeight > (document.documentElement.clientHeight - 11)) {
            SetHeight.style.height = 0 + "px";
            LengthToHigh = true;
        }
        else {
            SetHeight.style.height = window.innerHeight - RoundedBottom.clientHeight - 11 + "px";
        }
        if(MainPanel!==null) {
            if(StretchHeight!==null) {
                if (document.documentElement.clientHeight < (RoundedBottom.clientHeight + RequireHeight.clientHeight + 66)) {
                    MainPanel.style.height = 0 + "px"
                }
                else {
                    MainPanel.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight - RequireHeight.clientHeight - 66 + "px" ;
                }
                if(MainPanel.clientHeight <= OldHeight) {
                    MainPanel.style.height = OldHeight;
                }
                HomeMainBackgroundFiller.style.height = MainPanel.clientHeight - HomeMainBackgroundBottom.clientHeight - HomeMainBackgroundTop.clientHeight + 0 + "px";
                StretchHeight.style.height = MainPanel.clientHeight - 58;
                if(StretchHeight.clientHeight <= OldStretchHeight) {
                    StretchHeight.style.height = OldStretchHeight;
                }
                if(NieuwsText!==null) {
                    var NieuwsMainTitle = document.getElementById("NieuwsMainTitle");
                    NieuwsText.style.height = HomeMainBackground.clientHeight - NieuwsMainTitle.clientHeight - 25 + "px";
                    NieuwsText.style.display = "block";
                    NieuwsText.style.overflow = "auto";
                }
                if(MoveUp!==null) {
                    MoveUp.style.height = HomeMainBackground.clientHeight;
                }
                if(HomeMainRightInner!==null) {
                    HomeMainRightInner.style.height = MoveUp.clientHeight - 19;
                }
            }
        }
        if(varHeight!==null) {
            varHeight = varHeight.scrollHeight;
        }
        else {
            varHeight = 0;
        }
        if(ContentText!==null) {
            if (ContentImage!==null){
                unexplainableHeight = unexplainableHeight + ContentImage.clientHeight - 20;
            }
            ContentText.style.height = SetHeight.clientHeight - unexplainableHeight - varHeight + "px";
            ContentText.style.overflow = "auto";
        }
        if(body.clientHeight>=640) {
            html.style.overflow = "hidden";
        }
        else {
            html.style.overflow = "auto";
        }
        if (DonwloadsSection!==null) {
            DonwloadsSection.style.bottom = "70px";
        }
        var EmptyDiv = document.getElementById("mod_nieuwsbrief_36_pnlSignup");
        if (EmptyDiv) {
            ContentText.style.height = parseInt(ContentText.style.height, 10) - 50 + "px"
        }
    }
    else if(navigator.userAgent.indexOf("Firefox")!=-1) {
        if (RoundedBottom.clientHeight > (document.documentElement.clientHeight)) {
            SetHeight.style.height = 0 + "px";
        }
        else {
            SetHeight.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight + "px";
        }
        if(MainPanel!==null) {
            if(StretchHeight!==null) {
                if (document.documentElement.clientHeight < (RoundedBottom.clientHeight + RequireHeight.clientHeight + 56)) {
                    MainPanel.style.height = 0 + "px"
                }
                else {
                    MainPanel.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight - RequireHeight.clientHeight - 56 + "px" ;
                }  
                if(MainPanel.clientHeight <= OldHeight) {
                    MainPanel.style.height = OldHeight + "px";
                }
                
                HomeMainBackgroundFiller.style.height = MainPanel.clientHeight - HomeMainBackgroundBottom.clientHeight - HomeMainBackgroundTop.clientHeight - 18 + "px";
                StretchHeight.style.height = MainPanel.clientHeight - 78 + "px";
                if(StretchHeight.clientHeight <= OldStretchHeight) {
                    StretchHeight.style.height = OldStretchHeight + "px";
                }
                if(NieuwsText!==null) {
                    var NieuwsMainTitle = document.getElementById("NieuwsMainTitle");
                    NieuwsText.style.height = HomeMainBackground.clientHeight - NieuwsMainTitle.clientHeight - 25 + "px";
                    NieuwsText.style.display = "block";
                }
                if(MoveUp!==null) {
                    MoveUp.style.height = HomeMainBackground.clientHeight;
                }
                if(HomeMainRightInner!==null) {
                    HomeMainRightInner.style.height = MoveUp.clientHeight - 55 + "px";
                }
            }
        }
        if(varHeight!==null) {
            varHeight = varHeight.scrollHeight;
        }
        else {
            varHeight = 0;
        }
        if(ContentText!==null) {
            if (ContentImage!==null){
                unexplainableHeight = unexplainableHeight + ContentImage.clientHeight - 20;
            }
            ContentText.style.height = SetHeight.clientHeight - unexplainableHeight - varHeight + "px";
        }
        if(html.clientHeight>=640) {
            html.style.overflow = "hidden";
        }
        else {
            html.style.overflow = "auto";
        }
        if(PersBottomLeft!==null){
            PersBottomLeft.style.marginLeft = "-1px";
        }
        if(PersBottomRight!==null){

        }
        var EmptyDiv = document.getElementById("mod_nieuwsbrief_36_pnlSignup");
        if (EmptyDiv) {
            ContentText.style.height = parseInt(ContentText.style.height, 10) - 50 + "px"
        }
    }
    else if(navigator.userAgent.indexOf("Safari")!=-1) {
        if (RoundedBottom.clientHeight > (document.documentElement.clientHeight - 39)) {
            SetHeight.style.height = 0 + "px";
        }
        else {
            SetHeight.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight - 39 + "px";
        }
        if(MainPanel!==null) {
            if(StretchHeight!==null) {  
                if (document.documentElement.clientHeight < (RoundedBottom.offsetHeight + RequireHeight.offsetHeight + 82)) {
                    MainPanel.style.height = 0 + "px"
                }
                else {
                    MainPanel.style.height = document.documentElement.clientHeight - RoundedBottom.offsetHeight - RequireHeight.offsetHeight - 82 + "px" ;
                }             
                if(MainPanel.style.height.split("px")[0] <= OldHeight) {
                    MainPanel.style.height = OldHeight + "px";
                }
                
                HomeMainBackgroundFiller.style.height = MainPanel.style.height.split("px")[0] - HomeMainBackgroundBottom.offsetHeight - HomeMainBackgroundTop.offsetHeight + "px";
                StretchHeight.style.height = MainPanel.style.height.split("px")[0] - 58 + "px";
                if(StretchHeight.style.height.split("px")[0] <= OldStretchHeight) {
                    StretchHeight.style.height = OldStretchHeight + "px";
                }
                if(NieuwsText!==null) {
                    var NieuwsMainTitle = document.getElementById("NieuwsMainTitle");
                    NieuwsText.style.height = HomeMainBackground.clientHeight - NieuwsMainTitle.clientHeight - 25 + "px";
                    NieuwsText.style.display = "block";
                }
                if(MoveUp!==null) {
                    MoveUp.style.height = HomeMainBackground.clientHeight + "px";
                }
                if(HomeMainRightInner!==null) {
                    HomeMainRightInner.style.height = MoveUp.clientHeight - 18 + "px";
                }
            }
        }
        if(varHeight!==null) {
            varHeight = varHeight.scrollHeight;
        }
        else {
            varHeight = 0;
        }
        if(ContentText!==null) {
            if (ContentImage!==null){
                unexplainableHeight = unexplainableHeight + ContentImage.clientHeight - 20;
            }
            ContentText.style.height = SetHeight.clientHeight - unexplainableHeight - varHeight + "px";
        }
        if(html.clientHeight>=640) {
            html.style.overflow = "hidden";
        }
        else {
            html.style.overflow = "auto";
        }
        if(PersBottomLeft!==null){
            
        }
        if(PersBottomRight!==null){
            PersBottomRight.style.marginLeft = "0px";
        }
        if (DonwloadsSection!==null) {
            DonwloadsSection.style.bottom = "75px";
        }
        var EmptyDiv = document.getElementById("mod_nieuwsbrief_36_pnlSignup");
        if (EmptyDiv) {
            ContentText.style.height = parseInt(ContentText.style.height, 10) - 50 + "px"
        }
    }
    else {
        if (RoundedBottom.clientHeight > document.documentElement.clientHeight) {
            SetHeight.style.height = 0 + "px";
        }
        else {
            SetHeight.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight + "px";
        }
        if(MainPanel!==null) {
            if(StretchHeight!==null) {
                if (document.documentElement.clientHeight < (RoundedBottom.clientHeight + RequireHeight.clientHeight + 56)) {
                    MainPanel.style.height = 0 + "px"
                }
                else {
                    MainPanel.style.height = document.documentElement.clientHeight - RoundedBottom.clientHeight - RequireHeight.clientHeight - 56 + "px" ;
                }
                if(MainPanel.clientHeight <= OldHeight) {
                    MainPanel.style.height = OldHeight;
                }
                HomeMainBackgroundFiller.style.height = MainPanel.clientHeight - HomeMainBackgroundBottom.clientHeight - HomeMainBackgroundTop.clientHeight - 18 + "px";
                StretchHeight.style.height = MainPanel.clientHeight - 80;
                if(StretchHeight.clientHeight <= OldStretchHeight) {
                    StretchHeight.style.height = OldStretchHeight;
                }
                
                if(NieuwsText!==null) {
                    var NieuwsMainTitle = document.getElementById("NieuwsMainTitle");
                    NieuwsText.style.height = HomeMainBackground.clientHeight - NieuwsMainTitle.clientHeight - 25 + "px";
                    NieuwsText.style.display = "block";
                }
                if(MoveUp!==null) {
                    MoveUp.style.height = HomeMainBackground.clientHeight;
                }
                if(HomeMainRightInner!==null) {
                    if(navigator.userAgent.indexOf("MSIE 6")!=-1) {
                        HomeMainRightInner.style.height = MoveUp.clientHeight - 40;
                    }
                    else {
                        HomeMainRightInner.style.height = MoveUp.clientHeight - 19;
                    }
                }
            }
        }
        if(varHeight!==null) {
            varHeight = varHeight.scrollHeight;
        }
        else {
            varHeight = 0;
        }
        if(ContentText!==null) {
            if (ContentImage!==null){
                unexplainableHeight = unexplainableHeight + ContentImage.clientHeight - 20;
            }
            ContentText.style.height = SetHeight.clientHeight - unexplainableHeight - varHeight + "px";
        }
        if(html.clientHeight>=640) {
            html.style.overflow = "hidden";
        }
        else {
            html.style.overflow = "auto";
        }
        if(PersBottomLeft!==null){
            
        }
        if(PersBottomRight!==null){

        }
        var EmptyDiv = document.getElementById("mod_nieuwsbrief_36_pnlSignup");
        if (EmptyDiv) {
            ContentText.style.height = parseInt(ContentText.style.height, 10) - 50 + "px"
        }
    }
}
var tempRoot = document.location.href;
var splitRoot = tempRoot.split("/");
var root = splitRoot[0] + '/' + splitRoot[1] + '/' + splitRoot[2] + '/' + splitRoot[3] + '/';
var checkRoot = root.split("tenraede");
if (checkRoot[1] !== undefined) {
    root = root;
}
else {
    root = splitRoot[0] + '/' + splitRoot[1] + '/' + splitRoot[2] + '/';
}
function oN(wat) { //0.01 alpha
  var strNieuwsbrief = new String;
  strNieuwsbrief = root + 'nieuwsbrief.aspx?id=' + wat;
  objNieuwswindow = window.open(strNieuwsbrief,null,"width=615,height=760,scrollbars=1,status=1,resizable=1");
  objNieuwswindow.focus();
}

function oNDetails(wat) { //0.01 alpha
  var strNieuwsbrief = new String;
  strNieuwsbrief = root + 'nieuwsbrief.aspx?detailid=' + wat;
  objNieuwswindow = window.open(strNieuwsbrief,null,"width=615,height=760,scrollbars=1,status=1,resizable=1");
  objNieuwswindow.focus();
}
function PopupWindow(url) 
{
	windowprops = "left=450,top=350,width=353,height=317,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,status=yes";
	ChildWin = this.open(url, "ChildWin", windowprops);
}
var TimeToRead = 5000;
var blankFaded = false;
function setNewsRotator()
{
    var blankItem = document.getElementById("blankItem");
    var ticker = document.getElementById('ticker');
    if ((blankItem!==null)&&(blankFaded==false)) {
        blankItem.style.zIndex = '0';
        Effect.Fade(blankItem.id);
        blankFaded = true;
    }
    if (ticker!==null) {
        if (ticker.childNodes.length > 0) {
            var j = 0;
            var IsFinished = false;
            var temp1 = 0;
            var temp2 = 0;
            if((navigator.userAgent.indexOf("Opera")!=-1)||(navigator.userAgent.indexOf("Firefox")!=-1)||(navigator.userAgent.indexOf("Safari")!=-1)) {
                temp1 = 1;
                temp2 = 2;
            }
                for(var i = temp1; i < document.getElementById("ticker").childNodes.length - (1 + temp2); i+=2) {
                    setTimeout('document.getElementById("ticker").childNodes[' + i + '].style.zIndex=5; Appear("' + i + '");', TimeToRead * j);
                    if((navigator.userAgent.indexOf("Opera")!=-1)||(navigator.userAgent.indexOf("Firefox")!=-1)||(navigator.userAgent.indexOf("Safari")!=-1)) {
                        temp = (TimeToRead * j) + TimeToRead;
                    }
                    else {
                        temp = (TimeToRead * j) + TimeToRead;
                    }
                    
                    setTimeout('document.getElementById("ticker").childNodes[' + i + '].style.zIndex=0; Fade("' + i + '");', temp);
                    
                    if(i + (2 + temp2) >= document.getElementById("ticker").childNodes.length - 1){ 
                        IsFinished = true;
                    }
                    j++;
                }
            if (IsFinished) {
                setTimeout('setNewsRotator()', (TimeToRead * j));
            }
        }
    }
}

function Fade(i) {
    element = document.getElementById("ticker").childNodes[i];
    Effect.Fade(element.id);
}
function Appear(i) {     
    element = document.getElementById("ticker").childNodes[i];
    Effect.Appear(element.id);
}

