var ciSearchArray=new Array();

// JavaScript Document
function zoekci(queryZoekWoord, queryType, queryPaginaHuidig) {
	document.getElementById('ajax_queryzoekitem').value				=	queryZoekWoord
	document.getElementById('ajax_queryType').value					=	queryType
	document.getElementById('ajax_queryPaginaHuidig').value			=	queryPaginaHuidig

	// CHECKEN OF DROPBOXEN AANWEZIG ZIJN
	if (document.getElementById("CI_contentpaneel_footer") != null) {
		document.getElementById('CI_zoeken_paginanummer_top').value		=	queryPaginaHuidig
		document.getElementById('CI_zoeken_paginanummer_bottom').value	=	queryPaginaHuidig
	}
	if (isNaN(queryZoekWoord)) {
	document.getElementById('CI_zoeken_zoekitem').value			=	queryZoekWoord
	}
	ajaxPlaatsMarker()
	ajaxToonResultaat()
}

function zoekcifront(queryZoekWoord, queryType, ajax_queryExtraInstructie, queryPaginaHuidig) {
	if(queryZoekWoord == "") {
		queryZoekWoord = document.getElementById('CI_zoeken_zoekitem');
	}
	if(queryZoekWoord == "") {
		queryZoekWoord = "exact";
	}
	urlToGo = "index.php?ajax_queryzoekitem=" + queryZoekWoord + "&ajax_querytype=" + queryType + "&ajax_queryPaginaHuidig=0&field=" + ajax_queryExtraInstructie + "&manual=true"
//	alert(urlToGo)
	document.location.href=urlToGo;
	//document.getElementById('ajax_queryzoekitem').value			=	queryZoekWoord
	//document.getElementById('ajax_queryType').value					=	queryType
	//document.getElementById('ajax_queryPaginaHuidig').value			=	queryPaginaHuidig
	//document.getElementById('CI_zoeken_paginanummer_top').value		=	queryPaginaHuidig
	//document.getElementById('CI_zoeken_paginanummer_bottom').value	=	queryPaginaHuidig
	//if (isNaN(queryZoekWoord)) {
	//document.getElementById('CI_zoeken_zoekitem').value			=	queryZoekWoord
	//}
}
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function getMultipleSelect(ob)
{
    selected = new Array();
    for (var i = 0; i < ob.options.length; i++)
        if (ob.options[ i ].selected) selected.push(ob.options[ i ].value);
    return selected;
}

function get_check_value(box)
{
c_value = new Array();
for (var i=0; i < box.length; i++)
   {
   if (box[i].checked)
      {
       c_value.push(box[i].value) ;
      }
   }
   return c_value;
}

function checkAllBoxes()
{
	for (var i=0;i<document.form1.elements.length;i++)
	{
		var e=document.form1.elements[i];
		if ((e.name == 'categorie') && (e.type=='checkbox'))
		{
			e.checked=document.form1.checkallcat.checked;
		}
	}
}
function uncheckAllBoxes()
{
	if(document.form1.exclusive.checked) test=false;else test=true;
        for (var i=0;i<document.form1.elements.length;i++)
	{
		var e=document.form1.elements[i];
		if ((e.name == 'categorie') && (e.type=='checkbox'))
		{
			e.checked=test;
		}
	}
        document.form1.checkallcat.checked=test;
}

function ClickedAllWithList(form,strName) {
            var blnSet=form["all_photographer"].checked;
            var objList = form[strName];
            for (i=0; i<objList.options.length; i++)
                    objList.options[i].selected = blnSet;
    }
function onChooseDateSearchType(oSource) {
		switch(oSource.value) {
			case "pre_defined":
				toggleDateEditField(true);
				toggleDropDownField(false);
				break;
			case "user_defined":
				toggleDateEditField(false);
				toggleDropDownField(true);
				break;
		}
	}

	function toggleDropDownField(blnDisabled) {
		var arrElements = document.getElementsByTagName("select")

		for (var i=0;i<arrElements.length;i++) {
			var oTemp = arrElements[i];

			if (oTemp.id == "period_search") {
				var oTemp = oTemp;

				if (oTemp != null)
					oTemp.disabled = blnDisabled;
				if (blnDisabled)
					oTemp.selectedIndex = 0;
			}
		}
	}

	function toggleDateEditField(blnDisabled) {
		var arrElements = document.getElementsByTagName("input")

		for (var i=0;i<arrElements.length;i++) {
			var oTemp = arrElements[i];

			if (oTemp.id == "startdate" || oTemp.id == "enddate" || oTemp.id == "year") {
				if (oTemp != null)
					oTemp.disabled = blnDisabled;
				if (blnDisabled)
                                {
                                    if(oTemp.id == "year") oTemp.value="2010"
                                    else oTemp.value ='dd-mm';
                                }
			}
		}
	}

function zoekenadv(form) {errmsg="";
        queryZoekWoord=form.search_keyword.value;
        searchField=form.selectSearchField.value;
        date_search=getCheckedValue(form.elements["date_search"]);
        if(date_search=='pre_defined')
        {
            period_search=form.period_search.value;
            searchDate='&period_search='+period_search
        }
        else if(date_search=='user_defined')
        {
            startdate=form.startdate.value;
            enddate=form.enddate.value;
            year=form.year.value;
            searchDate='&startdate='+startdate+'&enddate='+enddate+'&year='+year
        }
        categorie=get_check_value(form.elements["categorie"]);
        city=form.city.value;
        image_id=form.image_id.value;
        source=getMultipleSelect(form.elements["source"]);
        orientation=getCheckedValue(form.elements["orientation"]);
        exclusive=form.exclusive.checked;
        per_page=getCheckedValue(form.elements["per_page"]);
        if(per_page!='') queryPaginaAantalItems=per_page;
        //alert(form.elements["new_old"].toSource());
        sort_type=getCheckedValue(form.elements["new_old"]);
		
        if(image_id=="")
        {
            if(queryZoekWoord=="") errmsg+="ZoekWoord is required\n";
            if(categorie=="") errmsg+="Categorie is required";
        }
        if(errmsg!="") {alert(errmsg);return false;}
        //alert('cat='+categorie+'zoekitem=' + queryZoekWoord + '&action=' + queryType + '&period_search='+ period_search +'&city='+city+'&exclusive='+exclusive+ '&bronnen='+bronnen+'&source='+source+'&sort_type='+sort_type+'&page=' + queryPaginaHuidig + '&perpage=' + queryPaginaAantalItems )
	urlToGo = 'index.php?ajax_queryzoekitem=' + queryZoekWoord + '&ajax_querytype=get_zoekenadvance&searchField='+searchField+'&date_search='+date_search+searchDate+'&categorie='+categorie+'&city='+city+'&image_id='+image_id+'&source='+source+'&orientation='+orientation+'&exclusive='+exclusive + '&sort_type='+sort_type+'&perpage=' + queryPaginaAantalItems+ '&ajax_queryPaginaHuidig=0&manual=true';
	document.location.href=urlToGo;
}


