/* Modified by Attila Pest, 2010-11-09 09:36:56 EST */
  
  $(document).ready(function(){

    // FANCYBOX
    $("a.fancybox").fancybox({
      'overlayShow'     : false,
      'zoomSpeedIn'     : 600,
      'zoomSpeedOut'    : 500,
      'easingIn'        : 'easeOutBack',
      'easingOut'       : 'easeInBack'
    }); 

    $("#contactus").click(function(event){
      event.preventDefault();
      if ($("#contactus_panel").is(':visible')) $("#contactus_panel").slideUp("slow");
      else $("#contactus_panel").slideDown("slow");
    });    
    
    //Form send
    $("#send_message").click(function(event){
      event.preventDefault();
      var req = $("#ContactForm").serialize();
      $('#error').empty();
  
      $.post("/coming-soon/formsend.php",req,function(data){

        var json = eval("(" + data + ")");
        
        if (json['crash']) {
            $.each(json['crash'], function(i) { 
              $('#error').append("<p class='crash'><span>" + json['crash'][i][0] + "</span><br />" +  json['crash'][i][1] + "</p>");
            });      
        } else {
          $("#error").append("<p class='bless'><span>" + json['bless'][0] + "</span><br />" +  json['bless'][1] + "</p>");
          $("#ContactForm").empty();
        }
      });
      return false;
    });
    
    $("#consultation").click(function(event){
      event.preventDefault();
      if ($("#consultation_panel").is(':visible')) $("#consultation_panel").slideUp("slow");
      else $("#consultation_panel").slideDown("slow");
    });
    
    $("#closeconsultation").click(function(event){
      event.preventDefault();
      $("#consultation_panel").slideUp("slow");
    });
    
    //Form send
    $("#send_consultation").click(function(event){
      event.preventDefault();
      var req = $("#ConsultationForm").serialize();
      $('#errorconsultation').empty();
  
      $.post("/ajax/formsend2.php",req,function(data){
        var json = eval("(" + data + ")");
        
        if (json['crash']) {
            $.each(json['crash'], function(i) { 
              $('#errorconsultation').append("<p class='crash'><span>" + json['crash'][i][0] + "</span><br />" +  json['crash'][i][1] + "</p>");
            });      
        } else {
          $("#errorconsultation").append("<p class='bless'><span>" + json['bless'][0] + "</span><br />" +  json['bless'][1] + "</p>");
          $("#ConsultationForm").empty();
        }
      });
      return false;
    });         

  });

