	cnt = 0;
	index = 0;
	var top5fx = [];
	var bot5fx = [];
	var per;
	
	

    window.addEvent("domready",function() {
    	
  
    	
    	if ($("upis")) {
	    	new FormCheck('upis', {
	    		display : {
	    			errorsLocation : 1,
	    			indicateErrors : 1,
	    			showErrors : 0
	    		}
	    	});
	    }
	    
	    if ($("saljiprijatelju")) {
	    	new FormCheck('saljiprijatelju', {
	    		display : {
	    			errorsLocation : 1,
	    			indicateErrors : 1,
	    			showErrors : 0
	    		}
	    	});
	    }
       
	    
	    
    	if ($('slideshow')){
	        $$("div.slide").each(function(el, index){
	            if(el.getStyle("display")=="none"){
	                el.setStyles({"display": "block", "opacity": "0"});
	            }
	            if(index==0) el.setStyles({"display": "block", "opacity": "1"});
	            top5fx.push(new Fx.Tween(el, {duration:750, wait:false}));
	        })
	        
	        
	        $$("a.bullets").each(function(el, index){
	        
	            bot5fx.push(new Fx.Tween(el, {duration:750, wait:false}));
	            el.setProperty("res", index);
	             
	            el.addEvents({
	                "click":function(){
	                    $clear(per);
	                  
	                   $$("a.bullets").each(function(ele){
	                    	ele.removeClass("active");
	                   });
	                     
	                    el.addClass("active");
	                    
	                    $$("div.slide").each(function(el, index){
	                        if(el.getStyle("opacity")!=0) {
	                            top5fx[index].start('opacity', 0);
	                        }
	                    });		
	                    		
	                    top5fx[el.getProperty("res")].start('opacity', 1);	
	                    
	                    cnt=index;
	                    per = fx.periodical(5000);
	                }
	            })
	        })
	        
	        per = fx.periodical(5000);
	        
    	}
    	

    })
    
	
    
    function fx(){
        cnt++;
        if (cnt==top5fx.length) cnt = 0;
        top5fx[cnt].start('opacity', 1);
       
	    $$("a.bullets").each(function (el){
            el.removeClass("active");
            
        })
        $$("a.bullets")[cnt].addClass("active");
        $$("div.slide").each(function(el, indx){
            if(el.getStyle("opacity")!=0){
                top5fx[indx].start('opacity', 0);
            }
        })
    }
    
    
	
	function brojpet(el){
    if (el.value!='5') {
	        el.errors.push("Upišite broj 5");
	        return false;
	    } else {
	        return true;
	    }
	}
    