// KOLOMMEN-STRUCTUUR INLEZEN
var colCount = 4;

if (colCount == 3) {
	// 3 kolommen
	var maxCaption = 42; 
	var captionWidth = 235;
	var thumbPaneelHeightEvent = 290;
	var thumbPaneelHeightFoto = 285;
	var thumbPaneelWidth = 255;
	var thumbAfbHeight = 220;
	

} else {
	 // 4 kolommen of anders
	var colCount = 4;
	var maxCaption = 27;
	var captionWidth = 165;
	var thumbPaneelHeightEvent = 245;
	var thumbPaneelHeightFoto = 237;
	var thumbPaneelWidth = 185;
	var thumbAfbHeight = 170;
}

function ajaxToonResultaat() {
                ajax_type="";
		document.getElementById('dimPanelLayer').style.display = 'none';
		queryZoekWoord			=	document.getElementById('ajax_queryzoekitem').value;
		queryTrefwoord	 		= 	document.getElementById('ajax_querytrefwoord').value;
		queryType				=	document.getElementById('ajax_queryType').value;
		queryPaginaHuidig 		= 	document.getElementById('ajax_queryPaginaHuidig').value;
		//queryExtraInstructie	=	document.getElementById('ajax_queryExtraInstructie').value;
		queryPaginaAantalItems 	= 	36
                document.getElementById('ajax_queryPerPage').value = queryPaginaAantalItems;
		try{ajax_type				=	document.getElementById('ajax_type').value;} catch(e){}

        if(queryType=='get_zoekenadvance'){
            searchDate='';
        search_field=document.getElementById('search_field').value;
        date_search=document.getElementById('date_search').value;
        if(date_search=='pre_defined')
        {
            period_search=document.getElementById('period_search').value;
            searchDate='&period_search='+period_search
        }
        else if(date_search=='user_defined')
        {
            startdate=document.getElementById('startdate').value;
            enddate=document.getElementById('enddate').value;
            searchDate='&startdate='+startdate+'&enddate='+enddate;
        }
        categorie=document.getElementById('categorie').value;
        city=document.getElementById('city').value;
        image_id=document.getElementById('image_id').value;
        source=document.getElementById('source').value;
        orientation=document.getElementById('orientation').value;
        exclusive=document.getElementById('exclusive').value;
        sort_type=document.getElementById('sort_type').value;
        queryPaginaAantalItems=document.getElementById('perpage').value;
                document.getElementById('ajax_queryPerPage').value = queryPaginaAantalItems;
		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'zoekitem=' + queryZoekWoord + '&search_field=' + search_field + '&action=' + queryType + '&date_search='+ date_search+searchDate+'&categorie='+ categorie +'&city='+city+'&image_id='+image_id+'&source='+source+'&orientation='+orientation+'&exclusive='+exclusive+'&sort_type='+sort_type+'&page=' + queryPaginaHuidig + '&perpage=' + queryPaginaAantalItems , 'txt')
        }
        else{
		//alert('zoekitem=' + queryZoekWoord + '&action=' + queryType + '&period_search='+ period_search +'&categorie='+ categorie +'&city='+city+'&exclusive'+exclusive+ '&page=' + queryPaginaHuidig + '&perpage=' + queryPaginaAantalItems + '&' + queryExtraInstructie)
		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'zoekitem=' + queryZoekWoord + '&trefwoord=' + queryTrefwoord + '&action=' + queryType + '&ajax_type='+ajax_type+'&page=' + queryPaginaHuidig + '&perpage=' + queryPaginaAantalItems , 'txt')
        }
                var myajaxnew=ajaxpack.ajaxobj
		myajaxnew.onreadystatechange = function() {
			
		if (myajaxnew.readyState == 4){ //if request of file completed
		if (myajaxnew.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			strBestandsnaamBron = myajaxnew.responseText
			//alert(myajaxnew.responseText)
			
			if ((queryType == 'get_zoekenadvance') || (queryType == 'get_fotooverzicht') || (queryType == 'get_eventoverzicht') || (queryType == 'get_lightboxoverzicht')) {
				/////////////////////////////////////////////////////////////
				//
				// STRUCTUUR:
				// <#> foto-afscheiding
				// <|> veldafscheiding
				// Veld 1: `fotos`.`fotos_ID` 			// Foto ID
				// Veld 2: `fotos`.`fotos_date`			// Foto datum
				// Veld 3: `fotos`.`fotos_exclusive`	// Foto exclusief
				// Veld 4: `fotos`.`fotos_caption		// Foto bijschrift
				// Veld 5: `fotos`.`fotos_src`			// Foto thumbnail
				// Veld 6: `event`.`event_ID`			// Event id
				// Veld 7: `event`.`event_event`		// Event naam
				// Veld 8: `event`.`event_exclusive`	// Event exclusief
				// Veld 9: `event`.`event_location`		// Event locatie
				//
				/////////////////////////////////////////////////////////////
				var arrFoto = myajaxnew.responseText.split('<#>')
				document.getElementById("dimPanelLayer").style.display = "none";
				document.getElementById('CI_contentpaneel').innerHTML = '';
				
				// Uitlezen eigenschappen pagina
				var divPaginaEigenschappen = arrFoto[0].split("<|>");
				document.getElementById("CI_contentpaneel_header").innerHTML = '<strong>' + divPaginaEigenschappen[0] + '</strong>';
				document.getElementById('ajax_queryPaginaTotaal').value		=	divPaginaEigenschappen[1]
				document.getElementById('ajax_queryAantalTreffers').value		=	divPaginaEigenschappen[2]
				
				// TONEN PAGINANUMMERS
				ajaxToonPaginaNummering(divPaginaEigenschappen[1],queryPaginaAantalItems);
				
				if ((queryType == 'get_eventoverzicht') || (queryType == 'get_lightboxoverzicht')) { // ALLES BEHALVE IMAGE-OVERZICHT
					// Plaatsen items
					for (var i = 1 ; i < arrFoto.length;i++) {
						var arrFotoDetails = arrFoto[i].split("<|>");
						arrFotoDetails[4] = arrFotoDetails[4].split('_')			.join(" "); 
						arrFotoDetails[5] = arrFotoDetails[5].split('_')			.join(" "); 
						var divThumbInhoud = document.getElementById('tmp_FotoThumbnail').innerHTML
						divThumbInhoud = divThumbInhoud.split('[PATH_THUMBNAIL]')		.join(arrFotoDetails[1] + '&col=' + colCount.toString()); 
						divThumbInhoud = divThumbInhoud.split('%5BPATH_THUMBNAIL%5D')	.join(arrFotoDetails[1] + '&col=' + colCount.toString()); 
						divThumbInhoud = divThumbInhoud.split('[THUMBNAIL_ID]')			.join(arrFotoDetails[1]); 
						divThumbInhoud = divThumbInhoud.split('[THUMBNAIL_HEIGHT]')		.join(thumbAfbHeight); 

						divThumbInhoud = divThumbInhoud.split('[FOTO_DATE]')			.join(arrFotoDetails[2]); 
						if (arrFotoDetails[4].length > maxCaption) {
							divThumbInhoud = divThumbInhoud.split('[CAPTIONSMALL]')		.join(arrFotoDetails[4].substr(0,35) + " (..)"); 
							divThumbInhoud = divThumbInhoud.split('[CUTOFF]')			.join("(..)");
						} else {
							divThumbInhoud = divThumbInhoud.split('[CUTOFF]')			.join("");
						}
	
						divThumbInhoud = divThumbInhoud.split('[CAPTIONSMALL]')			.join(arrFotoDetails[4]);
						divThumbInhoud = divThumbInhoud.split('[CAPTION]')				.join(arrFotoDetails[4]); 
						divThumbInhoud = divThumbInhoud.split('[EVENT_NAME]')			.join(arrFotoDetails[5]); 
						divThumbInhoud = divThumbInhoud.split('[EVENT_LOCATION]')		.join(arrFotoDetails[8]); 
						divThumbInhoud = divThumbInhoud.split('[FOTO_LOCATIEINQUERY]')	.join(arrFotoDetails[9]); 
						if(queryType == 'get_lightboxoverzicht' ) {
							urlDelete = "javascript:zoekci(" + queryZoekWoord + ", 'ajax_delfromlightbox', '&lightboxid=" + queryZoekWoord + "&photoid=" + arrFotoDetails[1] + "'); zoekci(" + queryZoekWoord + ", 'get_lightboxoverzicht', '')"
							divThumbInhoud = divThumbInhoud.split("[FOTO_LIGHTBOXACTION]")	.join("<a href=\"" + urlDelete + "\"><br><img src=\"images/site_art/icon_lightbox_small.png\" width=\"16\" height=\"10\" \ valign=\"absmiddle\" border=\"0\" style=\"margin-left:1px;margin-top:7px;\">&nbsp;Verwijder uit light-box</a>"); 
						} else {
							divThumbInhoud = divThumbInhoud.split('[FOTO_LIGHTBOXACTION]')	.join(""); 
						}
						// arrFotoDetails[3] FOTO EXCLUSIEF
						// arrFotoDetails[7] EVENT EXCLUSIEF
	 
						var divThumbnail = document.createElement('DIV');
						divThumbnail.innerHTML = divThumbInhoud;
						divThumbnail.id='CI_fotothumb';
						divThumbnail.className ='cbb-photo-thumb';
						divThumbnail.position ='absolute';
						divThumbnail.style.width = thumbPaneelWidth.toString() + "px";
						divThumbnail.style.height = thumbPaneelHeightFoto.toString() + "px";

						if (queryType == 'get_lightboxoverzicht') {
							divThumbnail.style.height = '250px';
						}
							
						document.getElementById("CI_contentpaneel").appendChild(divThumbnail);

						// BREEDTE CAPTION INSTELLEN
						document.getElementById("caption_" + arrFotoDetails[1].toString()).style.width=	captionWidth.toString() + "px";

	
						// Toevoegen Exclusive paneel
						if (arrFotoDetails[3] == '1') {
							document.getElementById("isExclusive_" + arrFotoDetails[1]).style.display = "inline";
						}
	
					}
                                            if(queryType == 'get_eventoverzicht')
                                            {
                                                //var divCelebrity = document.createElement('DIV');
                                                //divCelebrity.innerHTML = "<strong><a href=\"index.php?ajax_querytype=get_eventoverzicht&ajax_queryzoekitem=\">"+arrEventDetails[10]+"</a></strong>";
                                                document.getElementById('celebrity_list').innerHTML=divPaginaEigenschappen[3];
                                            }
				} else { // HET BETREFT EEN REGULIER FOTO-OVERZICHT, GROEPEREN IN EVENTS DUS
					//alert("image-overzicht")
					for (var i = 1 ; i < arrFoto.length;i++) {
						var arrEventDetails = arrFoto[i].split("<|>");
						arrEventDetails[4] = arrEventDetails[4].split('_')			.join(" "); 
						arrEventDetails[5] = arrEventDetails[5].split('_')			.join(" "); 
						arrEventDetails[6] = arrEventDetails[6].split('\"')			.join('')
						var divThumbInhoud = document.getElementById('tmp_EventThumbnail').innerHTML
						divThumbInhoud = divThumbInhoud.split('[PATH_THUMBNAIL]').join(arrEventDetails[1] + '&col=' + colCount.toString()); 
						divThumbInhoud = divThumbInhoud.split('%5BPATH_THUMBNAIL%5D').join(arrEventDetails[1] + '&col=' + colCount.toString()); 
						divThumbInhoud = divThumbInhoud.split('[THUMBNAIL_ID]')			.join(arrEventDetails[1]); 
						divThumbInhoud = divThumbInhoud.split('[THUMBNAIL_HEIGHT]').join(thumbAfbHeight); 
						divThumbInhoud = divThumbInhoud.split('[CAPTION_WIDTH]').join(captionWidth); 
						divThumbInhoud = divThumbInhoud.split('%5BCAPTION_WIDTH%5D').join(captionWidth); 

						divThumbInhoud = divThumbInhoud.split('[FOTO_DATE]')		.join(arrEventDetails[2]); 
						if (arrEventDetails[6].length > maxCaption) {
							divThumbInhoud = divThumbInhoud.split('[CAPTIONSMALL]')			.join(arrEventDetails[6]); 
							divThumbInhoud = divThumbInhoud.split('[CUTOFF]')		.join("(..)");
						} else {
							divThumbInhoud = divThumbInhoud.split('[CUTOFF]')		.join("");
						}
	
						divThumbInhoud = divThumbInhoud.split('[CAPTIONSMALL]')			.join(arrEventDetails[6]); 
						divThumbInhoud = divThumbInhoud.split('[CAPTION]')			.join(arrEventDetails[6]); 
						divThumbInhoud = divThumbInhoud.split('[EVENT_NAME]')		.join(arrEventDetails[6]); 
						divThumbInhoud = divThumbInhoud.split('[EVENT_LOCATION]')	.join(arrEventDetails[8]); 
						divThumbInhoud = divThumbInhoud.split('[FOTO_LOCATIEINQUERY]')	.join(arrEventDetails[9]); 
						var strLink = "index.php?ajax_querytype=get_eventoverzicht&ajax_queryzoekitem=" + arrEventDetails[5] + "&ajax_querytrefwoord=" + escape(document.getElementById('ajax_queryzoekitem').value);
						
						divThumbInhoud = divThumbInhoud.split('[LINK]')		.join(strLink); 
						divThumbInhoud = divThumbInhoud.split('%5BLINK%5D')		.join(strLink); 
					divThumbInhoud = divThumbInhoud.split('[FOTO_AANTAL]')		.join(""); 

						var divThumbnail = document.createElement('DIV');
						divThumbnail.innerHTML = divThumbInhoud;
						divThumbnail.id='CI_eventthumb';
						divThumbnail.className ='cbb-photo-thumb';
						divThumbnail.position ='absolute';
						divThumbnail.style.width = thumbPaneelWidth.toString() + "px";
						divThumbnail.style.height = thumbPaneelHeightEvent.toString() + "px";
	
						document.getElementById("CI_contentpaneel").appendChild(divThumbnail);
						
						// BREEDTE CAPTION INSTELLEN
						document.getElementById("caption_" + arrEventDetails[1].toString()).style.width	= captionWidth.toString() + "px";
	
						// Toevoegen Exclusive paneel
						if (arrEventDetails[3] == '1') {
							document.getElementById("isExclusive_" + arrEventDetails[1]).style.display = "inline";
						}
	
					}

				}
				
				// Mededeling bij geen treffers
				if (queryType != 'get_lightboxoverzicht') {
					if (divPaginaEigenschappen[2] == 0) {
						ajaxPopup('dialog_noresults', '');
					} 
				}

				// Vormgeving toevoegen
				//cbb.init('-photo-thumb')
				showSIFR()

			} else if ((queryType == 'get_eventoverzichtrecent') || (queryType == 'get_eventoverzichtcatagory') || (queryType == 'get_eventspecialcoverage')) {
				//////////////////////////////////////////////////////////////////////
				//
				// STRUCTUUR:
				// <#> foto-afscheiding
				// <|> veldafscheiding
				// Veld 1: var				 					// Foto ID
				// Veld 2: var									// Foto datum
				// Veld 3: var									// Foto exclusief
				// Veld 4: var									// Foto bijschrift
				// Veld 5: var									// Foto thumbnail
				// Veld 6: `event`.`event_event`				// Event naam
				// Veld 7: `event`.`event_exclusive`			// Event exclusief
				// Veld 8: `event`.`event_location`				// Event locatie
				// Veld 9: `photographers`.`photographers_naam`	// Event fotograaf
				// Veld 10: `event`.`event_ID`					// Event ID
				// Veld 11: var									// Aantal foto's
				//
				//////////////////////////////////////////////////////////////////////
				
				var arrEvent = myajaxnew.responseText.split('<#>')
				document.getElementById("dimPanelLayer").style.display = "none";
				document.getElementById('CI_contentpaneel').innerHTML = '';
				
				// Uitlezen eigenschappen pagina
				var divPaginaEigenschappen = arrEvent[0].split("<|>");

				// CHECKEN OF DROPBOXEN AANWEZIG ZIJN
				if (document.getElementById("CI_contentpaneel_footer") != null) {
					document.getElementById("CI_contentpaneel_header").innerHTML = '<strong>' + divPaginaEigenschappen[0] + '</strong>';
					document.getElementById('ajax_queryPaginaTotaal').value		=	divPaginaEigenschappen[1]
					document.getElementById('ajax_queryAantalTreffers').value		=	divPaginaEigenschappen[2]


				// TONEN PAGINANUMMERS
				ajaxToonPaginaNummering(divPaginaEigenschappen[1],queryPaginaAantalItems);
				}

				// Plaatsen items
				for (var i = 1 ; i < arrEvent.length;i++) {
					var arrEventDetails = arrEvent[i].split("<|>");
					arrEventDetails[5] = arrEventDetails[5].split('_')			.join(" "); 

					var divThumbInhoud = document.getElementById('tmp_EventThumbnail').innerHTML;
					divThumbInhoud = divThumbInhoud.split('[PATH_THUMBNAIL]').join(arrEventDetails[1]); 
					divThumbInhoud = divThumbInhoud.split('%5BPATH_THUMBNAIL%5D').join(arrEventDetails[1]); 
					divThumbInhoud = divThumbInhoud.split('[FOTO_ID]')			.join(arrEventDetails[1]); 
					divThumbInhoud = divThumbInhoud.split('[FOTO_DATE]')		.join(arrEventDetails[2]); 
					if (arrEventDetails[5].length > maxCaption) {
						divThumbInhoud = divThumbInhoud.split('[CAPTION]')		.join(arrEventDetails[5].substr(0,35)); 
						divThumbInhoud = divThumbInhoud.split('[CUTOFF]')		.join("(..)");

					} else {
						divThumbInhoud = divThumbInhoud.split('[CUTOFF]')		.join("");
					}
					divThumbInhoud = divThumbInhoud.split('[CAPTION]')		.join(arrEventDetails[5]); 
					divThumbInhoud = divThumbInhoud.split('[EVENT_NAME]')		.join(arrEventDetails[5]); 
					divThumbInhoud = divThumbInhoud.split('[EVENT_LOCATION]')	.join(arrEventDetails[7]); 
					divThumbInhoud = divThumbInhoud.split('[EVENT_ID]')			.join(arrEventDetails[9]); 
					
					if (arrEventDetails[11] == 1) {
					//var strLink = "javascript:zoekci('" + arrEventDetails[9] + "', 'get_eventspecialcoverage', 0);";
					var strLink = "index.php?ajax_querytype=get_eventspecialcoverage&ajax_queryzoekitem=" + arrEventDetails[9] + "";

					} else {
//					var strLink = "javascript:zoekci('" + arrEventDetails[9] + "', 'get_eventoverzicht', 0);";
					var strLink = "index.php?ajax_querytype=get_eventoverzicht&ajax_queryzoekitem=" + arrEventDetails[9] + "";
					}
					
					divThumbInhoud = divThumbInhoud.split('[LINK]')		.join(strLink); 
					divThumbInhoud = divThumbInhoud.split('%5BLINK%5D')		.join(strLink); 
					divThumbInhoud = divThumbInhoud.split('[FOTO_AANTAL]')		.join(arrEventDetails[10]); 

					var divThumbnail = document.createElement('DIV');
					divThumbnail.innerHTML =divThumbInhoud;
					divThumbnail.id='CI_eventthumb';
					divThumbnail.className ='cbb-photo-thumb';

					document.getElementById("CI_contentpaneel").appendChild(divThumbnail);

					// Toevoegen Exclusive paneel
					if (arrEventDetails[6] == '1') {
						document.getElementById("isExclusive_" + arrEventDetails[9]).style.display = "inline";
					} else {
						// Alleen als een event niet exclusive is en wel Special Coverage 'special' tonen
						if (arrEventDetails[11] == 1) {
						document.getElementById("isSpecialEvent_" + arrEventDetails[9]).style.display = "inline";
						}
					}
	
				}

				// Mededeling bij geen treffers
				if (divPaginaEigenschappen[2] == 0) {
					ajaxPopup('dialog_noresults', '');
				}
				
				// Vormgeving toevoegen
				// cbb.init('-photo-thumb')
				showSIFR()

			}else if (queryType == 'ajax_dellightbox') {
				window.location.reload(true);

			} else { // einde if-clause queryType
				document.getElementById("dimPanelLayer").style.display = "none";
//window.location.reload(true);	
			}
		}
		}
	}
}

