//
// to debug this javascript code with visual studio : 
// http://support.microsoft.com/default.aspx?scid=kb;en-us;816173&%20f=11
//
var date = new Date();
date.setTime(date.getTime()+(60*24*60*60*1000));
var lang = "";
var TypesArray = new Array();
var IDs        = new Array(); // Array that holds the ids of the sub items (articles, news, ...)
var TypeItems  = new Array();	// Array that holds the ids of the type items (articles, news, ...)
var f          = 0;           // counter for Main Items (Editions, Magazines, ...)
var box;var url;var title;
var rowsToShow = 5;           // number of sub items to show under each main item
var moreItemsIMG		= "";		   // keeps name of image "+-items"	

var monthsName = new Array();
monthsName[1] = new Array();
monthsName[1][0] = "Januari";
monthsName[1][1] = "Februari";
monthsName[1][2] = "Maart";
monthsName[1][3] = "April";
monthsName[1][4] = "Mei";
monthsName[1][5] = "Juni";
monthsName[1][6] = "Juli";
monthsName[1][7] = "Augustus";
monthsName[1][8] = "September";
monthsName[1][9] = "Oktober";
monthsName[1][10] = "November";
monthsName[1][11] = "December";

monthsName[2] = new Array();
monthsName[2][0] = "Janvier";
monthsName[2][1] = "F&eacute;vrier";
monthsName[2][2] = "Mars";
monthsName[2][3] = "Avril";
monthsName[2][4] = "Mai";
monthsName[2][5] = "Juin";
monthsName[2][6] = "Juillet";
monthsName[2][7] = "Ao&ucirc;t";
monthsName[2][8] = "Septembre";
monthsName[2][9] = "Octobre";
monthsName[2][10] = "Novembre";
monthsName[2][11] = "D&eacute;cembre";

function Types(name, desc_FR, desc_NL, img_FR, img_NL, reqDate, conditionUrl)
{
	this.TypeName = name
	this.Description_FR = desc_FR;
	this.Description_NL = desc_NL;
	this.Image_FR = img_FR;
	this.Image_NL = img_NL;
	this.RequiresDate = reqDate;
	this.ConditionalUrl = conditionUrl;
}

