
function FillDropDownList(text, arr, data, script) {
// alert('arr[0]:'+arr[0]+';'); // arr bevat een array gesplitst op de comma
// alert('arr[1]:'+arr[1]+';');
// alert('text:'+text+';'); // text bevat alle teruggekomen html of tekst
// alert('data:'+data+';'); // data bevat de waarde van data die aan Load() is meegegeven, zodat deze ook in de Handler gebruikt kan worden. (Tip::Indien je meerdere waarden aan de handler mee wilt geven doe dit dan door een array van data te maken.)
// alert('script:'+script+';'); // Indien er in de teruggekomen html een script tag staat wordt de inhoud daarvan (bij meerdere script tags alleen de eerste) in de script variabele gezet, zodat je deze middels een eval kunt uitvoeren.

   lbx = document.getElementById(data);
   while (lbx.options.length > 0) {
      lbx.options[0] = null;
   }

 	for (i=0;i<arr.length;i++) {
  	 	// alert(arr[i]);
	 	parts = arr[i].split(":");
	 	lbx.options[lbx.options.length] = new Option(parts[1],parts[0]);
	 	if (parts[2] == "1")
	 		lbx.options[lbx.options.length-1].selected = true;
	}
	lbx.disabled = (arr.length == 0);
	lbx.selectedIndex = 0;
	if (lbx.idtextfield) 
	   lbx.idtextfield.value=lbx.value;
}


function UpdateDropDownList(idname,id,url,DropDownList) {
   //ajaxGetDropDownListValues.setUrl(url);
   ajaxGetDropDownListValues.Load(url,idname+'='+escape(id),"GET",DropDownList)
}

function UpdateDropDownListBackstage(useridname,userid,rolename,role,idname,id,url,DropDownList) {
   //ajaxGetDropDownListValues.setUrl(url);
   ajaxGetDropDownListValues.Load(url,useridname+'='+escape(userid)+'&'+rolename+'='+escape(role)+'&'+idname+'='+escape(id),"GET",DropDownList)
}

function InitDropDownList(DropDownList,idtextfield) {
   lbx = document.getElementById(DropDownList);
   lbx.idtextfield = document.getElementById(idtextfield);
   lbx.idtextfield.value=lbx.value;
//   if (lbx.options.length == 0)
//      lbx.disabled = true;
}

ajaxGetDropDownListValues = new AjaxObject('ajaxGetDropDownListValues', 'xxxx.html', 'FillDropDownList');




function FillInputField(text, arr, data, script) {
   fld = document.getElementById(data);
   if (fld)
      fld.value = arr[0];
}

function UpdateInputField(idname,id,url,inputfield) {
   //ajaxGetInputFieldValue.setUrl(url);
   ajaxGetInputFieldValue.Load(url,idname+'='+escape(id),"GET",inputfield)
}

ajaxGetInputFieldValue = new AjaxObject('ajaxGetInputFieldValue', 'xxxx.html', 'FillInputField');






function ShowContactInfo(text, arr, data, script) {
   //alert(arr);
   str = ""; 
   for (i=0;i<arr.length;i++) {
       if (i > 0) 
          str += ",";
      str += arr[i];
   }
   parts = str.split("|");
   if (parts.length == 5) { 
      // Name 
      ajaxGetContactInfo.lnkName.href="Persons_ShowProfile.aspx?id="+parts[0]
      ajaxGetContactInfo.lnkName.innerHTML = parts[1];
      // Province, country
      ajaxGetContactInfo.lblCountry.innerHTML = parts[2];
      // Thumbnail
      ajaxGetContactInfo.imgThumb.src = parts[3];
      // Catchline 
      ajaxGetContactInfo.lblCatchline.innerHTML = parts[4];
      //document.getElementById("divContactInfo").innerHTML = arr[0];
	  document.getElementById("divContactInfo").style.display = "block";
	  ajaxGetContactInfo.btnSend.disabled = false;
	}
	else {
	  document.getElementById("divContactInfo").style.display = "none";
	  ajaxGetContactInfo.btnSend.disabled = true;
	}
}



function GetContactInfo(id) {
   //alert ("get url: " +ajaxGetContactInfo.url + ", ID = "+id);
   ajaxGetContactInfo.Load(ajaxGetContactInfo.url,'ind_id='+escape(id),"GET")
}