function ajaxBewaarZoekopdracht() {
	var zoekOpdracht = ""
	for(i=0; i < document.formZoekCI.elements.length; i++)	{
		zoekOpdracht = zoekOpdracht + document.formZoekCI.elements[i].name + "<|>" + document.formZoekCI.elements[i].value + "<#>";
	}
	return zoekOpdracht
}

function ajaxLaadZoekopdracht(strData) {
	var arrFormFields = strData.split("<#>");
	for(i=0; i < arrFormFields.length; i++) {
		var arrFormDetails = arrFormFields[i].split("<|>");
			if (arrFormDetails[0].length > 0) {
			document.formZoekCI[arrFormDetails[0]].value = arrFormDetails[1]
//			alert(arrFormDetails[0] + "|" + arrFormDetails[1])
			}
	}
}

function ajaxPlaatsMarker() {
	// AJAX-BACK BUTTON ACTIVEREN DOOR OPSLAAN HUIDIGE ZOEKOPDRACHT
	var backButtonHash=Math.floor(Math.random()*1000000000)

	// I-FRAME METHODE ALLEEN VOOR IE GEBRUIKERS
	if (document.all) {
		document.getElementById("ci_ajax_backiframe").src = "ci_ajax_backiframe.php?summary=" + backButtonHash;
	}
	
	// HASH-METHODE VOOR ALLE BROWSERS
	document.location.hash = backButtonHash;
	ciSearchArray[backButtonHash] = ajaxBewaarZoekopdracht()
	recentHash = "#" + backButtonHash;
}