// Calculation,PriceSurvey,DynaTable,dossier,article,alarm,Newsflash,forum,tip,guide,contract,pressrelease,pressreview,Faq,Hyperlink, Webarticle
TypesArray[0]  = new Types("Calculation", "<h3>Calculateurs</h3>", "<h3>Bereken zelf</h3>", "calcul.jpg", "bereken.jpg", 0, "CalculationUrl");
TypesArray[1]  = new Types("PriceSurvey", "<h3>Trouvez les magasins avantageux pr&egrave;s de chez vous</h3>", "<h3>Vind de voordeligste winkel in uw buurt</h3>", "prix_magasins.jpg", "winkelprijzen.jpg", 1, "PriceSurveyUrl");
TypesArray[2]  = new Types("DynaTable", "<h3>Tableaux actualis&eacute;s</h3><h5>Consultez les r&eacute;sultats de test et tarifs les plus r&eacute;cents</h5>", "<h3>Geactualiseerde tabellen</h3><h5>Bekijk de meest recente testresultaten en tarieven</h5>", "tableaux_02.jpg", "tabellen.jpg", 1, "DynaTableUrl");
TypesArray[3]  = new Types("dossier", "<h3>Dossiers</h3>", "<h3>Dossiers</h3>", "dossier.jpg", "dossiers.jpg", 1, "");
TypesArray[4]  = new Types("article", "<h3>Articles</h3><h5>Lisez l'article complet de nos revues</h5>", "<h3>Artikels</h3><h5>Lees het volledige artikel uit onze tijdschriften</h5>", "articles_02.jpg", "articles.jpg", 1, "");
TypesArray[5]  = new Types("alarm", "<h3>Alarme</h3>", "<h3>Alarm</h3>", "alerte.jpg", "alarm.jpg", 1, "");
TypesArray[6]  = new Types("Newsflash", "<h3>En direct</h3>", "<h3>Nieuwsflash</h3>", "flash_info.jpg", "Nieuwsflash.jpg", 1, "");
TypesArray[7]  = new Types("forum", "<h3>Forum</h3><h5>Interrogez d'autres consommateurs</h5>", "<h3>Forum</h3><h5>Vraag het aan andere consumenten</h5>", "forum.jpg", "forum.jpg", 1, "ForumUrl");
TypesArray[8]  = new Types("tip", "<h3>Conseils</h3>", "<h3>Tips</h3><h5>Snelle adviezen</h5>", "conseil.jpg", "tips.jpg", 0, "");
TypesArray[9]  = new Types("guide", "<h3>Livres &eacute;dit&eacute;s par Test-Achats</h3>", "<h3>Boeken uitgegeven door Test-Aankoop</h3>", "guide.jpg", "gidsen.jpg", 1, "");
TypesArray[10] = new Types("contract", "<h3>Contrats types</h3>", "<h3>Typecontracten</h3>", "contrat.jpg", "typecontracten.jpg", 1, "");
TypesArray[11] = new Types("pressrelease", "Communiqu&eacute;s de presse", "<h3>Persberichten</h3>", "communiques.jpg", "persberichten.jpg", 1, "");
TypesArray[12] = new Types("pressreview", "Communiqu&eacute;s de presse", "Persberichten", "communiques.jpg", "persberichten.jpg", 1, "");
TypesArray[13] = new Types("Faq", "<h3>Encyclop&eacute;die</h3>", "<h3>Juridische vraagbaak</h3>", "encyclo.jpg", "vraagbaak.jpg", 1, "");
TypesArray[14] = new Types("Hyperlink", "<h3>Liens utiles</h3>", "<h3>Aanbevolen links</h3>", "liens.jpg", "links.jpg", 1, "HyperlinkURL");
TypesArray[15] = new Types("ProductRecall", "<h3>Rappel de produits</h3>", "<h3>Terugroepacties</h3>", "productRecall.jpg", "productRecall.jpg", 1, "");
TypesArray[16]  = new Types("SilverContent", "<h3>Focus</h3>", "<h3>Focus</h3>", null, null, 1, "SilverUrl");
TypesArray[17] = new Types("FreeContract", "<h3>Contrats types</h3>", "<h3>Typecontracten</h3>", "contrat.jpg", "typecontracten.jpg", 1, "");
TypesArray[18]  = new Types("Video", "<h3>Vid&eacute;o</h3>", "<h3>Video</h3>", null, null, 1, "SilverUrl");
TypesArray[19]  = new Types("ProductFamily", "<h3>Comparer &amp; choisir</h3>", "<h3>Vergelijk &amp; kies</h3>", null, null, 1, "");
TypesArray[20]  = new Types("PromoGuide", "<h3>Miniguides</h3>", "<h3>Pocketgidsen</h3>", null, null, 1, "");
/*
	fonction servant a enlever le background des liens 
	s'ils contiennent une image
*/
imageur={
	init:function(){
		var listOfImages=document.getElementsByTagName('img');

		for(var i=0;i<listOfImages.length;i++){
			if(listOfImages[i].parentNode.nodeName=='A'){
				parentA = listOfImages[i].parentNode;
				parentA.style.background='none';
			}
		
		}
	
	},
	addEvent: function(elm, evType, fn, useCapture){
		if (elm.addEventListener) 
		{
			elm.addEventListener(evType, fn, useCapture);
			return true;
		} else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		} else {
			elm['on' + evType] = fn;
		}
	}

}
imageur.addEvent(window, 'load', imageur.init, false);

function popUpWH(URL, m_W, m_H)	//open popup, passing window-with and -height
	{
	var H, W;
	W = m_W;
	H = m_H;
	var intScrWidth=(window.screen.width/2) - ((W/2)+10);
	var intScrHeight=(window.screen.height/2) - ((H/2)+60);
	memFenetre=window.open(URL, "artikels", "height=" + H + ",width=" + W + ",scrollbars=no,resizable=yes,screenX=" + intScrWidth + ",screenY=" + intScrHeight + ",left=" + intScrWidth + ",top=" +intScrHeight);
	}
	

