﻿
var req;

function Initialize() {
    try {
        req = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
        try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (oc) {
            req = null;
        }
    }

    if (!req && typeof XMLHttpRequest != "undefined")
    { req = new XMLHttpRequest(); }
}

function cena_postroje(podsivka, posuvka, velikost) {
    Initialize();
    var urlPart = window.location + "";
    urlPart = urlPart.substring(0, 5 + urlPart.indexOf(".aspx"))
    urlPart = urlPart.substring(0, urlPart.lastIndexOf("/"))
    
    for (var i=0; i < document.getElementById(podsivka).length; i++)
   {
   if (document.getElementById(podsivka)[i].checked)
      {
      var podsivka_val = document.getElementById(podsivka)[i].value;
      }
   }
  
   
   alert(podsivka_val);



    
    var url = urlPart + "/get/countPrice.aspx?typ=norskyPostroj&=podsivka=" + podsivka + "&posuvka=" + posuvka + "&=velikost" + velikost;    
    if (req != null) {
        req.onreadystatechange = ProcessPostroj;
        req.open("GET", url, true);
        req.send(null);
    }
}


function ProcessPostroj() {    
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            //alert(req.responseText);           
            //if (req.responseText == 'True') {
                document.getElementById('ctl00_obsah_ctl14_norskyPostroj_cena_ctrl_txtPolozka').value = 'ahoj';               
            //}
        }
    }
}
