function showBanner(num) {
	if (currentBanner == num) {
		clearInterval(rotateInterval);
		rotateInterval = setInterval("nextBanner()", 8000);	
		return;
	}
	$('#banners a').hide();
	currentBanner = num;

	$('#banners a:eq(' + (currentBanner) + ')').fadeIn();
	clearInterval(rotateInterval);
	rotateInterval = setInterval("nextBanner()", 8000);
}

function nextBanner() {
	var nextNum = currentBanner == 2 ? 0 : currentBanner + 1;
	showBanner(nextNum);
}

function ask_form(ask,form_name){
	var detStatus=confirm(ask);
	if(detStatus){
		return true;
	}
	else{
		return false;
	}
}

function vote(ids){
	var dot = '.'; 
	$(".links").hide('slow');
	$("#vote_counter").show('slow');
	interval = setInterval(function(){
		$("#vote_counter").html("Processing data <b>"+dot+"</b> ");
		dot = dot + '.';
		if (dot.length > 10){
			dot = '.';
		} 
	}, 600);
	var chars =  $("#char").val();
	var item =  $("#item").val();
	$.ajax({
		type: "post",
		url: base_url+"inc/submit/vote.php",
		data: {
			chars: chars,
			item: item,
			vote_link: ids
		},
		success: function(data){
			timeout = setTimeout(function() {
				clearInterval(interval);
				$("#vote_counter").hide('slow');
				$("#vote_error").html(data); 
				$("#vote_error").show('slow');
				setTimeout(function(){
					clearTimeout(timeout);
					$("#vote_error").hide('slow');
					$(".links").show(800); 	
				}, 3000);	
				$('.links').load(base_url + "inc/submit/vote.php");				
			}, 24000);
		}
		
	});	
}

function tabSwitch(active, number, tab_prefix, content_prefix) {  
	for(var i=1; i < number+1; i++){  
		$('#'+content_prefix+i).hide();
		$('#'+tab_prefix+i).attr('class', tab_prefix+i);
	}  
	$('#'+content_prefix+active).show();
	$('#'+tab_prefix+active).attr('class', tab_prefix+active+'_active');     
}  
	
function addVPoints(){
	$.post(base_url + "inc/submit/vote.php", { check: "points" }, function(data){                                            
        $('#g_points').fadeOut('slow').html(data).fadeIn("slow");                              
    });
}
