/* (c) 2006 BMT Media - www.bmtmedia.nl */
//Rollover voor menu
var picon = new Array();
var picoff = new Array();
if (document.images) {
	for (i = 1;i <=7; i++) {
		picon[i] = new Image();
		picoff[i] = new Image();
		picon[i].src="/images/menu"+i+"a.gif";  
		picoff[i].src="/images/menu"+i+".gif";  
	}
}

function mon(imgNr) {
   if (document.images) {
	  imgName = "menu" + imgNr;
      document[imgName].src= picon[imgNr].src;
    }
 }

function moff(imgNr) {
   if (document.images) {
	  imgName = "menu" + imgNr;
      document[imgName].src= picoff[imgNr].src;
    }
 }

//Voeg rij toe aan tabel met form-elementen
function addRow(){
	var clone;
	var tabindex = document.getElementById('tabform').getElementsByTagName('tr').length;
	var rows = document.getElementById('template').getElementsByTagName('tr');
	var index = rows.length;
	clone = rows[index-1].cloneNode(true);
	var inputs = clone.getElementsByTagName('input'), inp, i=0 ;
	while (inp = inputs[i++]) {
		if (inp.name.indexOf('[]') == -1) {
			inp.name = inp.name.replace(/\d/g,'') + (tabindex + 1);
		} else if (inp.name == 'mandatory[]') {
			inp.value = tabindex + 1;
		}
		inp.id = inp.id.replace(/\d/g,'') + (tabindex + 1);
	}
	var selects = clone.getElementsByTagName('select'), sel, i=0 ;
	while (sel = selects[i++]) {
		sel.name = sel.name.replace(/\d/g,'') + (tabindex + 1);
		sel.id = sel.id.replace(/\d/g,'') + (tabindex + 1);
	}

	var tbo = document.getElementById('tabform').getElementsByTagName('tbody')[0];
	tbo.appendChild(clone);
}

/**
 * deleteSpecial - verwijder special
 */
function deleteSpecial(special_id, title) 
{
	if (confirm('Weet u zeker dat u special "' + title + '" wilt verwijderen?')) {
		window.location = document.location.pathname + '?delete=1&id=' + special_id;
	}	
}

/**
 * popup - opens a popup-document with image
 */
 function popup(id) {
	if (window.bmtpopup && !bmtpopup.closed) bmtpopup.close();
	bmtpopup = window.open('image.php?id=' + id,'bmtpopup','width=700,height=530,scrollbars=no'); 
}

