$(document).ready(function() {

$(".but-submit").click(function() {
    CloseDivFast('ff_form');
    ShowDivFast('ff_sending');

    var ff_form = document.getElementById('form1');
    var tmp = [], el;
    for(i=0; el = ff_form.elements[i]; i++) {
	tmp.push(el.name + '=' + el.value);
    }

    var data = tmp.join("&");
    var pathAdress = location.pathname;

    $.ajax({
            type: "POST",
            url: pathAdress,
            data: data,
            success: function(html) {
        	CloseDivFast('ff_sending');
        	ShowDivFast('ff_sent');
    		setTimeout("CloseDivFast('ff_sent'); ShowDivFast('ff_form'); CloseDivFast('zakaz'); ", 5000);
            },
            error: function(html) {
        	CloseDivFast('ff_sending');
        	ShowDivFast('ff_error');
    		setTimeout("CloseDivFast('ff_error'); ShowDivFast('ff_form'); CloseDivFast('zakaz'); ", 5000);
            }
    });
    return false;
});


$('#bell').click(function() {
$('#zakaz').show(1000);
});


$('#karta').click(function() {
$('#shema').show(1000);
});



    $('#close').click(function() {
	CloseDiv('zakaz');
    });

    $('#close_map').click(function() {
	$('#shema').hide(1000);
    });

});


$(function() {
    $("ul.tabs").tabs("div.panes > div");
});


// JavaScript Document

function ShowDiv(DivId){

    $("#" + DivId).show(1000);
}
function ShowDivFast(DivId){

    $("#" + DivId).show(0);
}

function CloseDiv(DivId){

    $("#" + DivId).fadeOut(1000);
}
function CloseDivFast(DivId){

    $("#" + DivId).fadeOut(0);
}

