// ##### Dit bestand is gebranched naar Landal v7 #####

var detect = navigator.userAgent.toLowerCase();
var lbSearch;
var OS,browser,version,total,thestring;
if (checkIt('konqueror')){
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')){
	browser = "Netscape Navigator"
	version = detect.charAt(8); 
	
	if(checkIt('netscape')) {
		x=false;
		y=0;
		thisversion = "";
		while(!x) {
			version = detect.charAt(place+y + thestring.length);
			if(version==";" || version==" " || version=="") x = true;
			else
			{	thisversion = thisversion+version
				y=y+1;
			}
		}
		version= thisversion;
	}
	
	
}
else browser = "An unknown browser";

if (!version){
	x=false;
	y=0;
	thisversion = "";
	while(!x){
		version = detect.charAt(place+y + thestring.length);
		if(version==";" || version==" " || version=="") x = true;
		else
		{	thisversion = thisversion+version
			y=y+1;
		}
	}
	version= thisversion;
}

if (!OS){
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string){
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

/*--Show shadow----------------------------*/
function show_shadow(){
	if (browser == "Netscape Navigator" || (browser == "Safari" && version >= 1.2 ) || (browser == "Internet Explorer" && version >= 5.5))
		document.getElementById('shadowcontainer').style.display = 'block';
}

/*--Fontsizing-------------------------------------*/
function setActiveSS(title) { 
	var i, a, main; 
	for (i=0; (a = document.
	getElementsByTagName("link")[i]); i++) 	{
		if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) 
		{ 
			a.disabled = true;
			if(a.getAttribute("title") == title)
			{	a.disabled = false; }
		} 
	}
	if (window.document.kop2) 
	{
		if(title != null)
			flashFunc('recolor', title.toLowerCase());
	}
}

function getActiveSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title"); } return null; }
function getPreferredSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; }
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 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; }
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredSS();
if(title!=null) setActiveSS(title);


/*--Sizing and positioning ----------------- */
//v7 - newFooter **********************************


