$(function(){
	 
	var timerval ='';
	timerval =window.setInterval(logtimer, 15000);
	$('.nivoSlider').each(function() {
		var id = $(this).attr('id');
		var cc = 0;
		$('#'+id+' .frame img').css('display','block');
		$('#'+id+' .frame').each(function() {
			$(this).css('position','absolute');
			$(this).css('top','0');
			$(this).css('left','0');
			if(cc != 0){
				$(this).css('display','none');
			}else{
				$(this).css('display','block');
			}
			 cc++;
		});
		$(this).css('position','relative');
	});
	function nextitem(current_class) { 
		var next_id ='';
		if(current_class == 'frame f1'){
			next_id ='f2';
		}else if(current_class == 'frame f2'){
			next_id ='f3';
		}else {
			next_id ='f1';
		}
		return next_id;
	}
	function logtimer() { 
		var speed = 'fast';
		$('.nivoSlider').each(function() {
			var id = $(this).attr('id');
			
			var current = $('#'+id+' .frame:visible');
			var current_class = current.attr('class');
			
			var next_class = nextitem(current_class);
			var next = $('#'+id+' .'+next_class);
			
			var validate = next.length;
			if(validate == '' || validate == undefined || validate == null  || validate == 0){
				next = $('#'+id+' .frame:first-child');
			}
			current.hide();
			next.fadeIn(speed);
			if(speed== 'fast'){
				speed = '';
			}else{
				speed = 'slow';
			}
			
		});
	 }
	
});

	