///////////////////////////////////////////////////////////////////////////

///please don't remove this ///
/// <author>Macromedia</author>
/// <summary>
/// mouseover function
/// </summary>
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_swapImgRestore() { //v3.0
	var i,x;
	var a = document.MM_sr; 
	for(i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) 
		x.src = x.oSrc;
}


function MM_preloadImages() { //v3.0
	var d = document; 
	if (d.images)
	{ 
		if (!d.MM_p) 
			d.MM_p = new Array();
		var i
		var j = d.MM_p.length
		var a = MM_preloadImages.arguments; 
		for(i = 0; i < a.length; i++)
			if (a[i].indexOf("#") != 0)
			{ 
				d.MM_p[j] = new Image; 
				d.MM_p[j++].src = a[i];
			}
	}
}

function MM_findObj(n, d) { //v3.0
	var p,i,x;  
	if (!d) 
		d = document; 
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) 
	{
		d = parent.frames[n.substring(p + 1)].document; 
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) 
		x = d.all[n]; 
	for(i = 0; !x && i < d.forms.length; i++) 
		x=d.forms[i][n];
	for(i = 0; !x && d.layers && i < d.layers.length; i++) 
		x = MM_findObj(n, d.layers[i].document); 
	return x;
}

function MM_swapImage() { //v3.0
	var i,j=0;
	var x;
	var a = MM_swapImage.arguments; 
	document.MM_sr = new Array; 
	for(i = 0; i < (a.length - 2); i += 3)
		if ((x = MM_findObj(a[i])) != null)
		{
			document.MM_sr[j++] = x; 
			if(!x.oSrc) 
				x.oSrc = x.src; 
			x.src = a[i + 2];
		}
}
/////////////////////////////////////////////////////////////////
	
	
///
/// Display a Type's Bottom block
///
function NewDisplayBottomOrder(g, typeItemsF)
{
	//if less than 5 results, do not show button "more items"
	var plusOrMinus = "";

	if (g > rowsToShow) { 
		if (lang == "FR")
			//plusOrMinus = "<a id='" + typeItemsF + "_show' href=javascript:ShowSubItems('" + typeItemsF + "')>" +
						//"<img id='img" + typeItemsF + "' name='img" + typeItemsF + "' src='/site_images/FR/moreItems.gif' border='0' alt=''></a>";	
			plusOrMinus = "<div align=right><input id='" + typeItemsF + "_show' type=button class=button value='+ voir plus' onclick=javascript:ShowSubItems('" + typeItemsF + "');switchButton(this);></div>";
	
		if (lang == "NL")
			//plusOrMinus = "<a id='" + typeItemsF + "_show' href=javascript:ShowSubItems('" + typeItemsF + "')>" 
			//			+ "<img id='img" + typeItemsF + "' name='img" + typeItemsF + "' src='/site_images/NL/moreItems.gif' border='0' alt=''></a>";
			plusOrMinus = "<div align=right><input id='" + typeItemsF + "_show' type=button class=button value='+ meer items' onclick=javascript:ShowSubItems('" + typeItemsF + "');switchButton(this);></div>";
	}

	document.write(plusOrMinus);
}

function switchButton(obj)
{
    if (lang == "NL")
    {
       (obj.value.toLowerCase().indexOf("meer") > -1)?obj.value="- minder items":obj.value="+ meer items";
    }
    else
    {
        (obj.value.toLowerCase().indexOf("plus") > -1)?obj.value="- voir moins":obj.value="+ voir plus";    
    }
}

