/* part 2 */
/**
 *=-------------------------------------------------------=
 * getNewHTTPObject
 *=-------------------------------------------------------=
 * This function is here just to create a new
 * XmlHttpRequest object.
 */
function getNewHTTPObject()
{
    var xmlhttp;

    /** Special IE only code ... */
    /*@cc_on
      @if (@_jscript_version >= 5)
          try
          {
              xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch (e)
          {
              try
              {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (E)
              {
                  xmlhttp = false;
              }
         }
      @else
         xmlhttp = false;
    @end @*/

    /** Every other browser on the planet */
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
    {
        try
        {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e)
        {
            xmlhttp = false;
        }
    }

    return xmlhttp;
}

/**
 *=-------------------------------------------------------=
 * onLoadFunction
 *=-------------------------------------------------------=
 * We call this function when the page loads, and it starts
 * two asynchronous Ajax requests to race2.php.
 */
var xml1;
var xml2;
function onLoadFunction(jezyk)
{
    //alert('olo');
	xml1 = getNewHTTPObject();
    //xml2 = getNewHTTPObject();

    xml1.open('GET', 'race2.php?language='+jezyk+'', true);
	//alert('olo');
    //xml2.open('GET', 'http://localhost/race2.php?req2', true);

    xml1.onreadystatechange = handleResponse1;
    //xml2.onreadystatechange = handleResponse2;

    //xml2.send('');
    xml1.send('');
	window.document.location.reload();
}

/**
 *=-------------------------------------------------------=
 * handleResponse1
 *=-------------------------------------------------------=
 * This handles the response from the first ajax request.
 * It puts the returned string in the <div> element
 * with th eid 'fudgecicles'
 */
function handleResponse1()
{
    if (xml1.readyState == 4)
    {
        document.getElementById('fudgecicles').innerHTML =
            xml1.responseText;
    }
}

/**
 *=-------------------------------------------------------=
 * handleResponse2
 *=-------------------------------------------------------=
 * This handles the response from the second ajax request.
 * We don't actually care about this, so we just ignore
 * the results.
 */
function handleResponse2()
{
    // we don't care about this response
}
