var SEARCH_WARNING='Va rugam introduceti min 3 caractere in campul de cautare';
//**********************************************************************************************************************
function Search(pageID){
  if ($('#keyword').val().length<3){
    alert(SEARCH_WARNING);
    $('#keyword').focus();
  }else{
    document.location.href=SEARCHURL+$('#keyword').val();
    return false;
  }
}

//*************************************************************************************************
function HomeCheckBoxes(){
  var x,MaxHeight;
  MaxHeight=0;
  for (x=1;x<=4;x++) if ($('#HomeBox'+x).height()>MaxHeight) MaxHeight=$('#HomeBox'+x).height();
  //alert($('#HomeBox4').height());
  for (x=1;x<=4;x++) $('#HomeBox'+x).css('height',MaxHeight);
}

//*************************************************************************************************
var validateRegistrationChecked=0;
function validateFeedback(send){
  if (send) validateRegistrationChecked=1;
  if (!validateRegistrationChecked) return;
  var firsterror='';
  if ($('#c_name').val()==''){
    if (firsterror=='') firsterror='c_name';
    $('#c_name').addClass('errorfield');    
  }else{
    $('#c_name').removeClass('errorfield')
  }

  if ($('#c_phone').val()==''){
    if (firsterror=='') firsterror='c_phone';
    $('#c_phone').addClass('errorfield');    
  }else{
    $('#c_phone').removeClass('errorfield')
  }

  if ($('#c_comment').val()==''){
    if (firsterror=='') firsterror='c_comment';
    $('#c_comment').addClass('errorfield');    
  }else{
    $('#c_comment').removeClass('errorfield')
  }

  if (firsterror=='' && send){
    $('#ErrorMessageContact').fadeOut();
    $.post("/index.php?method=FeedbackSave", {     c_name:      $('#c_name').val(), 
                                                   c_firmname:  $('#c_firmname').val(), 
                                                   c_phone:     $('#c_phone').val(),
                                                   c_email:     $('#c_email').val(),
                                                   c_location:  $('#c_location').val(),
                                                   c_county:    $('#c_county').val(),
                                                   c_comment:   $('#c_comment').val(),
                                                   c_norefresh: $('#c_norefresh').val()
                                                 },
       function(data){
          if (data==0){
            $('#RegistrationContentOK').html('Error Sending E-mail');  
          }else{
            $('#RegistrationContentOK').html(data);
            $('.registration').val('');
            $('.registration_dbl').val('');
          }
    });
  }else{
    $('#ErrorMessageContact').fadeIn();
    if (send) $('#'+firsterror).focus();
  }
}
