// JavaScript Document Liginet Company http://liginet.ru

/*====demo_slideshow====*/
function slideSwitch() { var $active = $('#slideshow div.active'); if ( $active.length == 0 ) $active = $('#slideshow div:last'); var $next =  $active.next().length ? $active.next() : $('#slideshow div:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); } $(function() { setInterval( "slideSwitch()", 5000 ); });

/*=====Golosovanie======*/
function gogolos(id){
	$.getJSON("json_data.php?user=gogol", { id: id }, function(data){
		$.each(data, function(i,item){  
			if(item.dos=='1'){
				$("#gol_r").html(item.gol);
				$("#mes").html('Спасибо! Ваш голос принят!').css({ color: 'green'}).fadeIn(500);
				setTimeout(function(){ $('#mes').fadeOut(500);},2000);
			}else{
				$("#mes").html('Вы можете голосовать всего 1 раз в час').css({ color: 'red'}).fadeIn(500);
				setTimeout(function(){ $('#mes').fadeOut(500);},2000);
			}
		});
	 });
}
/*===ADD anketa=====*/
function addAnket(id){
	$("#but_form").slideUp(500);
	var reg_mail = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/i;
	var inf = $("#inf").val();
	var idvk = $("#idvk").val();
	var email = $("#email").val();
	var fil = $("#file_"+id).val();
	var mes_1 = 'Заполните все поля!';
	var mes_2 = 'Размер файла минимум 800px';
	var mes_3 = 'Вы не выбрали изображение';
	var mes_4 = 'Спасибо! Анкета добавлена';
	if(inf==''){ $("#mes_1").html(mes_1).css({ color: "red" });} else { 
	if(idvk==''){ $("#mes_1").html(mes_1).css({ color: "red" });} else { 
	if(fil==''){ $("#mes_1").html(mes_3).css({ color: "red" });} else { 
	if(email==''){ $("#mes_1").html(mes_3).css({ color: "red" });} else { 
	$.post("json_data.php?user=data", { inf: inf, idvk: idvk, email: email }, function(data){
		$("#mes_1").html(mes_4).css({ color: "green" });
			$(".block_ank form").slideUp(1000);
			setTimeout(function(){ $(".block_ank, .shadow").fadeOut(500);},1000);
		});
	}
	}
	}
	}
}

/*====otherFunction====*/

$(document).ready(function(){
	$("#op_ank").click(function(){ $(".shadow").fadeIn(500); $(".block_ank").fadeIn(1500); });
	$("#close_ank").click(function(){ $(".block_ank").fadeOut(500);	$(".shadow").fadeOut(1500);	});
});