function ajaxSaveQueryToSession() {
	divWrapperHistory = document.getElementById("wrapperSearchHistory")
	divItemsHistory = document.getElementById("itemsSearchHistory")
	if (divItemsHistory) {
		// Vlak opschonen
		if (divWrapperHistory) {
			divWrapperHistory.style.display = "block";
		}
		divItemsHistory.innerHTML = "";
	}
		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'action=save_searchhistory&keyword=' + document.getElementById("ajax_queryzoekitem").value + '&search=' + escape(ajaxBewaarZoekopdracht()), 'txt')
		var myajaxnew=ajaxpack.ajaxobj
	if (divItemsHistory) {
		myajaxnew.onreadystatechange = function() {
			
		if (myajaxnew.readyState == 4){ //if request of file completed
		if (myajaxnew.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			 if (myajaxnew.responseText.length > 0) {
				arrayHistoryItems = myajaxnew.responseText.split("<#>")
					for (var i = 0 ; i < arrayHistoryItems.length-1;i++) {
						arrayItem = arrayHistoryItems[i].split("|");
						var divHistoryItem = document.createElement('DIV');
						divHistoryItem.innerHTML = "terug naar > <a href=\"javascript:ajaxGetQueryFromSession(" + arrayItem[0] + ");\">" + arrayItem[1] + "</a>";
			//			divHistoryItem.id='CI_fotothumb';
			//			divHistoryItem.className ='cbb-photo-thumb';
			//			divHistoryItem.position ='absolute';
						divItemsHistory.appendChild(divHistoryItem);
					}
			 } else {
				divWrapperHistory.style.display = "none";
			 }
		}
		}
		}
	} // Bestaat de DIV; zijn we niet op de voorpagina?
}

