var interval;
var pb = 10;
function percent_bar() {
	pb += Math.round(Math.random() * (15 - 5) + 5);
	if(pb > 400) pb = 400;
	$("#percent_bar").css('width', pb+'px');
	
	
	
	
	if(pb >= 400) {
		var zachat2 = $("#day_zachat").val()+"."+$("#month_zachat").val()+"."+$("#year_zachat").val();
		$("#sms_part_2").slideDown("slow");

var a = $("input[name='resusf']:checked").val();
var b = $("input[name='moment']:checked").val();
var c = $("input[name='datemore']:checked").val();
var d = $("input[name='father']:checked").val();
var e = "percent";

$.ajax({
type: "POST",
url: "ajax/test.php",
data: ({act : e, resus : a, moment : b, zachatknow : c, zachat : zachat2, fatherknow : d, test : test2}),
success: function(data){
$("#percent").text(data);
clearInterval(interval);
$("#sms_part_1").hide("slow");
$("#sms_part_2").show("slow");
}
});
	    }

	
	
	
}

$(document).ready(function(){
$("#sms2").slideUp("slow");
$("#country").change(function(){
$("#sms2").slideDown("slow");
$("#number").text($('#country').val());

if($(this).val() == 'номер')
{
$("#pref").text("текст");
}

if($(this).val() == '6666' || $(this).val() == '9395' || $(this).val() == '1315' || $(this).val() == '91810700' || 
$(this).val() == '483233' || $(this).val() == '9395' || $(this).val() == '1066109833' || $(this).val() == '9089' || 
$(this).val() == '4500' || $(this).val() == '97605')
{
$("#pref").text("59257");
}

if($(this).val() == '19995577' || $(this).val() == '930400880' || $(this).val() == '9525' || $(this).val() == '22588' || 
$(this).val() == '5026' || $(this).val() == '3336' || $(this).val() == '3331' || $(this).val() == '1816' || 
$(this).val() == '636' || $(this).val() == '81404' || $(this).val() == '690619916' || $(this).val() == '66777' || 
$(this).val() == '54345' || $(this).val() == '6210' || $(this).val() == '1230' || $(this).val() == '95206' ||
$(this).val() == '5111' || $(this).val() == '99036' || $(this).val() == '57977' || $(this).val() == '35969' ||
$(this).val() == '4161' || $(this).val() == '88188' || $(this).val() == '92921' || $(this).val() == '4449' || 
$(this).val() == '3585' || $(this).val() == '1819' || $(this).val() == '1081' || $(this).val() == '1394' || 
$(this).val() == '64747' || $(this).val() == '141991' || $(this).val() == '25000' || $(this).val() == '9898' || 
$(this).val() == '4466' || $(this).val() == '2223' || $(this).val() == '2252' || $(this).val() == '2447' || 
$(this).val() == '92505' || $(this).val() == '68607' || $(this).val() == '1263' || $(this).val() == '4828' || 
$(this).val() == '6674' || $(this).val() == '55123' || $(this).val() == '7979' || $(this).val() == '17211' || 
$(this).val() == '81015' || $(this).val() == '67454' || $(this).val() == '14941' || $(this).val() == '9033399' ||
$(this).val() == '543' || $(this).val() == '72401' || $(this).val() == '3304' || $(this).val() == '7722' ||
$(this).val() == '13017' || $(this).val() == '42994')
{
$("#pref").text("76633257");
}


if($(this).val() == '15191' || $(this).val() == '7766' || $(this).val() == '32088' || $(this).val() == '35810')
{
$("#pref").text("dam 10238 147");
}

});

		$("#but-result").click(function(){
		
		if ($("#code").val() == "")
		{
		alert("Вы не ввели код!");
		} else {
		
										var birth2 = $("#day_b").val()+"."+$("#month_b").val()+"."+$("#year_b").val();
										var menst2 = $("#day_menst").val()+"."+$("#month_menst").val()+"."+$("#year_menst").val();
										var zachat2 = $("#day_zachat").val()+"."+$("#month_zachat").val()+"."+$("#year_zachat").val();
										var father_birth2 = $("#day_father").val()+"."+$("#month_father").val()+"."+$("#year_father").val();
										var a = $("#code").val();
										var b = $("#percent").text();
										var c = $("input[name='resusf']:checked").val();
										var d = $("input[name='moment']:checked").val();
										var e = $("#plan").val();
										var f = $("#menst_dlit").val();
										var g = $("input[name='datemore']:checked").val();
										var h = $("input[name='father']:checked").val();
										var i = $("#brothers_father").val();
										var j = $("#brothers").val();
										var k = $("input[name='q4']").val();
										var l = $("#q5").val();
										var m = $("#capcha").val();
                                        var test2 = 'mom';
										$.ajax({
											   type: "POST",
											   url: "ajax/test.php",
											   data: ({code : a, percent : b, resus : c, birth : birth2, moment : d, plan : e, menst : menst2, cikl : f, zachatknow : g, zachat : zachat2, fatherknow : h, father_birth : father_birth2, brothers_father : i, brothers : j, q4 : k, q5 : l, test : test2, cap : m}),
											   success: function(data){
														$("#sms_part_2").slideUp(1000);
														$("#pay").html(data);
														$("#sms_part_3").slideDown(700);
											   }
											   });
											   
						}					   

										});
    });