function NewShowItems()
{		
		// loop only within elements having the module in theis id;
		// as an example : if "MThemList" is a module, the the id must be as "MThemList_123456"
	for(var item = 0; item < TypeItems.length; item++)
	 {
		module = TypeItems[item];
		noOfRows = 0;
			
		for(var id = 1; id < IDs.length; id++)
		{			
			if(IDs[id].toString().indexOf(module) >= 0)
			{
				noOfRows++;
				if(noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.getElementById(IDs[id]).style.display = "block";
				}
				else
				{
					document.getElementById(IDs[id]).style.display = "none";
				}
			}			
		}
	}
}
///
/// Set Type Description knowing the type name
///
function SetTypeDescription(typeName)
{
	for (var i = 0; i < TypesArray.length; i++)
	{
		if (TypesArray[i].TypeName.toString().toUpperCase() == typeName.toString().toUpperCase())
		{
			if (lang == "FR")
				return TypesArray[i].Description_FR;
			if (lang == "NL")
				return TypesArray[i].Description_NL;
		}
	}
}
///
/// Set Type item's Publication Date knowing the type name
///
function SetTypeItemPublicationDate(typeName, publicationDate)
{
	for (var i = 0; i < TypesArray.length; i++)
	{
		if (TypesArray[i].TypeName.toString().toUpperCase() == typeName.toString().toUpperCase())
		{
			if (TypesArray[i].RequiresDate == 1)
			{
				document.write("<td width=70 align=right>" + publicationDate + "</td>");
			}
			break;
		}
	}
}
/// <author>Chbeir Elias</author>
/// <summary>
/// Show the content of a HTML string in a DIV whatever is the browser
/// </summary>
/// <returns>Nothing</returns>
function DisplayList(monthsString, _layer, _secLayer)
{
	var NS  = navigator.appName == "Netscape";
	var NS5 = (NS && parseInt(navigator.appVersion) > 4);
	var NS4 = (document.layers) ? true : false;
	var IE4 = (document.all) ? true : false;

	if (NS4)
	{
		listToDisplay = "<span>" + monthsString + "</span>";
		
		eval("document." + _layer + ".document." + _secLayer + ".document.write(monthsString)"); 
		eval("document." + _layer + ".document." + _secLayer + ".document.close()");
		//alert("NS4");
	}
	else 
	{
		if (NS5) 
		{
			eval("document.getElementById('" + _secLayer + "').innerHTML = monthsString");
			//alert("NS5");
		}
		else
		{
			// IE4+
			eval(_secLayer + ".innerHTML = monthsString");
		}
	}
}
//////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Show all of the sub items within a module,
/// hiding items in all other modules exceeding rowsToShow
///
/// modif SDB - January 7th 2004
/// implementing function "ShowSubThemes(themeID)" to get it Netscape-compliant
/// </summary>
// modif BVE - document.getElementById replaces document.all for w3c-compliancy (eg firefox)

function ShowSubItems(module)
{	
	var verTodosItem;
	var itemModule;
	
	//changing image
	//switchImg(module);
	
	// start with showing items (not exceeding rowsToShow) in all modules
	//ShowItems();
	ShowSimplyItems();
	
	// for every module, except current one, reset the hyperlink id to show
	/*for (var item = 0; item < Items.length; item++)
	{
		itemModule = Items[item];
			
		if (itemModule.toString().toLowerCase() != module.toString().toLowerCase())
		{
			verTodosItem = document.all(itemModule + "_hide");
			
			
			if (verTodosItem != null)
			{
				itemModule = itemModule.toString().toLowerCase();
				if (verTodosItem.toString().toLowerCase().indexOf(itemModule) >= 0)
					document.all(itemModule + "_hide").id = itemModule + "_show";
			}
		}
	}*/

	// get hyperlink object of current module to see if we need to show or hide items in module
	verTodosItem = document.getElementById(module + "_hide");
	
	// if hide was on then set hyperlink id to show and hide items exceeding rowsToShow
	if (verTodosItem != null)
	{
		document.getElementById(module + "_hide").id = module + "_show";
		
		var noOfRows = 0;
		
		for (var id = 1; id < IDs.length; id++)
		{
			if (IDs[id].toString().indexOf(module + "_") >= 0)
			{
				noOfRows++;
				if (noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.getElementById(IDs[id]).style.display = "block";	
				}
				else
				{
					document.getElementById(IDs[id]).style.display = "none";	
				}
			}
		}
	}
	
	// if show was on then set hyperlink id to hide and show all items
	if (verTodosItem == null)
	{
		document.getElementById(module + "_show").id = module + "_hide";
		
		for (var item = 1; item < IDs.length; item++)
		{
			if (IDs[item].toString().indexOf(module) >= 0)
				document.getElementById(IDs[item]).style.display = "block";
		}	
	}		
}


