function bannerCycle(groep, width, height, till, unique, dbg) {
	var name = 'banner_'+unique+'_';
	var offset = parseInt(document.getElementById(name+'start').innerHTML);
	var total = parseInt(document.getElementById(name+'total').innerHTML);
	
	if(offset == till){
		document.getElementById(name+'start').innerHTML = 0;
	} else {
		document.getElementById(name+'start').innerHTML = offset + 1;
	}

	var src = document.getElementById(name+offset+'_src').innerHTML;
	var alt = document.getElementById(name+offset+'_alt').innerHTML;
	var time = document.getElementById(name+offset+'_timeout').innerHTML;
	time = parseInt(time);
	if (time <= 15000)
		time = 15000;
		
	var goto2 = document.getElementById(name+offset+'_url').innerHTML;
  var segment = document.getElementById(name+offset+'_groep').innerHTML;

  
  handleBanner('banner_'+groep+'_banner_img', 'banner_'+groep+'_banner', src, alt, goto2, width, height, segment);
  

  if(total > 1){
  	setTimeout("bannerCycle('"+groep+"',  '"+width+"' , '"+height+"', '"+till+"', '"+unique+"' )", time);
  }
}

function handleBanner(img, onclick, src, alt, goto2, width, height, groep){
	document.getElementById(onclick).href = goto2;
	document.getElementById(img).src = "/?fuseaction=img.fromdb&groep="+groep+"&name="+src+"&width="+width+"&height="+height;
	document.getElementById(img).alt = alt;
	document.getElementById(img).width = width;
	document.getElementById(img).height = height;
}

function editBanner(bannerID) {
  var  fuseactionX = "section.bannerupdate";
  jQuery.post("index.php", { fuseaction: fuseactionX,bannerName: bannerID},
  function(data) {
       
	showDialog("600px","500px",data);

  });
}