function setupGrid() {	
    
    /*if(document.getElementById('siteContainer')!=null)
    {
        if($('siteContainer').getHeight() < document.viewport.getHeight())
            document.getElementById('siteContainer').style.height = (document.viewport.getHeight()-15) + "px";
        else
            document.getElementById('siteContainer').style.height = 'auto';
        return false;
    }*/
    resetGrid();
	//disable language panel for setupGrid
	if ($('p_language')!=null){
	   
	    $('p_language').style.display = 'none';
    	
	    //Get viewport height
	    var x,y;
	    if (self.innerHeight) // all except Explorer
	    {
		    x = self.innerWidth;
		    y = self.innerHeight;
		        //alert('all except Explorer '+y);
	     }
	    else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 + 7 Strict Mode
	    {
		    x = document.documentElement.clientWidth;
		    y = document.documentElement.clientHeight;
		        //alert('IE6 Strict '+y);
	     }
	    else if (document.body) // other Explorers
	    {
		    x = document.body.clientWidth;
		    y = document.body.clientHeight;
		        //alert('other Explorers '+y);
	    }

        //If viewport is not 0
	    if (y > 0) {
    			
			    //Get element Heights
		        if($('navigation') != null && $('navigationBottom') != null) {
		            var navigationHeight = $('navigation').offsetHeight;// - $('navigationBottom').offsetHeight;
                }
                else navigationHeight = 0;

			    if($('contentContainer') != null) var contentHeight = $('contentContainer').offsetHeight; 
			    else if($('content') != null) contentHeight = $('content').offsetHeight ; 
			    else contentHeight = 0; 

		        if($('container') != null) var containerHeight = $('container').offsetHeight;
		        else containerHeight = 0;
		        
		        if($('panelsBottom') != null) var panelsBottomHeight = $('panelsBottom').offsetHeight;
		        
		        if($('panels') != null) var panelHeight = $('panels').offsetHeight; 
		        else panelHeight = 0;
		        
		        
    		    
                //Identify new footer (constructed out of 2 types of footers)
			    if($('footer') != null) var footerElement = $('footer');
			    if($('footerContainer') != null) var footerContainerHeight = $('footerContainer').offsetHeight;
			    if($('newFooter') != null) var footerNewElement = $('newFooter');
			    if($('breadcrumb') != null) var breadcrumbElement = $('breadcrumb');
    		    
		        if(footerElement != null && footerNewElement != null) { //If footer is available
		            //var footerHeight  = footerElement.offsetHeight ;
		            
		            var footerHeight  = breadcrumbElement.offsetHeight ;
		            var footerNewHeight = footerNewElement.offsetHeight; 
		                //alert('footerHeight = '+ footerHeight); 
		        }

                if($('footerContainer') !=null && footerContainerHeight !=null && footerHeight !=null){
                    footerContainerBottom =  (0 - footerContainerHeight+footerHeight) + 'px';
                    $('footerContainer').style.bottom = footerContainerBottom;
                }
                else
                {
                    return;
                }
                if(footerElement!=null)
                    footerElementHeight = footerElement.offsetHeight-110;
                else
                    footerElementHeight = 0;
                
                contentHeight = contentHeight + footerHeight;
                
                //Get highest column of the three and set the container to this height
                // is navigation the highest div?
                generalHeight = 0;
                winner = '';
                if((navigationHeight-footerElementHeight)>=(contentHeight-18) && navigationHeight>=panelHeight) 
                {   
                    generalHeight = navigationHeight;//-footerElementHeight;
                    winner = 'navigation';
                }
                // is content(Container) the highest div?
                else if((contentHeight-18)>=navigationHeight && (contentHeight-18)>=panelHeight)
                {
                    generalHeight = contentHeight;
                    winner = 'contentContainer';
                }
                // is panels the highest div?
                else if(panelHeight>=navigationHeight && panelHeight>=(contentHeight-18))
                {   
                    generalHeight = panelHeight+45;
                    winner = 'panels';
                }
                

                if(winner !='contentContainer')
                    generalHeight = generalHeight - (footerContainerHeight-footerHeight-18);
                
                if(contentHeight>generalHeight) generalHeight = contentHeight;
                
                containerHeight = generalHeight+footerContainerHeight-footerHeight;
                

                 //Set element heights
		        if($('shadowcontainer')!=null) $('shadowcontainer').style.height = containerHeight + 'px';		//Zet de schaduwlayer op hoogte voor de shadows
		        if($('shadowbar')!=null) $('shadowbar').style.height = containerHeight + 'px';		//Zet de schaduwlijnen op hoogte voor de shadows
                
                $('navigation').style.height = containerHeight + 'px';			//Zet de navigation layer op hoogte voor de kleur                
                if($('menubanners')!=null) var menuBannersHeight = $('menubanners').offsetHeight; 
                else var menuBannersHeight = 0; 
                
                theNavHeight = 0;
                if($('flashcontent')!=null) theNavHeight = $('flashcontent').offsetHeight;
                if($('nav')!=null) theNavHeight = $('nav').offsetHeight;
                
                try {
					$('navigationBottom').style.height = ($('navigation').offsetHeight - theNavHeight - $('navLogo').offsetHeight - menuBannersHeight )  + 'px';
				}
	            catch(e) { }
    		    
			    /**/
			        if($('contentContainer') != null) 
			            $('contentContainer').style.height = generalHeight + 'px';
			        else if($('content') != null) 
			            $('content').style.height = containerHeight  + 'px';


                //Panels are not always available
		        if ($('panels') != null && $('panelsBottom')!=null)
		        {   try {
		                $('panelsBottom').style.height = (containerHeight - 36 - panelHeight)  + 'px';
		            }
		            catch(e) {}
			        $('panels').style.height = (containerHeight - 47) + 'px';
			        
		        }	

		    }
		    //End If viewport is not 0
    				
		    if ($('mainnavtabbed') != null) $('mainnavtabbed').style.visibility = 'visible';
	  }
	  else if ($('p_language')==null) {
    	    //alert("p_language==null omdat er te snel op de kaart tab is gedrukt de p_language div is nog niet gegenereerd");
	    }
}