function InitGetContactInfo(btnSend,ddlContacts,imgThumb,lnkName,lblCountry,lblCatchline,url) { 
   if (document.getElementById(ddlContacts)) {
 // alert("init");
      ajaxGetContactInfo = new AjaxObject('ajaxGetContactInfo', 'xxxx.html', 'ShowContactInfo');
      document.getElementById("divContactInfo").style.display = "none";
      ajaxGetContactInfo.btnSend = document.getElementById(btnSend);
      ajaxGetContactInfo.imgThumb = document.getElementById(imgThumb);
      ajaxGetContactInfo.lnkName = document.getElementById(lnkName);
      ajaxGetContactInfo.lblCountry = document.getElementById(lblCountry);
      ajaxGetContactInfo.lblCatchline = document.getElementById(lblCatchline);
      ajaxGetContactInfo.setUrl(url);
  
      ajaxGetContactInfo.ddlContacts = document.getElementById(ddlContacts);
      if (ajaxGetContactInfo.ddlContacts.selectedIndex > 0) {
         GetContactInfo(ajaxGetContactInfo.ddlContacts.value);
      }
      ajaxGetContactInfo.btnSend.disabled = (ajaxGetContactInfo.ddlContacts.selectedIndex == 0)
   }
   else {
      document.getElementById("divContactInfo").style.display = "block";
      //alert ("no dllContacts");
  }
} 



/* ================= Pim 2006-10-03 : Good for you! Findout! ((homepage)) ===================*/
function ShowFindoutInfo(text, arr, data, script) {
   
   if (text != "") { 
	  document.getElementById("divFindoutInfo").innerHTML =text;
	  document.getElementById("divFindoutInfo").style.display = "block";
	  document.getElementById("divFindoutInfoArea").style.display = "block";
	  document.getElementById("divFindoutInfoLists").style.display = "none";
	  /*document.images["ICStats"].src = "http://www.icstats.nl/asp/icstats.asp?siteID=260572&amp;p=" + data ;*/
	}
	else {
	  document.getElementById("divFindoutInfo").style.display = "none";
	  document.getElementById("divFindoutInfoArea").style.display = "none";
	  document.getElementById("divFindoutInfoLists").style.display = "block";
	  /*document.images["ICStats"].src = "http://www.icstats.nl/asp/icstats.asp?siteID=260572&amp;p=9"  ;*/
	  
	}
}

function GetFindoutInfo(id,idstat) {
   
   ajaxGetFindoutInfo.Load(ajaxGetFindoutInfo.url,'findout_id='+escape(id),"GET",idstat)
}

function InitGetFindoutInfo(url) { 
   ajaxGetFindoutInfo = new AjaxObject('ajaxGetFindoutInfo', url , 'ShowFindoutInfo');
   document.getElementById("divFindoutInfo").style.display = "none";
   document.getElementById("divFindoutInfoArea").style.display = "none";
} 

function BackToFindout() 
{
	document.getElementById("divFindoutInfo").style.display = "none";
	document.getElementById("divFindoutInfoArea").style.display = "none";
	document.getElementById("divFindoutInfoLists").style.display = "block";
	/*document.images["ICStats"].src = "http://www.icstats.nl/asp/icstats.asp?siteID=260572&amp;p=9"  ;*/
	
	
}
/* =============== CLOSE 2006-10-03 : Good for you! Findout! ((homepage)) ================*/