function ajaxGetQueryFromSession(intID) {
	ajaxpack.getAjaxRequest('ci_ajax_dialogs.php', 'action=get_searchhistory&id=' + escape(intID), 'txt')
	var myajaxnew=ajaxpack.ajaxobj
	myajaxnew.onreadystatechange = function() {
		
	if (myajaxnew.readyState == 4){ //if request of file completed
	if (myajaxnew.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
//		alert(myajaxnew.responseText)
		ajaxLaadZoekopdracht(myajaxnew.responseText)
		ajaxPlaatsMarker()
		ajaxToonResultaat()
	}
	}
	}
	
}
function ajaxToonPaginaNummering(inputAantalPaginas) {
		queryPaginaHuidig 		= 	document.getElementById('ajax_queryPaginaHuidig').value;
		queryPaginaAantalItems 	= 	                document.getElementById('ajax_queryPerPage').value;

		
		// Vullen paginanummer combo
		var selectPaginaNummer_top = document.getElementById('CI_zoeken_paginanummer_top');
		var selectPaginaNummer_bottom = document.getElementById('CI_zoeken_paginanummer_bottom');
		selectPaginaNummer_top.options.length = 0; // Eerst leegmaken
		selectPaginaNummer_bottom.options.length = 0; // Eerst leegmaken

		for (var i = 0 ; i < inputAantalPaginas;i++) {
			selectPaginaNummer_top.options[i] = new Option(i+1,i*queryPaginaAantalItems);
			selectPaginaNummer_bottom.options[i] = new Option(i+1,i*queryPaginaAantalItems); // Eerst leegmaken
		}

		// Weergeven huidige pagina en totaal aantal pagina's
		intAantalPaginas = Math.round(inputAantalPaginas);
		var intVerschil	= (inputAantalPaginas - intAantalPaginas)

		if (intVerschil > 0) {
			intAantalPaginas = intAantalPaginas + 1;
		}
		
		selectPaginaNummer_top.value		=	document.getElementById('ajax_queryPaginaHuidig').value
		selectPaginaNummer_bottom.value		=	document.getElementById('ajax_queryPaginaHuidig').value
		document.getElementById('ci_weergave_totaalpaginas_bottom').innerHTML = intAantalPaginas;
		document.getElementById('ci_weergave_totaalpaginas_top').innerHTML = intAantalPaginas;
}