function resetGrid () {
    if($('navigation')!=null)$('navigation').style.height = 'auto';
    if($('navigationBottom')!=null)$('navigationBottom').style.height = 'auto';
    if($('panels')!=null)$('panels').style.height = 'auto';
    if($('panelsBottom')!=null)$('panelsBottom').style.height = 'auto';
	if($('content')!=null)$('content').style.height = 'auto';
	if($('container')!=null)$('container').style.height = 'auto';
	if($('contentContainer')!=null)$('contentContainer').style.height = 'auto';
	if($('footer')!=null)$('footer').style.height = 'auto';
}

var gridonload = window.onload;
window.onload = function() {
	gridonload; 
	setupGrid();
	
    var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredSS(); setActiveSS(title);
    if(typeof loadGMap == 'function') { 
	  //  loadGMap(); 
    }
};


window.onunload = function() {  
 if(typeof GUnload == 'function') { 
        GUnload(); 
    }
    var title = getActiveSS(); if(title!=null) { createCookie("style", title, 365);}
};	

window.onresize = function() {
	resetGrid();
	setupGrid();
}

function openConditionsDIV(event, id) {
    //alert(event.clientY);
    if(id==null) id='conditionsDiv';
    hDiv = $(id).getHeight();
    yDiv = 0;
    if(event.pageY!=null) yDiv = event.pageY;
    if(event.y!=null)     yDiv = event.y;
    
    yDiv = yDiv-hDiv-20;
    if(yDiv<0) yDiv = 0;
    
    $(id).style.top = yDiv+'px';
    $(id).style.display='block';
    
}	

 
function bandWidthDetection() {
	// indien de band breedte tester aanwezig is, moet deze gestart worden,
	// wanneer de pagina geladen is.
	var fo = new FlashObject("/swf/bandwidthdetect.swf", "bandwidthdetect", "1", "1", "6","#FFFFFF");
	fo.addVariable("loadfilename", "/swf/bandwidthload.swf");
	fo.addVariable("startloading","true");
	fo.write("bandwidth");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
 }

function ganaar_back(content_id) {
  var get_vars = new Array();
  var search = location.search.substr(1);
  search = unescape(search);
  
  var pairs = search.split('&');
  for (var i = 0; i < pairs.length; i++) {
	var items = pairs[i].split('=');
	get_vars[unescape(items[0])] = items[1];
  }
  var strHref = '/template3.aspx?cp=vervolg&vervolgid=' + content_id;
  if (get_vars['menu'] != null)
	strHref += '&menu=' + get_vars['menu'] + '&mid=' + get_vars['mid'];
  else
	if (get_vars['mid'] != null)
	{
		strHref += '&mid=' + get_vars['mid'];
	}
  location.href = strHref
}

function ganaar_backHTML(content_id) {
  var get_vars = new Array();
  var search = location.search.substr(1);
  search = unescape(search);
  
  var pairs = search.split('&');
  for (var i = 0; i < pairs.length; i++) {
	var items = pairs[i].split('=');
	get_vars[unescape(items[0])] = items[1];
  }
  var strHref = '/template3.aspx?cp=vervolghtml&vervolgid=' + content_id;
  if (get_vars['menu'] != null)
	strHref += '&menu=' + get_vars['menu'] + '&mid=' + get_vars['mid'];
  else
  {
	if (get_vars['mid'] != null)
	{
		strHref += '&mid=' + get_vars['mid'];
	}
  }
  location.href = strHref
}

function ganaar_backHTML(content_id, mid, menu, parkcode) {
  var strHref = '/template3.aspx?cp=vervolghtml&vervolgid=' + content_id;
  if (menu != null)
	strHref += '&menu=' + menu;
  
  if (mid != null)
	strHref += '&mid=' + mid;

  if (parkcode != null)
	strHref += '&parkcode=' + parkcode;
  
  location.href = strHref
}

