/* 
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 makeHttpRequestX(url, target) {
    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;
    }
    var newTime = new Date();
    http_request.open('GET', url + '&t=' + newTime.getTime(), true);
    http_request.send(null);
    http_request.onreadystatechange = function () {
        if (http_request.readyState == 4) {
            target.innerHTML = http_request.responseText;
            var scrOfY = 0;
            if (typeof (window.pageYOffset) == 'number') {
                //Netscape compliant
                scrOfY = window.pageYOffset;
            } else if (document.body && (document.body.scrollTop)) {
                //DOM compliant
                scrOfY = document.body.scrollTop;
            } else if (document.documentElement && (document.documentElement.scrollTop)) {
                //IE6 standards compliant mode
                scrOfY = document.documentElement.scrollTop;
            }
            document.getElementById('divWheelPopUp').style.top = scrOfY + 50 + 'px'
            document.getElementById('divWheelPopUp').style.display = 'block';
        }
    }
}

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 Close(p_strID) {
    var objClose = document.getElementById(p_strID);
    if (objClose) {
        objClose.style.display = 'none'
    }
}


function tbTxtFocus(tb, msg) {
    tb.value = '';
}

function tbTxtBlur(tb, msg) {
    if (tb.value == '') {
        tb.value = msg;
    }
}

function btnCarDesc_Click(p_strProductNameID, p_strCar) {
    document.getElementById(p_strProductNameID).style.display = 'none';
    document.getElementById(p_strCar).focus();
}

function tbCar_Blur(p_strProductNameID) {
    document.getElementById(p_strProductNameID).style.display = 'block';
}