//////////////////////////////////////////////////////////////

/// <author>De Bisschop Sabine</author>
/// <summary>
/// switch button image more/less items
/// </summary>

/*function switchImg(module)
{
	moreItems = eval("document.img" + module).src.toString().indexOf("moreItems");
	lessItems = eval("document.img" + module).src.toString().indexOf("lessItems");
	
	
	//if yet a button in - view, reset it to + view
	if(moreItemsIMG.toString() != "")
	{
		eval(moreItemsIMG.toString()).src = "/site_images/" + lang + "/moreItems.gif";
	}
	
	//on image click, switch more / less 
	if (moreItems > 0)
	{
		eval("document.img" + module).src = "/site_images/" + lang + "/lessItems.gif";
		moreItemsIMG = "document.img" + module;
	}
	else if (lessItems > 0)
	{
		eval("document.img" + module).src = "/site_images/" + lang + "/moreItems.gif";
		moreItemsIMG = "";
	}		
}*/

/////////////////////////////////////////////////////////////////


/// <author>De Bisschop Sabine</author>
/// <summary>
/// Show only a certain number of rows (sub items) in required TYPE module(s)
/// hide the others items in the module(s)
/// </summary>

/// modif BVE: getElementById, loose the lang-param
function ShowSimplyItems()
{
	var module = "";
	var noOfRows = 0;
	//mLang = lang;
	
	// form every module, show a certain number of items
	for(var k=0; k < TypeItems.length; k++)
	{
		module = TypeItems[k].toString();
		noOfRows = 0;
		
		// loop only within elements having the module in theis id;
		// as an example : if "MThemList" is a module, the the id must be as "MThemList_123456"
		
		for(var id = 1; id < IDs.length; id++)
		{			
			if(IDs[id].toString().indexOf(module + "_") >= 0)
			{
				noOfRows++;
				if(noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.getElementById(IDs[id]).style.display = "block";
				}
				else
				{				
					document.getElementById(IDs[id]).style.display = "none";
				}
			}			
		}		
		
	}
}


/////////////////////////////////////////////////////////////////

/*
	All previous requests of the form are kept in the querystring while in fact 
	we only need what was last submitted by the form.
	We need to rebuild the action url otherwise the querystring will grow bigger 
	on every request of the form with unwanted values.	
	The function BuildQueryString takes care of adjusting the url with only what is 
	needed by the url for the .NET page as well as for the ASP page.
*/

function BuildQueryString(formName, act)
{
	var theForm = eval("document." + formName);
	var action  = act; 
	//window.alert(action);
	// if action's url has a querystring
	if (action.indexOf("?") > 0)
	{
		// get the Querystring from the action url
		var querystr = action.split("?")[1]; 
		//window.alert("querystring= " + querystr);
		
		// reset the action of the url without the querystring
		action = action.split("?")[0];		
		//window.alert("action without querystring= " + action);

		// split the querystring into its parts (separated by the "&")
		var parts = querystr.split("&");
		var partName = "";
		
		for (var part = 0; part < parts.length; part++)
		{
			partName = parts[part].split("=")[0];
			// check the query part's names and add to the action url 
			// querystring only what is needed for the .Net page
			if ((partName.toLowerCase() == "show")||(partName.toLowerCase() == "asp_page")
				||(partName.toLowerCase() == "src"))
			{
				action += (action.indexOf("?") < 0) ? "?" : "&";
				action += parts[part];
			}
		}
	}

	// add the form elements to the action url querystring	
	for (var i = 0; i < theForm.elements.length; i++) {
		var name = escape(theForm.elements[i].name);
		//exception for radiobutton pricesinvest
			if( name != "productRadio"){
		
		if (name != "") {
			action += (action.indexOf("?") < 0) ? "?" : "&";		
			var str = name + "=" + escape(theForm.elements[i].value);
			
			// exception for checkbox
			if (name.toLowerCase() == "enfant")
				if (theForm.elements[i].checked == false)
					str = name + "=";
			action += str;
		}
		}
	}
	//window.alert("action = " + action);	
	return action;
}

