$(document).ready(function(){

  //фиксим все пнг для ие
  //$("#next").pngFix();
  
  

    //$('#portfolio-second').mouseGallerySlide({
//            scrollElParent: 'ul',
//            scrollEl: 'li' 
//        });
    
    $(function(){
        itemsPerPage = 5;
        paginatorStyle = 3;
        paginatorPosition = 'bottom';
        $(".topaginate").pagination();
    });
    
    //function checkemail(email){
//        var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
//        var filter_phone = /^[0-9]*$/i;
//    
//        if(filter.test(email)||filter_phone.test(email)){
//            return true;
//        }else{
//            return false;
//        }
//    }
//    
//    
//    $("#mail-form button").attr("disabled","disabled");
//    
//      if(checkemail($("input[name=phone-email]").val())){
//        $("#mail-form button").removeAttr("disabled");
//      }
//    
//    $("input[name=phone-email]").change(function(e){
//        if(checkemail($(this).val())){
//            $("#mail-form button").removeAttr("disabled");
//        }else{
//            $("#mail-form button").attr("disabled","disabled");
//        }
//    });
    
     $("#mail-form button").click(function(e){
            
            var email = $("input[name=phone-email]").val();
            
                
                $.ajax({
        		   type: "POST",
        		   url: "portfolio",
                   data: "phone-email="+ email +"&text_info=" + $("textarea[name=text_info]").val(),
        		   success: function(msg){
                        $("#mail-form div").addClass("result gold");
                        $("#mail-form div").html("Ваше письмо отправлено.<br/> Мы обязательно с вами свяжемся.");		                                                                                                      
        			},
                   beforeSend: function(){               
                    $("#mail-form div").fadeOut();
                     //$("img." + catalogue_number).show();
                     //$("#loading-text").text("…");
                   },
                   complete: function(){
                    $("#mail-form div").fadeIn();
                    
                     //$("img." + catalogue_number).hide();
                     //$("button." + catalogue_number).show();
                     //$("#loading-text").text("");
                   }

                    		   
        		});
            
               
        });
        
        
        $("#portfolio-second").jCarouselLite({
            btnNext: "#next",
            btnPrev: "#prev",     
            visible: 6,
            easing: 'linear',
            mouseWheel: true

        });
       
       
       
      
});