function ajaxToonPrevNextPreview(intCuritem, boolGoBack) {
		queryZoekWoord			=	document.getElementById('ajax_queryzoekitem').value;
		queryTrefWoord			=	document.getElementById('ajax_querytrefwoord').value;
		queryType				=	document.getElementById('ajax_queryType').value;
		/*if (document.getElementById('ajax_queryExtraInstructie').value.length > 0) {
		queryExtraInstructie	=	"&" + document.getElementById('ajax_queryExtraInstructie').value;
		}*/

		if(boolGoBack == true) {
			queryPaginaHuidig 		= 	intCuritem - 1 // Ga ��n item terug
			if (queryPaginaHuidig == -1) {
				queryPaginaHuidig = (document.getElementById('ajax_queryAantalTreffers').value -1)
			}

		} else {
			queryPaginaHuidig 		= 	intCuritem + 1 // Ga ��n item vooruit
			if (queryPaginaHuidig > (document.getElementById('ajax_queryAantalTreffers').value -1)) {
				queryPaginaHuidig = 0			
			}
		}
		queryPaginaAantalItems 	= 	1

		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'zoekitem=' + queryZoekWoord + '&trefwoord=' + queryTrefWoord + '&action=' + queryType + '&page=' + queryPaginaHuidig + '&perpage=' + queryPaginaAantalItems , 'txt')
		var myajaxnew=ajaxpack.ajaxobj
		myajaxnew.onreadystatechange = function() {
			
		if (myajaxnew.readyState == 4){ //if request of file completed
		if (myajaxnew.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			// alert(myajaxnew.responseText)
			var arrFoto = myajaxnew.responseText.split('<#>')
			var arrFotoDetails = arrFoto[1].split('<|>')
			// Tonen van de foto
			ajaxPopup('dialog_fotodetail', '&id=' + arrFotoDetails[1] + '&qloc='+queryPaginaHuidig);
		}
		}
		}
}

function ajaxToonPrevNextPage(boolGoBack) {
		queryPaginaAantalItems 	= 	parseInt(document.getElementById('ajax_queryPerPage').value);
                //queryPaginaAantalItems 	= 	12
		intHuidigePagina 	= parseInt(document.getElementById('ajax_queryPaginaHuidig').value)
		intAantalTreffers 	= parseInt(document.getElementById('ajax_queryAantalTreffers').value)
		intPaginaTotaal 	= parseInt(document.getElementById('ajax_queryPaginaTotaal').value)

		if (boolGoBack ==  true) {
			intNieuwePagina = intHuidigePagina - queryPaginaAantalItems;
			if (intNieuwePagina < 0) {
				intNieuwePagina = (intPaginaTotaal * queryPaginaAantalItems)
			}
		} else {
			intNieuwePagina = intHuidigePagina + queryPaginaAantalItems;
			if (intNieuwePagina > intAantalTreffers) {
				intNieuwePagina = 0
			}
		}//alert(queryPaginaAantalItems)
		 //alert(intNieuwePagina);
		document.getElementById('ajax_queryPaginaHuidig').value = intNieuwePagina;
		ajaxPlaatsMarker();
		ajaxToonResultaat();
}

function ajaxLightboxActies(intIDLightbox, intIDFoto, strAction, qloc) {
	
	queryType =	"ajax_" + strAction + "lightbox";
	queryArgumenten = ""
	if (strAction == "add") {
	queryArgumenten = "&lightboxname=" + escape(intIDLightbox);
	}
	// alert(queryArgumenten)
	
		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', "action=" + queryType + '&lightboxid=' + intIDLightbox + '&photoid=' + intIDFoto + queryArgumenten, 'txt')
		var myajaxnew=ajaxpack.ajaxobj
		myajaxnew.onreadystatechange = function() {
			
		if (myajaxnew.readyState == 4){ //if request of file completed
		if (myajaxnew.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			if (strAction == "addto") {
				alert("Photo added to lightbox")
				
			} else if (strAction == "add") {
				alert("Lightbox added")
				
				if (qloc != 100000) { // Herkent toevoegen van Lightbox in sidebar
				ajaxPopup('dialog_fotodetail', '&id=' + intIDFoto + '&qloc=' + qloc);
				} else {
				window.location.reload(true);	

				}

			} else if (strAction == "del") {
				alert("Lightbox deleted")
				ajaxPopup('dialog_fotodetail', '&id=' + intIDFoto + '&qloc=' + qloc);
				
			} else if (strAction == "delfrom") {
				alert("Photo deleted from lightbox")
				ajaxClosePopup();			
			}
		}
	}
	}
}

