/* 
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 Expand(obj) {
    expander = obj;
    
    var expander = expander.id;
    var exp = "maincat_";
    var number = expander.substring(exp.length, expander.length);
    
    var expfield = document.getElementById("subcats_" + number);
    var CurrentDisplay = "";
    
    if (window.getComputedStyle) {
        CurrentDisplay = window.getComputedStyle(expfield, "").display;
    }
    else if (expfield.currentStyle) {
        CurrentDisplay = expfield.currentStyle.display;
    }
    
    if(CurrentDisplay!=="block") {
        expfield.style.display = "block";
    }
    else{
        expfield.style.display = "none";
    }
}

function GoTo(URL) {
    setTimeout('window.location = "' + URL + '"', 1500);
}

function OpenImage(ProductID) {
    var Root = location.protocol + "//" + location.host + "/"
    
    if((location.host.indexOf("ntlucra") > -1)||(location.host.indexOf("kantoor.lucrasoft") > -1)) {
        Root += "alcom/";
    }
    window.open(Root + 'productimage.aspx?id=' + ProductID + '','_blank','toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars=0,resizable=1');
}
