function $(id) { return document.getElementById(id); }


function aaa(){
    //document.getElementById("mail").innerHTML += "tresc wiadomosci<br>";
    var kon = $("email").value;
    var tyt = $("tytul").value;
    var tre = $("tresc").value;
    if(kon==""){
		$("mail").innerHTML = "<b>Pole z kontaktem zwrotnym nie moze pozostac puste!!!</b><br/>"+$("mail").innerHTML;
    }else{
    if(tyt!=""){
    tyt = "Geodet.pl - "+tyt;
    }
    if(tyt==""){
    tyt = "Geodet.pl - Brak tytulu wiadomosci!!!";
    }
    if(tre==""){
		$("mail").innerHTML = "<b>Pole z trescia wiadomosci nie moze pozostac puste!!!</b><br/>"+$("mail").innerHTML;
    }else{
    $("mail").innerHTML = "Kontakt zwrotny = "+kon+"<br/>";
    $("mail").innerHTML += "Tytul wiadomosci = "+tyt+"<br/>";
    $("mail").innerHTML += "tresc = "+tre+"<br/>";
    kon = "kontakt="+escape(kon);
    tyt = "tytul="+escape(tyt);
    tre = "tresc="+escape(tre);
  
  //var send = '<?php ';
	//send += "mail('biuro@geodet.pl', ";
	//send += 'tytul'+" , ";
	//send += 'tresc'+" , ";
	//send += 'kubutek'+"); "
    //send += ' ?>';
    var send = "mail('biuro@geodet.pl', 'tyt', 'message')"
    $("mail").innerHTML = send;
    //$("mail").innerHTML += "<b>Wiadomosc wyslana ! </b> <br/>"
    }}
}

var xhr;

function getWitaj(){

var xhr = createXMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState==4) { // Request is finished
      if (xhr.status==200) {
        $("witaj").innerHTML += xhr.responseText;
      } else {
        alert("Message returned, but with error status.");
      }
    }
  }
  xhr.open("GET", "witaj.html", true);
  xhr.send(null);
}

function getLokal(){

 var xhr = createXMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState==4) { // Request is finished
      if (xhr.status==200) {
        $("lokal").innerHTML += xhr.responseText;
      } else {
        alert("Message returned, but with error status.");
      }
    }
  }
  xhr.open("GET", "lokal.html", true);
  xhr.send(null);
}

function getPliki(){
 var xhr = createXMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState==4) { // Request is finished
      if (xhr.status==200) {
     // $("col4").style.background = "#ffffff";

        $("pliki").innerHTML += xhr.responseText;
	//	$("col4").style.background = "url('tlo2.jpg')";
      } else {
        alert("Message returned, but with error status.");
      }
    }
  }
  xhr.open("GET", "pliki.html", true);
  xhr.send(null);
}

function getKontakt(){
 var xhr = createXMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState==4) { // Request is finished
      if (xhr.status==200) {
     // $("col4").style.background = "#ffffff";

        $("kontakt").innerHTML += xhr.responseText;
		//$("col4").style.background = "url('tlo2.jpg')";
      } else {
        alert("Message returned, but with error status.");
      }
    }
  }
  xhr.open("GET", "kontakt.html", true);
  xhr.send(null);
}


function getLogowanie(){
 var xhr = createXMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState==4) { // Request is finished
      if (xhr.status==200) {
     // $("col4").style.background = "#ffffff";

        $("logowanie").innerHTML += xhr.responseText;
		//$("col4").style.background = "url('tlo2.jpg')";
      } else {
        alert("Message returned, but with error status.");
      }
    }
  }
  xhr.open("GET", "logowanie.html", true);
  xhr.send(null);
}

function createXMLHttpRequest() {
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
  try { return new XMLHttpRequest(); } catch(e) {}
  alert("XMLHttpRequest not supported");
  return null;
}
