var e=0;
var t1,t2,t3,t4,t5,t6,t7,t8,curnum,i,j,dvige,times,menuhidT;
dvige = 1;
times = 100000;

function menuhidS()
{
	//$('#menuhid').animate({"opacity": "0.9"},800);
	$('#menuhid').show();
}
function menuhidH()
{
	/*if ($('#menuhid').css("opacity")==0.9)
	{
		menuhidT = setTimeout(menuhidH2(),10000);
		clearInterval(menuhidT);
	}*/
	
	//if ($('#menuhid').css("display")=="none")
	//{menuhidH2();$('#menuhid').css({"display":""});}
	menuhidH2();
}
function menuhidH2()
{
	/*$('#menuhid').animate({"opacity": "0"},800);
	$('#menuhid').css({"display":"none"});*/
	$('#menuhid').hide();
}

function dvig (where,yer,num)
{
	curnum = num;
	e=1;
	$("#homes").animate({"left": "-"+where+"px"}, 1000);
	$(".polz").removeClass('cur');
	$("#c"+num).addClass('cur');
	//$(".help").animate({"opacity": "0"},800);
	//$(".y"+yer).animate({"opacity": "1"},800);
	
}
curnum = 0;
function curs (num)
{
	dvige = 1;
	if (curnum>=72)
	{
		i=-1;
		$('#homes').stop(true);
		dvig2 (100);
		//$("#text").html("<h1>BAX</h1>");
		
	}
	else if (curnum<=1)
	{
		i=1;
		$('#homes').stop(true);
		dvig2 (2555);
		//$("#text").html("<h1>RAX</h1>");
	}
	
	curnum = curnum+1*i;
	
	//$("#text").html("<h1>"+curnum+"</h1>");
	
	//if (curnum==0 || curnum==73){$('#homes').stop();}
	//if (curnum==0){curnum=1;}
	//if (curnum==73){curnum=72;}
	
	//if (curnum==72){dvig2 (100);$("#text").html("<h1>BAX</h1>");}
	//if (curnum==1){dvig2 (2555);$("#text").html("<h1>RAX</h1>");}
	
	
	$(".polz").removeClass('cur');
	$("#c"+curnum).addClass('cur');
	t8 = setTimeout("curs (0)",times/80);
}

function dvig2 (where)
{
	$("#homes").animate({"left": "-"+where+"px"}, times);
}
/*
j=1;
function playscrol ()
{
	dvige = 1;
	if (e==0)
	{
		curs();
		if (j==1)
		{
			j=0;
			dvig2 (2555);
		}
		else
		{
			j=1;
			dvig2 (100);
		}
	}
}*/
function clir ()
{
	clearTimeout(t1);
	clearTimeout(t8);
	$('#homes').stop(true);
	dvige = 0;
	e=1;
	
	/*var keft;
	keft = $("#homes").css("left");
	$("#homes").css({"left": keft});
	alert (keft);*/
}
function gos()
{
	if (dvige==0)
	{
		if (i==1)
		{
			j=1;
		}
		else {j=0;}
		dvige=1;
		e=0;
		curs (0);
		if (i==1)
		{
			dvig2 (2555);
		}
		else if (i==-1)
		{
			dvig2 (100);
		}
	}
}
$(document).ready(function(){
	//dvig (1);	
	//$("#years").animate({"opacity": "1"},800);
	
	t=setTimeout("curs (0)",2000);
	//clearTimeout(t);
	//t=setTimeout("dvig (840,2004,5)",2000);
	//clearTimeout(t);
});



               // <![CDATA[    
            $(document).ready(function(){                

    $('#inputUsername').valid8({
        'regularExpressions': [
        { expression: /^.+$/, errormessage: 'Обязательное поле'},
        { expression: /^[a-zA-Zа-яА-Я0-9_\\\s]+$/, errormessage: 'Только буквы'}
        ]
    });
    $('#telef').valid8({
        'regularExpressions': [
		{ expression: /^.+$/, errormessage: 'Обязательное поле'},
        { expression: /^[0-9+]+$/, errormessage: 'Только цифры и знак +'}
        ]
    });
	
	$('#mass').valid8({
        'regularExpressions': [
        { expression: /^.+$/, errormessage: 'Обязательное поле'}
        ]
    }); 

    $('#mailS').valid8({
        'regularExpressions': [
        { expression: /^([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)?$/, errormessage: 'Email не верен'}
        ]
    });        
              
    
	
	
    var ok = 0;
    $('#buttonSignup').click(function(){             
        if ($('#inputUsername').isValid()){ok=1;}else{ok=0;}
        if ($('#telef').isValid()){ok=1;}else{ok=0;}
        if ($('#mailS').isValid()){ok=1;}else{ok=0;}
        if ($('#mass').isValid()){ok=1;}else{ok=0;}
        if (ok==1){postMail ();}
    }); 
            }); 
            
            function postMail ()
            {
                $("#noview").show(200);
						$('#buttonSignup').attr('value','Ждем ;)');
                        $.post(
                            'http://evilin.ru/elements/mail/php/obr.php',
                            {
                                type: 'text/plain',
                                inputUsername: $('#inputUsername').attr('value'),
                                telef: $('#telef').attr('value'),
                                mailS: $('#mailS').attr('value'),
                                mass: $('#mass').attr('value'),
                                titlePage: $('#titlePage').attr('value'),
                                pageUrl: $('#pageUrl').attr('value')
                            },
                            function (data)
                            {
                                 $('#formaMail').dialog('close');
								 $('#mass').attr('value','');
                                 $("#noview").hide(200);
								 $('#buttonSignup').attr('value','Отправить');
                            }  );  
                   
            }   
            // ]]>
            var allDialogs = [];
            var seq = 0; 

$(document).ready(function() {  
		$("#formaMail").dialog({autoOpen: false});
		//$( "#dialog" ).dialog({autoOpen: false});
		//closeD ("formaMail");
 });
 
function openD (id)
{
	$("#"+id).dialog('open');
}

function closeD (id)
{
	$("#"+id).dialog('close');
}

