function HideEmptyImages() {
    var regex = new RegExp("(shownoimg)\.gif$");
    for (var i = 0; i < document.images.length; i++)
        if (regex.test(document.images[i].src))
        document.images[i].style.display = "none";
}

/*== Prototypes ==*/
String.prototype.rev = function()
{
	return this.split('').reverse().join('');
};


/*= replaceLast(string,'to replace','to replace with'); =*/
function replaceLast(s,from,to)
{
	return s.rev().replace(new RegExp(from.rev()),to.rev()).rev();
};
/*= =*/

/*== ==*/

/*== Kruimelpad script (Vanaf Updater 9 SP3 en hoger)  indien lager, dit script uitcommentariseren==*/
/*== PROTOTYPES rev en replaceLast nodig!! ==*/
/*== CSS classes first en last nodig!! ==*/
/*== Img crumb_path_sep.gif nodig!! ==*/
function createCrumbPathAt(id)
{
	if (document.getElementById(id) && crumbPath_themeNames && crumbPath_themeIds && themeName && pageName && pageId)
	{
		crumbPath_themeNames = crumbPath_themeNames.replace(/[ ][(]NIET VERWIJDEREN[)]/g,"");
		pageName = pageName.replace(/[ ][(]NIET VERWIJDEREN[)]/g,"");
		themeName = themeName.replace(/[ ][(]NIET VERWIJDEREN[)]/g,"");
		
		crumbPath_themeNames = crumbPath_themeNames.replace(/\* Modules/g,"");
		pageName = pageName.replace(/\* Modules/g,"");
		themeName = themeName.replace(/\* Modules/g,"");
		
		crumbPath_themeNames = crumbPath_themeNames.replace(/^~/,"");
		crumbPath_themeNames = crumbPath_themeNames.replace(/~$/,"");
		
		crumbPath_themeIds = crumbPath_themeIds.replace(/^~/,"");
		crumbPath_themeIds = crumbPath_themeIds.replace(/~$/,"");
		
		var printableNavigation = '';
		var objectToPlaceCrumbpath = document.getElementById(id);
		
		var crumbPath_themeIds_Array = crumbPath_themeIds.replace(/^~/,"");
		crumbPath_themeIds_Array = crumbPath_themeIds.replace(/~$/,"");
		
		var crumbPath_themeIds_Array = crumbPath_themeIds.split(/~/);
		var crumbPath_themeNames_Array = crumbPath_themeNames.split(/~/);
		
		for (var i=0; i<crumbPath_themeIds_Array.length; i++)
		{
			if (crumbPath_themeIds_Array[i] == "")
			{
				crumbPath_themeNames_Array.splice(i,1);
				crumbPath_themeIds_Array.splice(i,1);
			}
			if (crumbPath_themeNames_Array[i-1] && crumbPath_themeNames_Array[i])
			{
				if (crumbPath_themeNames_Array[i-1] == crumbPath_themeNames_Array[i])
				{
					crumbPath_themeNames_Array.splice(i,1);
					crumbPath_themeIds_Array.splice(i,1);
				}
			}
			if (crumbPath_themeNames_Array[i])
			{
				if (crumbPath_themeNames_Array[i] == "")
				{
					
					crumbPath_themeNames_Array.splice(i,1);
					crumbPath_themeIds_Array.splice(i,1);
				}
				else if (crumbPath_themeNames_Array[i].match(/#/))
				{
					crumbPath_themeNames_Array.splice(i,1);
					crumbPath_themeIds_Array.splice(i,1);
				}
			}
		}
		
		for (var j=0; j<crumbPath_themeNames_Array.length; j++)
		{
			if (j == 0)
			{
				// Voeg alle (sub) thema's toe aan een verzameling met links, evt. opbouw kan hier worden gewijzigd
				printableNavigation += '<a class="first" href="/cms/publish/content/showpage.asp?themeid='+crumbPath_themeIds_Array[j]+'">'+crumbPath_themeNames_Array[j]+'</a>';
				
			}
			else if (j == crumbPath_themeNames_Array.length-1)
			{
				if (pageName == themeName && themeId == crumbPath_themeIds_Array[crumbPath_themeIds_Array.length-1])
				{
					// Voeg alle (sub) thema's toe aan een verzameling met links, evt. opbouw kan hier worden gewijzigd
					printableNavigation += '<a class="last" href="/cms/publish/content/showpage.asp?themeid='+crumbPath_themeIds_Array[j]+'"><strong>'+crumbPath_themeNames_Array[j]+'</strong></a>';
				}
				else
				{
					// Voeg alle (sub) thema's toe aan een verzameling met links, evt. opbouw kan hier worden gewijzigd
					printableNavigation += '<a href="/cms/publish/content/showpage.asp?themeid='+crumbPath_themeIds_Array[j]+'">'+crumbPath_themeNames_Array[j]+'</a>';
				}
			}
			else
			{
				// Voeg alle (sub) thema's toe aan een verzameling met links, evt. opbouw kan hier worden gewijzigd
				printableNavigation += '<a href="/cms/publish/content/showpage.asp?themeid='+crumbPath_themeIds_Array[j]+'">'+crumbPath_themeNames_Array[j]+'</a>';
				
			}
			
		}
		
		if (pageName.toLowerCase().match(themeName.toLowerCase()) && themeId == crumbPath_themeIds_Array[crumbPath_themeIds_Array.length-1])
		{
			// Als het themeId waar we op ons bevinden gelijk is aan het laatste themeId in het kruimelpad en de naam van de pagina gelijk is aan het thema naam, hoeft er geen pagina link toegevoegd te worden
			printableNavigation = replaceLast(printableNavigation,'<a ','<a class="last" ');
		}
		else
		{
			// Hier wordt de paginatitel als laatste link toegevoegd, evt. opbouw kan hier worden gewijzigd
			printableNavigation += '<a class="last" href="/cms/publish/content/showpage.asp?pageid='+pageId+'"><strong>'+pageName+'</strong></a>';
		}
		
		// Plaats het samengestelde kruimelpad in het element met het opgegeven ID
		objectToPlaceCrumbpath.innerHTML = printableNavigation;
	}
}
/*== ==*/

/*== HighlightLocation("header_navigation~content_navigation~footer_navigation"); ==*/
function HighlightLocation(containerIds)
{
	var localThemeId = 'themeid='+themeId;
	var localPageId = 'pageid='+pageId;
	
	var navigationsToCheck = new Array();
	
	var containerIds_gesplit = containerIds.split(/~/);
	
	for (var u=0; u<containerIds_gesplit.length; u++)
	{
		navigationsToCheck.push(containerIds_gesplit[u]);
	}
	
	var regExp = new RegExp("#");
	var regExp_digitCheck_ThemeId = new RegExp(localThemeId + '(?![0-9])');
	var regExp_digitCheck_PageId = new RegExp(localPageId + '(?![0-9])');
	
	for (var i=0; i<navigationsToCheck.length; i++)
	{
		if (document.getElementById(navigationsToCheck[i]))
		{	
			var linkObjects = document.getElementById(navigationsToCheck[i]).getElementsByTagName('a');
			
			for (var j=0; j<linkObjects.length; j++)
			{
				var src = ""+linkObjects[j]+"";
				
				if ((regExp_digitCheck_ThemeId.exec(src) || regExp_digitCheck_PageId.exec(src)) && !regExp.exec(src))
				{
					linkObjects[j].className = 'active';
				}
				else
				{
					linkObjects[j].className = '';
				}
			}
		}
	}
}
/*== ==*/

/*== launchImagePopup ==*/
function launchImagePopup(sPicURL,title)
{
	if (sPicURL != "" && !sPicURL.match(/spacer.gif/) && !sPicURL.match(/shownoimg.gif/) && !sPicURL.match(/dot.gif/))
	{
		window.open('/mod_popup.htm?'+sPicURL,title,"width=200,height=200,scrollbars=no,toolbar=no,location=no,resizable=yes");
	}
}
/*== ==*/

/*== Google Maps initializer ==*/
if (!googleMapsAvailable)
{
	var googleMapsAvailable = false;
}

function initialize(divMapId)
{
	if (googleMapsAvailable)
	{
		initializeGoogleMaps(divMapId);
	}
}
/*== ==*/

window.onload = function(e)
{
	HideEmptyImages();
	//createCrumbPathAt('crumb_path');
	//HighlightLocation("submenu");
	initialize("google_maps");
	
	if (typeof(initFlv) == "function")
	{
		initFlv();
	}
}
