var customType = false;
function customSystems(_type) {
	customType = _type;
	showPopupBackground();
   AjaxRequest(customSystemsParse,'./?filter_systems=1&type=' + _type,'GET');
}

function customSystemsParse(html,xml) {
	popupContentElement.innerHTML = html;
   centerize('popup_content');
   if(window.correctPNG) {
  	   correctPNG();
   }
}

function customSystemsSend() {
	formData = form2param('custom_systems_form');
	AjaxRequest(customSystemsSendParse,'./?filter_systems=1&type='+customType,'POST',formData);
}

function customSystemsSendParse(html,xml) {
	document.getElementById('custom_systems_update').innerHTML = '<div class="box"><div class="error">'+html+'</div></div>';
}

limit = 20;


function customAddRow(_element) {
	count = document.getElementById('custom_count_' + _element);
   if(count.value*1 < limit) {
	   count.value = count.value*1 + 1;
      height = count.value*19 - 1;
      document.getElementById('list_slider_' + _element).parentNode.style.height = height + "px";
   }
}

function customDelRow(_element) {
	count = document.getElementById('custom_count_' + _element);
   if(count.value*1 > 1) {
	   count.value = count.value*1 - 1;
      height = count.value*19 - 1;
      document.getElementById('list_slider_' + _element).parentNode.style.height = height + "px";
   }
}

function saveCustom() {
	post = form2param('form_custom');
	showPopupBackground();
   AjaxRequest(saveCustomParse,'?','POST',post);
}

function saveCustomQuiet() {
	post = form2param('form_custom');
   AjaxRequest(null,'?','POST',post);
}

function saveCustomParse(html,xml) {
	popupContentElement.innerHTML = html;
   centerize('popup_content');
   if(window.correctPNG) {
  	   correctPNG();
   }
}