function hide_this_shit(elso_,masodik_)
{
        document.getElementById('edit-attributes-' + elso_ + '-wrapper').style.display = "none";
        document.getElementById('edit-attributes-' + masodik_ + '-wrapper').style.display = "none";
}
function hide_this_shit_local(elso_)
{
        document.getElementById('edit-attributes-' + elso_ + '-wrapper').style.display = "none";
}           
function hide_submit(nid)
{
	document.getElementById('edit-submit-' + nid).style.display = "none";
}
function arformat(ar)
{
	return Math.round(parseFloat(ar)) + ' FT';
}
var request = null;
function createXmlHttp()
{

   if (window.XMLHttpRequest)
   {
      request = new XMLHttpRequest();
   }
   else if (typeof ActiveXObject != undefined)
   {
      request =
      new ActiveXObject('Microsoft.XMLHTTP');
   }
   return request;
}
var ajaxRequest_price = null;
function requestprice_and_cost(price,cost,nid,elso_a,masodik_a)
{
   ajaxRequest_price = createXmlHttp();
   var selected_elso_oid = document.getElementById('elso_').value;
   var selected_masodik_oid = document.getElementById('masodik').value;
 
   if (ajaxRequest_price)
   {
      ajaxRequest_price.open(
      'get', '/bandi_code/price.php?price=' + price + '&cost=' + cost + '&nid=' + nid + '&elso_oid=' + selected_elso_oid + '&masodik_oid=' + selected_masodik_oid ,true);
      ajaxRequest_price.onreadystatechange =
      function()
      {
         ajaxprice(elso_a,masodik_a,selected_elso_oid,selected_masodik_oid,nid);
      }
      ajaxRequest_price.send("");
   }
}
function ajaxprice(elso,masodik,selectedelsooid,selectedmasodikoid,nid)
{
   if (ajaxRequest_price.readyState != 4)
   {
      return;
   }
   document.getElementById('price_').innerHTML =
   ajaxRequest_price.responseText;
   document.getElementById('edit-attributes-' + elso + '-wrapper').innerHTML = '<select id="edit-attributes-' + elso + '" class="form-select" name="attributes[' + elso + ']"><option selected="selected" value="' + selectedelsooid + '">0</option></select>';
   document.getElementById('edit-attributes-' + masodik + '-wrapper').innerHTML = '<select id="edit-attributes-' + masodik + '" class="form-select" name="attributes[' + masodik + ']"><option selected="selected" value="' + selectedmasodikoid + '">0</option></select>';
   hide_this_shit(elso,masodik);
   	//hide_submit(nid);
}

function requestprice_and_cost_local(price,cost,nid,elso_a)
{
   ajaxRequest_price_local = createXmlHttp();
   var selected_elso_oid = document.getElementById('elso_').value;
   
   if (ajaxRequest_price_local)
   {
      ajaxRequest_price_local.open(
      'get', '/bandi_code/price_local.php?price=' + price + '&cost=' + cost + '&nid=' + nid + '&elso_oid=' + selected_elso_oid ,true);
      ajaxRequest_price_local.onreadystatechange =
      function()
      {
         ajaxprice_local(elso_a,selected_elso_oid,nid);
      }
      ajaxRequest_price_local.send("");
   }
}
function ajaxprice_local(elso,selectedelsooid,nid)
{
   if (ajaxRequest_price_local.readyState != 4)
   {
      return;
   }
   document.getElementById('price_local').innerHTML =
   ajaxRequest_price_local.responseText;
   document.getElementById('edit-attributes-' + elso + '-wrapper').innerHTML = '<select id="edit-attributes-' + elso + '" class="form-select" name="attributes[' + elso + ']"><option selected="selected" value="' + selectedelsooid + '">0</option></select>';
   //hide_submit(nid);
   hide_this_shit_local(elso);
}