function get_ajax_content(file,page,action,div) {
  var obj = false;

  if(navigator.appName == "Microsoft Internet Explorer") {
    obj = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
    obj = new XMLHttpRequest();
  }
  obj.abort();
  try {
    obj.open("GET", "http://www.hobune.ee/ajax_actions/" + file + ".php?page=" + page + "&action=" + action , true);
  } catch (err) {
    obj.open("GET", "http://hobune.ee/ajax_actions/" + file + ".php?page=" + page + "&action=" + action , true);
  }
  obj.onreadystatechange=function() {
    if(obj.readyState == 4) {
      document.getElementById(div).innerHTML = obj.responseText;
    }
  }
  obj.send(null);
}

function get_ajax_content2(file,page,action,identificator,div) {
  var obj = false;
  
  if(navigator.appName == "Microsoft Internet Explorer") {
    obj = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
    obj = new XMLHttpRequest();
  }
  obj.abort();
  try {
    obj.open("GET", "http://www.hobune.ee/ajax_actions/" + file + ".php?page=" + page + "&action=" + action + "&identificator=" + identificator  , true);
  } catch (err) {
    obj.open("GET", "http://hobune.ee/ajax_actions/" + file + ".php?page=" + page + "&action=" + action + "&identificator=" + identificator  , true);
  }
  obj.onreadystatechange=function() {
    if(obj.readyState == 4) {
      document.getElementById(div).innerHTML = obj.responseText;
    }
  }
  obj.send(null);
}

function get_selected() {
  
  for (var i=0; i < document.poll.vote.length; i++)
  {
    if (document.poll.vote[i].checked)
    {
      var rad_val = document.poll.vote[i].value;
    }
  }
  return rad_val;
  
}

function add_element() {
  var ni = document.getElementById('pictures');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = num;
  newdiv.setAttribute('class','submit_file');
  newdiv.innerHTML = '<div class="submit_file"><input type="file" name="' + num + '" size="50" class="addfile"><div class="clear"></div></div>';
  ni.appendChild(newdiv);
}

function add_input() {
  var ni = document.getElementById('pictures');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = num;
  newdiv.setAttribute('class','submit_file');
  newdiv.innerHTML = '<div class="submit_file"><input type="text" name="' + num + '" size="50" class="input_vlong"><div class="clear"></div></div>';
  ni.appendChild(newdiv);
}