/// <author>De Bisschop Sabine</author>
/// <summary>
/// Show/Hide layers, by passing info (layer name + show/hide) as parameter
/// </summary>	

function showHideLayers() 
{ 
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=FindObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


function FindObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


//////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------------------
//Search

function setFirstSubmit(frm, PageFirst)
{
	frm.first.value = PageFirst;
	frm.submit();
}

function setFirstZero(frm)
{
	frm.first.value = 0;
}

function setFirstZeroSubmit(frm)
{
	setFirstSubmit(frm, 0);
}

function setShowAndSubmit(frm, show)
{
	frm.show.value = show;	
	setFirstZeroSubmit(frm);
}

function Submit(frm)
{
	frm.submit();
}

/// <author>Tanghe Niko</author>
/// <summary>
/// Add value of all checkboxes (Only take checkboxes that have no name set)
/// to hidden form variable "categories"
/// </summary>	

function SubmitAdvancedForm(frm)
{
    var categories
	categories = "";
	for (var i = 0; i < frm.elements.length; i++) 
	{
		var name = escape(frm.elements[i].name);
		var type = frm.elements[i].type;
		var alt = frm.elements[i].alt;
		if (name == "" && type == "checkbox" && alt == "category") 
		{
			//when a categorie is checked, 
			//it mean include in search
			if (frm.elements[i].checked == false)
				categories += "1";
			else
				categories += "0";
		}
	}
	frm.cat.value = categories;
	Submit(frm);
}
//----------------------------------------------------------------------------------------


///////////////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Get the selected node from the url by searching for the 'src' value in a url
/// </summary>
/// <returns>selected node</returns>
function GetSelectedNodeFromUrl()
{
	var subparts;
	var partname;
	var nodeFromUrl = 0;
	
	// get desired value from querystring
	var querystring = document.location.search;
	var queryparts  = querystring.split("&");
	
	for(var i = 0; i < queryparts.length; i++)
	{
		subparts = queryparts[i].split("=");
		partname = subparts[0].toString();
		
		if(partname.toLowerCase() == "src")
			nodeFromUrl = subparts[1];
	}
	
	// if isapi filter used (ex. "/map/show/111/src/11.htm")
	if(querystring == "")
	{
		var url = document.location;
		
		if(url.toString().indexOf("src") >=0)
		{
			queryparts = url.toString().split("src/");
			var src = queryparts[1];
			
			if(src.toString().indexOf("/") >= 0)
			{
				queryparts = src.toString().split("/");
				nodeFromUrl = queryparts[0];
			}
			else
			{
				queryparts = src.toString().split(".");
				nodeFromUrl = queryparts[0];
			}
		}
	}
	
	return nodeFromUrl;
}


/////////////////////////////////////////////////////////////////
/// <author>SDB</author>
/// <summary>
/// Show content of FAQ
/// </summary>
/// <returns>selected node</returns>
function showFAQ(id)
{
   var selection = "";
   var openedID = id;
   hideAllFAQ(); //hide all content
   
   //on first pageload, show first item
   (id!="")?selection="_"+id:selection="";
  
    
    var x = document.getElementsByTagName('div');
    
    for (var i=0;i<x.length;i++)
    {
	    if (x[i].id.indexOf('FAQ'+ selection) > -1)
	    {
	        //if has content, show content
	       if(x[i].innerHTML.toString().substr(x[i].innerHTML.toLowerCase().indexOf("</h3>")+5,x[i].innerHTML.toString().length) != "") //show by default first
	        {
	            if(openedID == ""){ openedID = x[i].id.substr(4,x[i].id.length);}
	            x[i].style.display = "block";
	            break;
	        }
	    }
    }
  //open menulist on first page load  
  document.getElementById("li_" + openedID).innerHTML = "<strong>" + document.getElementById("li_" + openedID).innerHTML + "</strong>";
    
  document.getElementById('dossierContent').style.height = document.getElementById('menuDossier').offsetHeight;
}

function hideAllFAQ()
{
    var x = document.getElementsByTagName('div');
    for (var i=0;i<x.length;i++) 
    {
	    if (x[i].id.indexOf('FAQ') > -1)
		    x[i].style.display = "none";
    }   
}

/////////////////////////////////////////////////////////////////

function getTypename(typeid,lang){
	if(lang==1){
		switch(typeid){
			case 4 : return "Artikel";break;
			case 35 : return "Bereken zelf";break;
			case 36 : return "Dossier";break;
			case 9 : return "Geactualiseerde tabel";break;
			case 73 : return "Geactualiseerde tabel";break;
			case 63 : return "Prijzen";break;
		}
	}
	else{
		switch(typeid){
			case 4 : return "Article";break;
			case 35 : return "Calculez";break;
			case 36 : return "Dossier";break;
			case 9 : return "Tableau actualis&eacute;";break;
			case 73 : return "Tableau actualis&eacute;";break;
			case 63 : return "Prix";break;
		}	
	}
}
function setCookie(name, value){  	
		document.cookie = name + "=" + escape (value) + "; expires=" + date.toGMTString() + "; path=/";
	}
function getCookie(name) 
	{  
		var arg = name + "=";  
		var alen = arg.length;  
		var clen = document.cookie.length;  
		var i = 0;  
		while (i < clen) 
		{    
			var j = i + alen;    
			if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
			i = document.cookie.indexOf(" ", i) + 1;    
			if (i == 0) break;   
		}  
		return '';
	}
function getCookieVal(offset) 
	{  
		var endstr = document.cookie.indexOf (";", offset);  
		if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
	}	
function setTextSize(pct){
	document.getElementsByTagName('body').item(0).style.fontSize= pct + '%';
	var fonts='a';
	if (pct == '100')fonts='a';
	if (pct == '120')fonts='aa';
	if (pct == '140')fonts='aaa';	
	if (pct == '160')fonts='aaa';	
	setCookie( 'nbfsize', fonts);
}		
function getTextSize(){

	var cookieFSize = getCookie('nbfsize');
	if (cookieFSize == null){
		cookieFSize= 'aa';
	}
	if (cookieFSize == 'a')setTextSize('100');
	if (cookieFSize == 'aa')setTextSize('120');
	if (cookieFSize == 'aaa')setTextSize('140');
	if (cookieFSize == 'aaaa')setTextSize('160');
}

//function to hide subtheme-elements after html is written
function hidelistelements(){
var x=document.getElementById("centralColumn").getElementsByTagName("ul");
for(i=0;i<x.length;i++){
	var j;
	for(j=0;j<x[i].getElementsByTagName("li").length;j++){
		if(j>4) x[i].getElementsByTagName("li")[j].style.display='none';
	}
	if(x[i].getElementsByTagName("li").length<=5){
		x[i].parentNode.getElementsByTagName("div")[0].style.display='none';
		
	}
}
}
//function to show/hide html-elements of a type in subtheme-page, author BVE
function togglevisibility(startdiv,lang){
var captions = new Array();
captions[0] = new Array();
captions[1] = new Array();
captions [0][0] = "+ meer items";
captions [0][1] = "- minder items";
captions [1][0] = "+ voir plus";
captions [1][1] = "- voir moins";
if(startdiv.value==captions[lang][0]){
	startdiv.value=captions[lang][1];
	for(j=0;j<startdiv.parentNode.parentNode.getElementsByTagName("ul")[0].getElementsByTagName("li").length;j++){
		startdiv.parentNode.parentNode.getElementsByTagName("ul")[0].getElementsByTagName("li")[j].style.display='block';
	}
	}
else{
	startdiv.value=captions[lang][0];
	for(j=0;j<startdiv.parentNode.parentNode.getElementsByTagName("ul")[0].getElementsByTagName("li").length;j++){
		if(j>4) startdiv.parentNode.parentNode.getElementsByTagName("ul")[0].getElementsByTagName("li")[j].style.display='none';
	}
	}
}
/*social bookmark functions*/
function is_child_of(parent, child) {
			if( child != null ) {			
				while( child.parentNode ) {
					if( (child = child.parentNode) == parent ) {
						return true;
					}
				}
			}
			return false;
		}
function fixOnMouseOut(element, event, JavaScript_code) {
	var current_mouse_target = null;
	if( event.toElement ) {				
		current_mouse_target 			 = event.toElement;
	} else if( event.relatedTarget ) {				
		current_mouse_target 			 = event.relatedTarget;
	}
	if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
		eval(JavaScript_code);
	}
}
function openbookwidget(src){
	url = location.href;
	title = document.title;
	box.style.display="block";
}
function closebookwidget(e){
		box.style.display="none";
	}
