var win=null;
var myname="popup";
var scroll="no";
var pos="center";

function popup(mypage,w,h,scrol)
{
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function popup2(myname,mypage,w,h,scrol)
{
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}


/* Inklap functies */

function toggle_rowdisplay( img, depth, rowname )
{
	var donecookie = false;

	if ( img.src == 'images/min.gif' )
		img.src =  'images/min.gif';
	else if ( img.src == 'images/plus.gif' )
		img.src = 'images/min.gif';
		
	var table = img.parentNode;
	while ( table.tagName != 'TABLE' && table != document )
	{
		table = table.parentNode;
	}

	if ( table == document )
		return;

	var rowcollection = table.rows;
	var i = rowcollection.length;
	var rel, rels, j;

	while ( i-- > 0 )
	{
		rel = rowcollection[i].getAttribute('relation');
		if ( rel != null )
		{
			rels = rel.split('/');
			j = rels.length;

			while ( j-- > 0 )
			{
				if ( rels[j] == rowname )
				{
					rowcollection[i].style.display = rowcollection[i].style.display=='none' ? '' : 'none';
					break;
				}
			}
		}
	}
}

function toggle_cat_show ( row, depth )
{
	while ( depth > 0 && row != document )
	{
		row = row.parentNode;
		if ( row.tagName == 'TR' )
			depth--;
	}

	if ( row == document )
		return;

	var cellcollection = row.cells;
	var i = cellcollection.length;
	var celltype;

	while ( i-- > 0 )
	{
		celltype = cellcollection[i].getAttribute('celltype');
		if ( celltype == 'title' )
		{
			cellcollection[i].colSpan = (cellcollection[i].colSpan == 1?4:1);
			cellcollection[i].className = (cellcollection[i].colSpan == 1?'category-title-full-td':'category-title-td');
		}
		else if ( celltype == 'hide' )
		{
			cellcollection[i].style.display = (cellcollection[i].style.display=='none'?'':'none');
		}
	}
}

/* Initialisation */

var categories = [];

var plus = new Image(13, 13);
plus.src= 'images/plus.gif';
var min = new Image(13, 13);
min.src = 'images/min.gif';

function album(id) 
{
	location.href='index.php?page=fotoalbum&action=album&id='+id;
}
