var cban, rban;

function correctPNG() //handle PNG transparency in IE 6
{
 for(var i=0; i < document.images.length; i++)
 {
  var img = document.images[i];
  var imgName = img.src.toUpperCase();
    
  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  {
   var imgID = (img.id) ? "id='" + img.id + "' " : "";
   var imgClass = (img.className) ? "class='" + img.className + "' " : "";
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
   var imgStyle = "display:inline-block;" + img.style.cssText;
   
   if (img.align == "left") imgStyle = "float:left;" + imgStyle;
   
   if (img.align == "right") imgStyle = "float:right;" + imgStyle;
   
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;		
   
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
   + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
   img.outerHTML = strNewHTML
   i = i-1
  }
 }
}

function startList(idStr) //correct onmouseover event for ListItems in IE 6
{
	if (document.all&&document.getElementById) 
	{
		navRoot = document.getElementById(idStr);
		
		for ( i = 0; i < navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") 
			{
				node.onmouseover = function() 
				{
					this.className += " over";
				}
				node.onmouseout = function() 
				{
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}

function popupPic (pic, titel, _small, _big)
{

    pic = pic.replace(_small, _big);
    //alert(pic);
    var MyWindow=window.open( 'show.php?foto='+ pic, '', 'scrollbars=yes,status=no,toolbar=no,width=1024,height=800')
}

function actPic( active )
{
	var pic = document.getElementById('bigFoto');
        if(document.all)
	{
		pic.style.filter = 'blendTrans(duration=0.7)';
		pic.filters.blendTrans.Apply();
		pic.filters.blendTrans.Play();
	}
	pic.src = active;
}

function hideCheckboxTable( tableElement )
{
 if( tableElement )
 {
  tableElement.style.position = 'absolute';
  tableElement.style.visibility = 'hidden';
 }
}

function showCheckBoxTable( str )
{
 var str = str.toLowerCase();
 
 var arr = ["bedrijfsuitje","bootcamp","kinderfeestje","locatieverhuur"];
 
 for(var i=0; i < arr.length; i++ )
 {
  hideCheckboxTable( document.getElementById( arr[i]+'Onderdelen' ) );
  hideCheckboxTable( document.getElementById( arr[i]+'Opties' ) );
 }
 
 var tableOnderdelen = document.getElementById( str + 'Onderdelen' );
 var tableOpties     = document.getElementById( str + 'Opties' );
 
 if( tableOnderdelen )
 {
  tableOnderdelen.style.position = 'relative';
  tableOnderdelen.style.visibility  = 'visible';
 }
 
 if( tableOpties )
 {
  tableOpties.style.position = 'relative';
  tableOpties.style.visibility  = 'visible';
 }
}

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return (unescape(results[2])).split(',');
  else
    return null;
}

function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function addEntryToCookie (entry)
{
    
    if (val = getCookie('megahome'))
    {
        for (i = 0; i < val.length; i++)
        {
            if (val[i] == entry)
            {
                return;
            }
        }
        val.push(entry);
        setCookie ('megahome', val, 2020, 12, 12);
    }
    else
    {
        val = new Array();
        val.push (entry);
        setCookie ('megahome', val, 2020, 12, 12);
    }
}

function deleteEntryFromCookie (entry)
{
    val = getCookie('megahome');
    newval = Array();
    for (i = 0; i < val.length; i++)
    {
        if ( (val[i] != entry))
        {
            newval.push(val[i]);
        }
    }
    setCookie('megahome', newval, 2020, 12, 12);
    window.location = window.location;
}

function cBan (id, woningtype_id, project_id)
{
    //new Ajax.PeriodicalUpdater('bnnrc', 'ajax.php?action=updateBannerC&id=' + id + '&woningtype_id='+woningtype_id+'&project_id='+project_id , { frequency: 6});})
}

window.onload = function()
{ 
 /*
 var supported = /MSIE ((5\.5)|(6))/.test(navigator.userAgent) && navigator.platform == "Win32";
 
 if( supported )
 {
  startList('nav');
  startList('navRight');
  startList('navRight2');
  correctPNG();

 }
  eval(rban);
  eval(cban);
  
 showCheckBoxTable( 'bedrijfsuitje' );
 */
 enableTooltips();
}