function addToFavs(){	
	if (document.all)window.external.AddFavorite(url,title); 
    else window.sidebar.addPanel(title,url,''); 
}
function openwindow(socialsite){	
	switch(socialsite){
		case 'g':
  			composedurl = "http://www.google.com/bookmarks/mark?op=add&bkmk="+encodeURIComponent(url)+"&title="+encodeURIComponent(title);
 		 	break;
		case 'm':
  			composedurl = "http://www.myspace.com/Modules/PostTo/Pages/?c="+encodeURIComponent(url)+"&t="+encodeURIComponent(title);
  			break;
		case 'f':
  			composedurl = "http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(title);
  			break;
		case 'l':
  			composedurl = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=be-nl&url="+encodeURIComponent(url)+"&title="+encodeURIComponent(title);
  			break;
		case 'di':
  			composedurl = "http://digg.com/submit?phase=2&url="+encodeURIComponent(url)+"&title="+encodeURIComponent(title);
  			break;
		case 'de':
  			composedurl = "http://del.icio.us/post?v=4;url="+encodeURIComponent(url)+"&title="+encodeURIComponent(title);
  			break;
		case 'msn':
  			composedurl = "http://reporter.be.msn.com/?fn=contribute&Title="+encodeURIComponent(title)+"&URL="+encodeURIComponent(url);
  			break;
		case 'msnfr':
  			composedurl = "http://reporter.fr.be.msn.com/?fn=contribute&Title="+encodeURIComponent(title)+"&URL="+encodeURIComponent(url);
  			break;
		case 'b':
  			composedurl = "http://www.bligg.be/submit.php?url="+encodeURIComponent(url);
  			break;
		case 's':
  			composedurl = "http://www.stumbleupon.com/submit?url="+encodeURIComponent(url)+"&title="+encodeURIComponent(title);
  			break;
		default:
			addToFavs();
	}	
	window.open(composedurl,'bookmark','width=800,height=600,scrollbars=yes,toolbar=no,location=yes');
}

function RemoveHomePageLastRowsRule() {
    var homePageRowsElement = document.getElementById('HomePageRows');
    if (homePageRowsElement) {
        var rowsCount = homePageRowsElement.childNodes.length;
	if (navigator.userAgent.indexOf("Firefox")!=-1)
	{
        	homePageRowsElement.childNodes[rowsCount - 4].className += " noBottomBorder";
	}
	else
	{
        	homePageRowsElement.childNodes[rowsCount - 2].className += " noBottomBorder";
	}
    }
}


function ChangeGuideURLInSubThemePage() 
{
    $('a').each(function() {
        if ($(this).attr('typename') == "Guide") {
            if (lang == "NL") {
                $(this).attr('href', 'http://gidsen.test-aankoop.be');
                $(this).attr('target', '_blank');
            } else {
                $(this).attr('href', 'http://guides.test-achats.be');
                $(this).attr('target', '_blank');
            }
        }
    }); 
}