function FillDropDownList2(text, arr, data, script) {
// alert('arr[0]:'+arr[0]+';'); // arr bevat een array gesplitst op de comma
// alert('arr[1]:'+arr[1]+';');
// alert('text:'+text+';'); // text bevat alle teruggekomen html of tekst
// alert('data:'+data+';'); // data bevat de waarde van data die aan Load() is meegegeven, zodat deze ook in de Handler gebruikt kan worden. (Tip::Indien je meerdere waarden aan de handler mee wilt geven doe dit dan door een array van data te maken.)
// alert('script:'+script+';'); // Indien er in de teruggekomen html een script tag staat wordt de inhoud daarvan (bij meerdere script tags alleen de eerste) in de script variabele gezet, zodat je deze middels een eval kunt uitvoeren.


   var lbx = document.getElementById(data[0]);
   //alert("filling "+lbx.id+", "+lbx.hiddenIdField.id +"="+ lbx.hiddenIdField.value);
   while (lbx.options.length > 0) {
      lbx.options[0] = null;
   }
	//alert(text);
	//alert(arr[0]);
	if (text != "" && typeof(arr[0]) != "undefined") { 
 		for (var i=0;i<arr.length;i++) {
  	 		// alert(arr[i]);
	 		var parts = arr[i].split(":");
	 		lbx.options[lbx.options.length] = new Option(parts[1],parts[0]);
	 		if (parts[2] == "1") 
	 			lbx.options[lbx.options.length-1].selected = true;
	 		else if (lbx.hiddenIdField) {
		//alert("checking "+lbx.id+", "+lbx.hiddenIdField.value +"="+ parts[0]);
	 			if (lbx.hiddenIdField.value == parts[0]) {
	 				lbx.options[lbx.options.length-1].selected = true;
	 				//alert("selecting "+lbx.id+", "+lbx.hiddenIdField.id +"="+ lbx.hiddenIdField.value);
	 			}
	 		}
		}
	}
	if (lbx.childLbx) {
	    if (data[1] == 0) {
		   lbx.childLbx.hiddenIdField.value=0;
		   UpdateDropDownList2(lbx.value,lbx.childLbx.id)
		}
		else 
	 	   ReloadDropDownList2(lbx.value,lbx.childLbx.id)

//		if (lbx.selectedIndex == 0) { 
//		   lbx.childLbx.hiddenIdField.value=0;
//	       alert("update child "+lbx.value+","+lbx.childLbx.id);
//	    } 
	} 
	lbx.disabled = (arr.length == 0);
	//lbx.selectedIndex = 0;
	if (lbx.hiddenIdField) 
	   if (lbx.selectedIndex == 0) 
	      lbx.hiddenIdField.value=0;
//	if (lbx.hiddenIdField)
//	    lbx.hiddenIdField.value=lbx.value;

//	if (lbx.selectedIndex == 0) 
//	   lbx.hiddenIdField.value=lbx.value;


	//alert ("setting "+lbx.hiddenIdField.id+" = "+lbx.value);
}

function ReloadDropDownList2(id,dropDownList) {
	// update dropdownlist. 
   var lbx = document.getElementById(dropDownList);
   //ajaxGetDropDownListValues2.setUrl(lbx.url);
   ajaxGetDropDownListValues2.Load(lbx.url,lbx.urlParam+'='+escape(id),"GET",new Array(dropDownList,1))
}

function UpdateDropDownList2(id,dropDownList) {
   // update dropdownlist after parent ddl value has changed
   var lbx = document.getElementById(dropDownList);
   if (lbx.hiddenIdField) 
	   lbx.hiddenIdField.value=0;
   //ajaxGetDropDownListValues2.setUrl(lbx.url);
   ajaxGetDropDownListValues2.Load(lbx.url,lbx.urlParam+'='+escape(id),"GET",new Array(dropDownList,0))
}


function InitDropDownList2(dropDownList,hiddenIdField,idname,url,parentDLL) {

   var lbx = document.getElementById(dropDownList);
   lbx.urlParam = idname;
   lbx.url = url; 
   lbx.hiddenIdField = document.getElementById(hiddenIdField);

   if (parentDLL != '') {
      lbx.parentLbx = document.getElementById(parentDLL);
      lbx.parentLbx.childLbx = lbx;
   }
}


ajaxGetDropDownListValues2 = new AjaxObject('ajaxGetDropDownListValues2', 'xxxx.html', 'FillDropDownList2');

function UpdateHiddenIdFromDDL(dropDownList) {
   SetHiddenId(dropDownList.hiddenIdField,dropDownList.value);
} 

function ClearHiddenId(hiddenId) {
	SetHiddenId(hiddenId,0)
} 

function SetHiddenId(hiddenId,value) {
	hiddenId.value = value
} 

function GetHiddenId(hiddenId) {
   if (GetCookie ('LM-'+hiddenId.id) != "")
      value = GetCookie ('LM-'+hiddenId.id)
   else 
      value = 0;
   return value
} 

