//fetching the comment post form and processing the post data
function requestCform(sec,id,type) {
   if(!chkBusy()) {
      initHandler();
      field_name = "comment_sec";
      showLoader(field_name);
      ajRequest.send("POST", "/ajax.php", "action=comment_form&comment_sec="+sec+"&parent_id="+id+"&form_type="+type);
      fetching = true;
      form_fetched = true;
   }
}

function postCform(sec,id) {
   if(!chkBusy()) {
      comment_textx = fetchObject("comment_text").value;
      if(comment_textx.replace(/ /g, '') == '') {
         alert("Bitte Text eingeben...");
         return false
      }
      initHandler();
      field_name = "comment_sec";
      showLoader(field_name);
      ajRequest.send("POST", "/ajax.php", "action=comment_post&comment_sec="+sec+"&parent_id="+id+"&comment_text="+urlencode(comment_textx));
      fetching = true;
   }
}

function delComment(sec,id) {
   if(!chkBusy()) {
      initHandler();
      field_name = "comment_sec";
      showLoader(field_name);
      ajRequest.send("POST", "/ajax.php", "action=comment_del&comment_sec="+sec+"&comment_id="+id);
      fetching = true;
      form_fetched = true;
   }   
}

//fetching the news archive
function requestArchive(year,month) {
   if(!chkBusy()) {
      initHandler();
      if(month == 0) {
         field_name = "news_year";
      } else {
         field_name = "news_month";
         fetchObject("head_path").innerHTML = "News Archiv - "+month_ger[month-1]+" "+year;
         /*fetchObject("icontent_box").style.display = "";*/
      }
      showLoader(field_name);
      ajRequest.send("POST", "/ajax.php", "action=archive&news_year="+year+"&news_month="+month);
      fetching = true;
   }   
}

//fetching calendar entries
function requestEvents(time) {
   if(!chkBusy()) {
      initHandler();
      field_name = "hover";
      showLoader(field_name);
      fetchObject(field_name).style.visibility = "visible";
      ajRequest.send("POST", "/ajax.php", "action=events&time="+time);
      fetching = true;   
   }
}


//alert test
function requestAlert() {
   if(!chkBusy()) {
      initHandler();
      field_name = "alert";
      showLoader(field_name);
      ajRequest.send("POST", "/ajax.php", "action=alert");
      fetching = true;
   }
}


function postSec() {
   initHandler();
   field_name = "sectest";
   ajRequest.send("POST", "/ajax.php", "action=sectest&bla=lol&lol=bla");
}