function replaceAll( str, replacements ) {
    for ( i = 0; i < replacements.length; i++ ) {
        var idx = str.indexOf( replacements[i][0] );

        while ( idx > -1 ) {
            str = str.replace( replacements[i][0], replacements[i][1] ); 
            idx = str.indexOf( replacements[i][0] );
        }

    }
    return str;
}

function formVolgendVeld(e, nextfield, formname) { 

var keycode;
if (window.event) {
	keycode = window.event.keyCode;
} else if (e) {
	keycode = e.keyCode; 
} else {
	return false;
}

if (keycode == 13) {  //enter key pressed
	if (nextfield == "done"){ 
		if (formname=="smalllogin") {
			ajaxLogin(document.getElementById('small_login_user').value, document.getElementById('small_login_pass').value);return false;
		} else if (formname=="normallogin") {
			ajaxLogin(document.getElementById('login_user').value, document.getElementById('login_pass').value);return false;
		}
		return false;
//		alert()
//		document.getElementById(formname).submit()
	} else { //  we're not done yet, send focus to next box
		eval("document.getElementById('" + nextfield + "').focus()");
		return false;
	}
}
}
// document.onkeypress = onKeyPress; 

function ajaxPopup(action, argumenten) {

	if(argumenten != undefined) {
		var strArgumenten = argumenten
	} else {
		var strArgumenten = ''
	}

// GEBRUIKER INLOGGEN
// && = AND
// || = OR
	ajaxpack.getAjaxRequest('ci_ajax_dialogs.php', 'action=' + action + strArgumenten, 'txt')
	var myajax=ajaxpack.ajaxobj
	myajax.onreadystatechange = function() {

		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			 //alert(myajax.responseText)
			document.getElementById("Panel_Dialogs").innerHTML = myajax.responseText;
			// alert(myajax.responseText);
			document.getElementById("background_Dialogs").style.display = 'inline'
			document.getElementById("Panel_Dialogs").style.visibility = 'hidden'
			document.getElementById("Panel_Dialogs").style.display = 'inline'

			// document.getElementById("background_Dialogs").style.display = 'none'

			// JUIST POSITIONEREN VAN DIALOOGVENSTER
			var Opera = window.opera ? true : false;
			var CanvasBreedte	= 786
			var centerLeft		= 0
			var centerTop		= 0
			//var menuObject = document.getElementById("Dialog_Paneel")
			// var BasisWaarde = document.getElementById("Dialog_Paneel").style.width

			var centerLeft = getScrollX() + (getWinWidth() / 2) - (document.getElementById('Dialog_Paneel').clientWidth / 2);
			var centerTop =	getScrollY() + (getWinHeight() / 2) - (document.getElementById('Dialog_Paneel').clientHeight / 2);
			
			if (centerLeft < 0) {centerLeft = 0}
			if (centerTop < 0) {centerTop = 0}
			
//			centerTop = centerTop + 200
			// Aanpassen van eigenschappen van betreffende DIV.
//			document.getElementById(menuNaam).style.visibility = 'visible';
//			document.getElementById(menuNaam).style.left = (MargeLinks + BasisWaarde) + 'px';
			document.getElementById("Dialog_Paneel").style.left = (centerLeft) + 'px';
			document.getElementById("Dialog_Paneel").style.top = (centerTop) + 'px';
			document.getElementById("Panel_Dialogs").style.visibility = 'visible'

			// FIX voor IE6 waardoor onderliggende formulier elementen niet doorslaan
			document.getElementById("background_Frame_Dialogs").style.left = (centerLeft) + 'px';
			document.getElementById("background_Frame_Dialogs").style.top = (centerTop) + 'px';
			document.getElementById("background_Frame_Dialogs").style.width = (document.getElementById('Dialog_Paneel').clientWidth+2) + 'px';
			document.getElementById("background_Frame_Dialogs").style.height = (document.getElementById('Dialog_Paneel').clientHeight+2) + 'px';
			document.getElementById("background_Frame_Dialogs").style.display = 'inline'
			
			if ((action == "dialog_fotodetail") && (document.getElementById('ajax_currentLightbox').value).length > 0){
			document.getElementById('ci_lightbox').value = document.getElementById('ajax_currentLightbox').value;
			}

if(action=="dialog_advsearch")
    {
Calendar.setup({inputField  : "startdate",ifFormat: "%d-%m",button: "calendarImage1",showsTime   : "true"});Calendar.setup({inputField  : "enddate",ifFormat: "%d-%m",button: "calendarImage2",showsTime   : "true"});

    }
			
		} else if (myajax.status==500) {
			ajaxClosePopup		  
		}
		} 
	}
}


// returns height of window
function getWinHeight() {
	var winHt = 0;
	if (window.innerHeight) winHt = window.innerHeight-18;
	else if (document.documentElement && document.documentElement.clientHeight) 
		winHt = document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) 
		winHt = document.body.clientHeight;
	return winHt;
}	

// returns height of window
function getWinWidth() {
	var winWd = 0;
	if (window.innerWidth) winWd = window.innerWidth-18;
	else if (document.documentElement && document.documentElement.clientWidth) 
		winWd = document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) 
		winWd = document.body.clientWidth;
	return winWd;
}

// returns amount of vertical scroll
function getScrollY() {
	var sy = 0;
	if (document.documentElement && document.documentElement.scrollTop)
		sy = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop) 
		sy = document.body.scrollTop; 
	else if (window.pageYOffset)
		sy = window.pageYOffset;
	else if (window.scrollY)
		sy = window.scrollY;
	return sy;
}

