			
			var cur = 0;			
			var total_flyer= 10000;
			var stopped = false;
			
			
			function setStop(){
				stopped = true;
			}
			
			function unsetStop(){
				stopped = false;
			}
			
			function activateFlyer(id){
				document.getElementById(id).src = document.getElementById('src'+id).innerHTML;
				document.getElementById(id).style.display = "";
				document.getElementById('br'+id).style.display = "";
			}
			
			function deactivateFlyer(id){
				document.getElementById('br'+id).style.display = 'none';
			}
			
			
			function startChange(){
				getTotalFlyers();
				window.setInterval("changeFlyer()",4000);
				activateFlyer(0);				
			}
			
			function getTotalFlyers(){
				var i=0;				
				while(document.getElementById('src'+i)){
					i++;
				}				
				total_flyer = i;				
			}
			
			function changeFlyer(){
				
				if(!stopped){
					cur++;
					deactivateFlyer((cur-1)%total_flyer);
					activateFlyer(cur%total_flyer);
				}
				
			}			
			
			
			function openFlyer(id){
				window.open('./viewFlyer.php?nomenu=yes&id='+id,'Flyer','height=670,width=670,scrollbars=yes,resizable=yes,top=0,left=0');
			}