function ganaar_back_Palestra(content_id) {
  var get_vars = new Array();
  var search = location.search.substr(1);
  search = unescape(search);
  
  var pairs = search.split('&');
  for (var i = 0; i < pairs.length; i++) {
	var items = pairs[i].split('=');
	get_vars[unescape(items[0])] = items[1];
  }
  var strHref = 'default_palestra.aspx?cp=palestracontent&vervolgid=' + content_id;
  
  if (get_vars['menu'] != null)
	strHref += '&menu=' + get_vars['menu'] + '&mid=' + get_vars['mid'];
  else
	strHref += '&mid=' + get_vars['mid'];;
  location.href = strHref
}

function popUp(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	if (strType=="console") strOptions="location=yes,menubar=no,status,height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}


function showInfoActiecode() {
	
	if(document.getElementById('actiecodeInfopanel')!=null)
	{	thePanel = document.getElementById('actiecodeInfopanel');
//	thePanel.style.display='block';
	
		var fromTop = document.getElementById('actiecode').offsetTop; //236
	
	    var tmpMargin = parseInt(fromTop-285+110);
	    if(tmpMargin < 100)tmpMargin = Math.abs(tmpMargin);
	    
		thePanel.style.top = parseInt(tmpMargin) +"px";
	}
	
}

function showEigenarenPanel() {
	
	if(document.getElementById('eigenarenInfopanel')!=null)
	{	
	    thePanel = document.getElementById('eigenarenInfopanel');
	    thePanel.style.visibility = "visible";
		thePanel.style.top = "250px";
	}
	
}
function hideInfoActiecode() {
	thePanel = document.getElementById('actiecodeInfopanel');
	thePanel.style.top = -500 +"px";
	
}

function hideEigenarenPanel() {
	thePanel = document.getElementById('eigenarenInfopanel');
    thePanel.style.visibility = "hidden";
	thePanel.style.top = -500 +"px";
}

//-->

/* PULLDOWN */
/* CSS-names */
/*
    #seoPulldownContainer
    .seoPulldown
    .seoPulldownCurrent
    
*/

var pulldownHeight = 410; 
var pulldownCurrent = null;
var hidePulldownContainer = document.forms[0];
var el = null;

function pullDownOpen(theElement,container)
{   hidePulldownContainer = document.getElementById(container);
    if(pulldownCurrent!=null) { 
        if(theElement==pulldownCurrent)
        {
            pullDownClose(false); 
            return false;
        }
        else
        {
            pullDownClose(false); 
        }

    }

    pulldownCurrent = theElement;
    pulldownHeight2 = pulldownHeight + 21; 
   
    if(document.getElementById(theElement)!=null)
    {
        el = document.getElementById(theElement);
        
        if(el.style.height!='' && el.style.height!='18px') { pullDownClose(false);return;  }
        
        for (i=0; i<el.childNodes.length; i++) {
	        node = el.childNodes[i];
	        if (node.nodeName=="UL") { 
                theUL = node;
                theUL.style.overflowY = "scroll";
	        }
        }
        el.style.zIndex = '999';
        if(browser=="Internet Explorer") hidePulldownContainer.className += "";
        if(browser=="Internet Explorer" && version=="6.0")   hidePulldownContainer.className += " pullDownOpen";
        
        if(window.opera)
        {  el.style.height = 'auto';  }
        else
        {  if(theUL.offsetHeight<pulldownHeight2) { el.style.height = 'auto';  el.style.overflow = 'auto'; /*theUL.style.overflowY = 'hidden'; */ }
           else  { el.style.height = pulldownHeight2+'px';  theUL.style.height = pulldownHeight+'px';}
        }
   }
}

function pullDownClose(e)
{  
    if(e!=false)
    {   
        e = e || window.event;
        var obj = e.target || e.srcElement;
        
        theClass = obj.className;
        
        theClass = theClass.toLowerCase();
        
    }
    else theClass = "";
    
    if(theClass.indexOf("seopulldowncurrent") < 0 && document.getElementById(pulldownCurrent)!=null)
    {   
        el = document.getElementById(pulldownCurrent);
       
        el.style.height = '18px'; 
        el.style.overflow = 'hidden';
        el.style.zIndex = '1';

        for (i=0; i<el.childNodes.length; i++) {
	        node = el.childNodes[i];
	        if (node.nodeName=="UL") { 
                theUL = node;	
                if(browser!="Internet Explorer") theUL.style.overflow = "hidden";    
	        }    
        }        
        
        pulldownCurrent = null;
        
        if(browser=="Internet Explorer" && version=="6.0")  hidePulldownContainer.className = hidePulldownContainer.className.replace(" pullDownOpen", "");
    }
}

function pulldownSelect(theText,currentEl,thisEl)
{
    if(document.getElementById('seoPulldownSelected')!=null) 
    {
        if(document.getElementById('seoPulldownSelected').className.indexOf("seopulldowncurrent") > -1)
        {
            document.getElementById('seoPulldownSelected').className.replace("seoPulldownSelected", "");
        }
        document.getElementById('seoPulldownSelected').className = "";
        document.getElementById('seoPulldownSelected').id = "";
        
    }

    
    if(document.getElementById(currentEl)!=null)
    {
        curEl = document.getElementById(currentEl);
        curEl.innerHTML = theText;
        thisEl.className += " seoPulldownSelected";
        thisEl.id = "seoPulldownSelected";

    }
}

function pulldownSelectAccommodation(theText,currentEl,thisEl,accommodationNumberOfPersons)
{
	if(accommodationNumberOfPersons != null)
	{
		//alert('setCookie accommodationNumberOfPersons');
		setCookie('accommodationNumberOfPersons', accommodationNumberOfPersons);
	}

    if(document.getElementById('seoPulldownSelected')!=null) 
    {
        if(document.getElementById('seoPulldownSelected').className.indexOf("seopulldowncurrent") > -1)
        {
            document.getElementById('seoPulldownSelected').className.replace("seoPulldownSelected", "");
        }
        document.getElementById('seoPulldownSelected').className = "";
        document.getElementById('seoPulldownSelected').id = "";
        
    }

    
    if(document.getElementById(currentEl)!=null)
    {
        curEl = document.getElementById(currentEl);
        curEl.innerHTML = theText;
        thisEl.className += " seoPulldownSelected";
        thisEl.id = "seoPulldownSelected";

    }
}
 
/* PULLDOWN end */


function initTabs() 
{   
	if($('contentContainer') != null)
	{
		if($('contentContainer').select(".tabNav")==null) return   
		tabContainers = $('contentContainer').select(".tabNav");
		for (tc=0;tc<tabContainers.length;tc++)
		{   activeTab=0;
			tabsObj = tabContainers[tc].select('.tabNavTabs>ul>li>a');
	        
			for (i=0;i<tabsObj.length;i++)
			{   
				Event.observe(tabsObj[i], 'click', function (event) { 
					if(event.element().hasClassName("tabActive")==false)
					{   
	                
						thisTabObjArray = event.element().ancestors();
						for (k=0;k<thisTabObjArray.length;k++)
						{
							if(thisTabObjArray[k].className=='tabNav')
								thisTabObj = thisTabObjArray[k];
	                        
						}
						if(thisTabObj==null) return;
	                    
						el = thisTabObj.select('.tabNavTabs>ul>li>a');
						for (j=0;j<el.length;j++)
						{
							if(el[j].className=="tabActive")  
								el[j].removeClassName('tabActive');
						}                      
						event.element().addClassName("tabActive");
						for (j=0;j<el.length;j++)
						{ 
							if(el[j].className=="tabActive")  
								thisTabObj.select('.tabNavContent>ul>li')[j].addClassName("tabContentActive");
							else
								thisTabObj.select('.tabNavContent>ul>li')[j].removeClassName("tabContentActive");
						}
						setupGrid();                        
	                
					}
					Event.stop(event);
				});   
				if(tabsObj[i].className=="tabActive") {
					tabsObj[i].removeClassName("tabActive");
					activeTab = i;         
				}
			}
	        
			tabsObj[activeTab].simulate('click');
	        
		}
	}
}

var currentOnload;
if (window.onload) currentOnload= window.onload;
window.onload=function(){ 
    if(currentOnload)
        currentOnload();
    initTabs();
    //Event.observe(window, 'load', function (){ initTabs(); });
}

function accoFilterHide(hideSelector,effect)
{
    el = $("bungalowtypeFilter").select(hideSelector);
    for (i=0;i<el.length;i++)
    {
        if(el[i].visible()==true)
        {
            if(effect=="hide") el[i].hide() 
            if(effect=="slide") el[i].slideUp() 
            if(effect=="fade") el[i].fade() 
        }
    }
}
function accoFilterUnSelect(hideSelector)
{
    el = $("bungalowtypeFilter").select(hideSelector);
    for (i=0;i<el.length;i++)
    {
        el[i].ancestors()[0].removeClassName("selected");
    }
}

function accoFilterExtraheight(sel)
{
    anchors = sel.select("a");
    for (i=0;i<anchors.length;i++)
    {
        if(anchors[i].getHeight()>24 && anchors[i].hasClassName("extraHeight")==false)
        { anchors[i].addClassName("extraHeight");  }
    }
}

function initAccoFilter()
{   if($('bungalowtypeFilter')==null) return
    filterContainer = $('bungalowtypeFilter');
    filterAnchors = filterContainer.select("a");
    
    accoFilterHide("li.regionsCountry","hide");
    accoFilterHide("li.parcsRegion","hide");
    accoFilterHide("li.accosParc","hide");
    
    for (i=0;i<filterAnchors.length;i++)
    {   
        if(filterAnchors[i].readAttribute('href')=="#")
        {   
        
            Event.observe(filterAnchors[i], 'click', function (event) { 
                elID = event.element().identify();

                if(elID.startsWith('Country') && $("Regions"+elID).visible()!=true)
                {   
                    accoFilterUnSelect("li.country a");
                    accoFilterUnSelect("li.region a");
                    accoFilterUnSelect("li.parc a");
                    accoFilterHide("li.regionsCountry","hide");
                    accoFilterHide("li.parcsRegion","hide");
                    accoFilterHide("li.accosParc","hide");
                    
                    $("bungalowtypeFilterParcs").select(".makeChoice")[0].appear({duration: 0.4});
                    $("bungalowtypeFilterAccos").select(".makeChoice")[0].appear({duration: 0.4});
                    
                    Effect.Appear("Regions"+elID,{duration: 0.4,afterFinish: function( ) { setupGrid();}});
                    //$("Regions"+elID).show();
                    setTimeout("accoFilterExtraheight($('Regions'+elID))",100);
                    
                }
                
                if(elID.startsWith('Region') && $("Parcs"+elID).visible()!=true)
                {   
                    accoFilterUnSelect("li.region a");
                    accoFilterUnSelect("li.parc a");
                    accoFilterHide("li.parcsRegion","hide");
                    accoFilterHide("li.accosParc","hide");

                    $("bungalowtypeFilterParcs").select(".makeChoice")[0].hide();
                    $("bungalowtypeFilterAccos").select(".makeChoice")[0].appear({duration: 0.4});
                    
                    Effect.Appear("Parcs"+elID,{duration: 0.4,afterFinish: function( ) { setupGrid();}});
                    $("Parcs"+elID).show();
                    accoFilterExtraheight($("Parcs"+elID));
                }
                
                if(elID.startsWith('Parc') && $("Accos"+elID).visible()!=true)
                {   
                    accoFilterUnSelect("li.parc a");
                    accoFilterHide("li.accosParc","hide");

                    $("bungalowtypeFilterParcs").select(".makeChoice")[0].hide();
                    $("bungalowtypeFilterAccos").select(".makeChoice")[0].hide();
                    
                    Effect.Appear("Accos"+elID,{duration: 0.4,afterFinish: function( ) { setupGrid();}});
                    //$("Accos"+elID).show();
                }
                
                $(elID).ancestors()[0].addClassName("selected")
                
                setupGrid();
                Event.stop(event);
                
            });
        }
    }
    
    if(typeof(filterAnchors[0]) != 'undefined')
		filterAnchors[0].simulate('click');
	
	$("bungalowtypeFilter").select("ul.regions")[0].setStyle({ display : 'block'});
	$("bungalowtypeFilter").select("ul.parcs")[0].setStyle({ display : 'block'});
	$("bungalowtypeFilter").select("ul.accos")[0].setStyle({ display : 'block'});
	
    setupGrid();
}

var accoFilterOnload;
if (window.onload) accoFilterOnload= window.onload;
window.onload=function(){ 
    if(accoFilterOnload)
        accoFilterOnload();
    initAccoFilter();
    
}

function initFaqCategories() {   
    if($('faqFeedback'))  $('faqFeedbackPlaceholder').setStyle({ display : 'block'});
    if($('faqCategoryList')==null) { setupGrid(); return;}
    var faqCatContainer = $('faqCategoryList');

    if($('faqQuestions'))
    { 
        var faqCatAnchors = faqCatContainer.select("a");
        for (i=0;i<faqCatAnchors.length;i++)
        {   
            Event.observe(faqCatAnchors[i], 'click', function (event) { 
                
                filterFaqCats = $('faqQuestions').select(".faqSubCat");
                for (j=0;j<filterFaqCats.length;j++)
                {   
                    filterFaqCats[j].setStyle({ display : 'none'});
                }

                for (j=0;j<faqCatAnchors.length;j++)
                {   
                    faqCatAnchors[j].ancestors()[0].removeClassName("selected");  
                }

                elID = event.element().identify();
                catQuestions =  $(elID+"Questions");
                catQuestions.setStyle({ display : 'block'});
                event.element().ancestors()[0].addClassName("selected");
                setupGrid();
				$(elID+"Questions").scrollTo();
                Event.stop(event);
            });
        }
    }
    if($('faqCatListMore'))
    {
        Event.observe($('faqCatListMore'),'click', function (event) {
            $('otherCategory').setStyle({ display : 'block'});
            $('faqCatListMore').setStyle({ display : 'none'});
            $('faqCatListLess').setStyle({ display : 'block'});
            setupGrid();
            Event.stop(event);
        });
        
        Event.observe($('faqCatListLess'),'click', function (event) {
            $('otherCategory').setStyle({ display : 'none'});
            $('faqCatListMore').setStyle({ display : 'block'});
            $('faqCatListLess').setStyle({ display : 'none'});
            setupGrid();
            Event.stop(event);
        });
    }
    if($('faqCatPanel') && $('faqCategoryList'))
    {   
        faqCatItems = $('faqCatPanel').select('#faqCategoryList .faqCategory');
        faqCatHeaders = $('faqCatPanel').select('#faqCategoryList h4 span');
        
        for (i=0;i<faqCatHeaders.length;i++) {
            Event.observe(faqCatHeaders[i], 'click', function (event) { 

                closeCurrent = false; //var used to detect if the current item is open and clicked. 
                if(event.element().ancestors()[1].hasClassName("currentCategory")) { closeCurrent = true; }
                
                for (j=0;j<faqCatItems.length;j++)
                {   
                    if(faqCatItems[j].hasClassName("currentCategory"))
                    {
                        Effect.SlideUp(faqCatItems[j].select(".faqSubCatWrapper")[0], { duration: 0.6 });
                        faqCatItems[j].removeClassName("currentCategory");
                    }                
                    
                } 
                
                if(closeCurrent==true) return;
                
                event.element().ancestors()[1].addClassName("currentCategory");
                
                for (j=0;j<faqCatItems.length;j++)
                {   
                    if(faqCatItems[j].hasClassName("currentCategory"))
                    {
                        Effect.SlideDown(faqCatItems[j].select(".faqSubCatWrapper")[0], { duration: 0.6 });
                    }                
                } 
                setTimeout("setupGrid();",1000);

            });
            
        }
        for (j=0;j<faqCatItems.length;j++)
        {          
            if(!faqCatItems[j].hasClassName("currentCategory"))
            {
                faqCatItems[j].select('.faqSubCatWrapper')[0].setStyle({ display : 'none'});
            }
        }
    }
    
    
    
    setupGrid();

}

var faqCategoriesOnload;
if (window.onload) faqCategoriesOnload= window.onload;
window.onload=function(){ 
    if(faqCategoriesOnload)
        faqCategoriesOnload();
    initFaqCategories();
}