// returns amount of vertical scroll
function getScrollX() {
	var sx = 0;
	if (document.documentElement && document.documentElement.scrollLeft)
		sx = document.documentElement.scrollLeft;
	else if (document.body && document.body.scrollLeft) 
		sx = document.body.scrollLeft; 
	else if (window.pageXOffset)
		sx = window.pageXOffset;
	else if (window.scrollX)
		sx = window.scrollX;
	return sx;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function ajaxClosePopup() {
	document.getElementById("Panel_Dialogs").innerHTML = '';
	document.getElementById("background_Dialogs").style.display = 'none'
	document.getElementById("Panel_Dialogs").style.display = 'none'
	document.getElementById("background_Frame_Dialogs").style.display = 'none'

}
var pagename='';
function ajaxLogin(UserName, Password,pagename) {
	
// GEBRUIKER INLOGGEN
// && = AND
// || = OR

//alert('action=ajax_login&user=' + UserName + '&pass=' + Password)
if (UserName.length > 0 && Password.length > 0) {
	ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'action=ajax_login&username=' + UserName + '&password=' + Password, 'txt')
	var myajax=ajaxpack.ajaxobj
	myajax.onreadystatechange = function() {

		if (myajax.readyState == 4){ //if request of file completed
			// alert(myajax.responseText)
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			//alert(myajax.responseText)
			if (myajax.responseText == "[OK]") {
				if(pagename=='r')
                                    window.location="http://www.allaccess.nl";
                                else
				window.location.reload(true);
			} else if (myajax.responseText == "[ERROR]") {
				alert('The username and password you entered are incorrect. Please check your input and try again. If you are a new client please register using the button \'subscribe as client\'')
				// ajaxClosePopup()
			}
		}
		} 
	}
	
} else {
	alert('De gebruikersnaam en wachtwoord die u heeft gebruikt zijn onjuist. Controleer uw invoer en probeer nogmaals in te loggen. Indien u een nieuwe professionele client bent, registreer dan via de knop \'registreren als client\'.')
}
}

function ajaxLogOut() {
	ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'action=ajax_logout', 'txt')
	var myajax=ajaxpack.ajaxobj
	myajax.onreadystatechange = function() {

		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			window.location.reload(true);
		}
		} 
	}

}

function ajaxPassForget(Emailadres) {
		ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'action=dialog_passforgetsave&email=' + Emailadres, 'txt')

	var myajax=ajaxpack.ajaxobj
	myajax.onreadystatechange = function() {

		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			if(myajax.responseText == "[OK]") {
			alert("We hebben uw wachtwoord succesvol verzonden aan " + Emailadres)
			ajaxClosePopup()
			} else {
			alert("Er is helaas geen account aanwezig voor het opgegeven e-mailadres. (" + Emailadres + "). Controleer uw invoer en probeer het opnieuw.")
			}
		}
		} 
	}

}


function ajaxRegister() {                                

	var queryRegister = ""
	for(i=0; i<document.getElementById('form_Register').elements.length; i++)
	{
	if (document.form_Register.elements[i].name == "Nieuwsbrief") {
		//	alert(document.form_Register.elements[i].checked)
		//	Gaat om een checkbox, andere behandeling
		queryRegister = queryRegister + "&"+ escape(document.form_Register.elements[i].name) + "=" + escape(document.form_Register.elements[i].checked)
	} else {
		queryRegister = queryRegister + "&"+ escape(document.form_Register.elements[i].name) + "=" + escape(document.form_Register.elements[i].value)
	}
		document.form_Register.elements[i].style.borderColor = "";
		document.form_Register.elements[i].style.borderLeftWidth = "";
	}
//	alert(queryRegister)

	ajaxpack.postAjaxRequest('ci_ajax_dialogs.php', 'action=dialog_registersave' + queryRegister, 'txt')
	var myajax=ajaxpack.ajaxobj
	myajax.onreadystatechange = function() {

		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
			 //alert(myajax.responseText)
			// WAT ER MOET GEBEUREN: CHECK �F ERROR. ZO JA: TONEN IN INNERHTML, ZO NEE: ACTIE NA REGISTRATIE UITVOEREN
			if (myajax.responseText == "[OK]") {
				//alert("Thank you for registering with CyberImage!\n\nYour request is now being checked and within 24 hours, after approval, you receive an activation mail from us.\n\nIn case you need to order/download photos urgently please contact us at info@cyberimage.nl or call +31 6 50595340 or +31 6 54705986.\n\nThank you!\nCyberImage Team")
                                alert("Dank voor uw registratie!\n\nUw verzoek wordt nu gecheckt en binnen 24 uur krijgt u uw \ngebruikersnaam en wachtwoord per e-mail toegezonden.\n\nWij wijzen erop dat aanmeldingen met gratis e-mail accounts \n(zoals Gmail, Yahoo, Hotmail etc etc niet in behandeling worden genomen.\n\nDank U!")
				window.location.reload(true);
			} else {
				var arrFoutResponse = myajax.responseText.split("<#>");
				alert(arrFoutResponse[0])
				if (arrFoutResponse[1].length > 0) {
					var arrFoutFields = arrFoutResponse[1].split("<|>");
					for (i=0; i<arrFoutFields.length-1; i++) {
					document.form_Register.elements[arrFoutFields[i]].style.borderLeftWidth 	= "3px";
					document.form_Register.elements[arrFoutFields[i]].style.borderColor 	= "#F00";
					// alert(arrFoutFields[i])
					}
				}
				document.getElementById('Panel_Fout').innerHTML = "Please correct your details and press 'register as client' again."// 
				//ajaxClosePopup()			
				}
		}
		} 
	}
}

function nieuwsWissel(intID) {
	if (document.getElementById('nieuws_body_' + intID).style.display =='inline') {
		document.getElementById('nieuws_body_' + intID).style.display ='none'
		document.getElementById('nieuws_teaser_' + intID).style.display ='inline'
	} else {
		document.getElementById('nieuws_body_' + intID).style.display ='inline'
		document.getElementById('nieuws_teaser_' + intID).style.display ='none'
	}
} 

function downloadWissel(licenseOK) {
	if (licenseOK == true) {
		document.getElementById('downloadcondOK').style.display = 'inline'
		document.getElementById('downloadcondNOTOK').style.display = 'none'
	} else {
		document.getElementById('downloadcondOK').style.display = 'none'
		document.getElementById('downloadcondNOTOK').style.display = 'inline'
	}
}

function lightboxWissel(keuze) {
	document.getElementById('ajax_currentLightbox').value = keuze;
	
	if (keuze > 0) {
		document.getElementById('preview_Lightbox_ADD').style.display = 'inline'
		document.getElementById('preview_Lightbox_NEW').style.display = 'none'
	} else {
		document.getElementById('preview_Lightbox_ADD').style.display = 'none'
		document.getElementById('preview_Lightbox_NEW').style.display = 'inline'
	}
}
