/**component_gbook_addNew()
 */  
function component_gbook_addNew(){
  var valid_gbook = new Validation('formaddnew', {immediate : true,useTitles : true,onSubmit:false});
  var result = valid_gbook.validate();
  if(!result){
  }else{
    //alert(act);
    var zapytanie = "./components/com_gbook/ajax.php?action=addNew";
    //alert(zapytanie);
    
    advAJAX.submit(document.getElementById("formaddnew"), {
        onLoading : function(obj) {
           showInfo($('msg_wait').value);
        },
        onSuccess : function(obj) { 
           if(obj.responseText==0){ 
              showalert($('errorAddGbook').value,$('txt_close').value);
           }else{
             showalert($('addedNewGbook').value,$('txt_close').value);
             $(id).innerHTML=obj.responseText;
           }
        },
        onError : function(obj) { alert("Error: " + obj.status); }
      });
  }
}

function component_gbook_reset(){
  var valid_gbook = new Validation('formaddnew');
  valid_gbook.reset();
}

function countLengthGbook(id,idc,ileznakow,msg) {
  var messageLength = ileznakow - document.getElementById(id).value.length;
  if (messageLength >= 0) {
    document.getElementById(idc).value=messageLength;
  } else {
    document.getElementById(idc).value=0;
    alert(msg);
  }
}
