/* 
WMS Lucrasoft Javascript Standaard functies
*/
var tempRoot = document.location.href;
var splitRoot = tempRoot.split("/");
var root = splitRoot[0] + '/' + splitRoot[1] + '/' + splitRoot[2] + '/' + splitRoot[3] + '/';
var checkRoot = root.split("hitt");
if (checkRoot[1] !== undefined) {
    root = root;
}
else {
    root = splitRoot[0] + '/' + splitRoot[1] + '/' + splitRoot[2] + '/';
}

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 ChangeTopMenuItem(menuID) { 
    menuID.firstChild.src = menuID.firstChild.src.replace("_0", "_1");
}
function ChangeBackTopMenuItem(menuID) {
    menuID.firstChild.src = menuID.firstChild.src.replace("_1", "_0");
}
var ShowNewsItems = "ShowNewsItem"
function ChangeMenuItem(menuID) { 
    var elementToHover = menuID.firstChild
    for (var i = 0; i<menuID.childNodes.length;i++) {
        if ((menuID.childNodes[i].className !== undefined)&&(menuID.childNodes[i].className !== "")) {
            if (menuID.childNodes[i].className == ShowNewsItems) {
                elementToHover = menuID.childNodes[i]
            }
        }
    }
    elementToHover.className = elementToHover.className + "Hover";
}
function ChangeBackMenuItem(menuID) {
    var elementToHover = menuID.firstChild
    for (var i = 0; i<menuID.childNodes.length;i++) {
        if ((menuID.childNodes[i].className !== undefined)&&(menuID.childNodes[i].className !== "")) {
            if (menuID.childNodes[i].className == (ShowNewsItems + "Hover")) {
                elementToHover = menuID.childNodes[i]
            }
        }
    }
    elementToHover.className = elementToHover.className.substring(0, elementToHover.className.indexOf("Hover"));
}
function ImageHover(ImageLink) {
    if (ImageLink.firstChild.src !== undefined) {
        ImageLink.firstChild.src = ImageLink.firstChild.src.replace("_0", "_1");
    }
}
function ImageLink(ImageLink) {
    if (ImageLink.firstChild.src !== undefined) {
        ImageLink.firstChild.src = ImageLink.firstChild.src.replace("_1", "_0");
    }
}

