  function check(id,name,tresc) {
var alert_content=$("#contact_form_alert");
 switch(id) {
  /*  case "pr":
      if(tresc.match("[^0-9.]")) {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("CONTECT_BLAD_PRICE");     
      } else {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title="";
        alert_content.html(""); 
      }
      break;
    case "po":
      if(tresc.match("[^0-9]")) {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("CONTECT_BLAD_NUMBERS");
      } else {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title="";
        alert_content.html(""); 
      }
      break;  */
      case "string":
      if(tresc.match("[0-9\:\;\?\@!#$%^&*+\(\)\\\\~\/><{}]")) {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("Prosimy o poprawne wpisanie imienia i nazwiska."); 
      } else {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title=" ";
        alert_content.html("");   
      }
      break;
    case "email":
      reg =/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
      if(tresc.match(reg)) {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title=""; 
        alert_content.html(""); 
      } else {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("Prosimy o poprawne wpisanie adresu e-mail."); 
      }
      break;
    case "any":
      if(document.getElementById(name).value.length<=0) {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("Prosimy o wpisanie treści wiadomości."); 
      } else {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title=" ";
        alert_content.html("");   
      }
      break;
    case "phone":
      if(document.getElementById(name).value.length<=0) {
      document.getElementById(name).style.borderLeft="solid 5px red";
      document.getElementById(name).title="błąd";
      alert_content.html("Prosimy o wpisanie numeru telefonu."); 
      } else {
        document.getElementById(name).style.borderLeft="5px #f7bf00 solid";
        document.getElementById(name).title=" ";
        alert_content.html("");   
      }
      break;
  }
  
}

function zapisz(x) {
  var alert_content=$("#contact_form_alert");
  var lista=document.getElementsByTagName('input');
  licz=0;
  a=lista.length;
  if(document.getElementById('text').value.length<=2) {
      document.getElementById('text').style.borderLeft="solid 5px red";
      document.getElementById('text').title="błąd";
      alert_content.html("Prosimy o wpisanie treści wiadomości.");  
  } else if(document.getElementById('phone').value.length<=1||document.getElementById('phone').title=="błąd") {
      document.getElementById('text').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('nazwisko').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('email_nad').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('phone').style.borderLeft="solid 5px red";
      document.getElementById('phone').title="błąd";
      alert_content.html("Prosimy o wpisanie numeru telefonu.");     
  } else if(document.getElementById('email_nad').value<=1||document.getElementById('email_nad').title=="błąd") {
      document.getElementById('text').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('phone').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('nazwisko').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('email_nad').style.borderLeft="solid 5px red";
      document.getElementById('email_nad').title="błąd";
      alert_content.html("Prosimy o poprawne wpisanie adresu e-mail.");     
  } else if(document.getElementById('nazwisko').value<=1||document.getElementById('nazwisko').title=="błąd") {
      document.getElementById('text').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('phone').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('email_nad').style.borderLeft="5px #f7bf00 solid";
      document.getElementById('nazwisko').style.borderLeft="solid 5px red";
      document.getElementById('nazwisko').title="błąd";
      alert_content.html("Prosimy o poprawne wpisanie imienia i nazwiska.");     
  }
  
  for(var i=0;i<a;i++){
   if((lista[i].type=="text"&&lista[i].value==""||lista[i].title=="błąd")&&(lista[i].id!="termin"&&lista[i].id!="adres_www" )) {
    licz++; 
    }  
  }

  if(document.getElementById('text').value.length<=2)   licz++;
  if(licz<=0) {
     eval("document."+x+".submit()");
    }
}


$(document).ready(function(){ 
    $('#rodzaj_zlecenia').sSelect();
    $('#budzet').sSelect();
  $("#rozwin").click(function(){
      if($(this).position().left<200) {
      $(this).html("&laquo; Zwiń pola opcjonalne");
      $(this).animate({left:455},400);
      $("#contact_form_part1").animate({marginLeft:0},400);
      $("#contact_form_part2").animate({width:310},400);
       }else {
      $(this).html("Rozwiń pola opcjonalne &raquo;");
      $(this).animate({left:150},400);
      $("#contact_form_part2").animate({width:0},400);
      $("#contact_form_part1").animate({marginLeft:140},400);
       }
  });




});			 
