function create_about(d){
my_div = document.getElementById('m_div'+d);
if (my_div.style.display=="block"){my_div.innerHTML="";my_div.style.display="none";}
else {
my_div.style.display="block";
advAJAX.post( {
         url : "./xml/xml_dxinfo.php",
         parameters :
         {
            "id" : d
         },
         onSuccess : function(obj) {create_aboutF(obj.responseXML);}
});
}}

function create_about_div(d){
my_div = document.getElementById('m_div'+d);
my_div.style.display="block";
advAJAX.post( {
         url : "./xml/xml_dxinfo.php",
         parameters :
         {
            "id" : d
         },
         onSuccess : function(obj) {create_aboutF(obj.responseXML);}
});
}

function create_aboutF(xml){
  var a = xml.getElementsByTagName("id").item(0).firstChild.data;
  var xml_call = xml.getElementsByTagName("call").item(0).firstChild.data;
  var xml_about = xml.getElementsByTagName("about").item(0).firstChild.data;
  var my_div = document.getElementById('m_div'+a);
  var html = "";

  if (xml_about=="N"){
  xml_about = " In our database we don't have personal info about "+xml_call;
  }
  html="<table width='50%'>";
  html+="<tr>";
  html+="<td><span id='about'"+a+" class='member_list' style='font-size: 8pt;color:red;cursor:auto;'> info </span></td>";
  html+="<td><span id='write'"+a+" class='member_list' style='font-size: 8pt;' onClick='create_maps("+a+")'> location </span></td>";
  html+="<td><span id='qth'"+a+" class='member_list' style='font-size: 8pt;' onClick='create_qsl("+a+")'> qsl status </span></td>";
  html+="<td><span id='close'"+a+" class='member_list' style='font-size: 8pt;' onClick='close_div("+a+")'> close </span></td>";
  html+="</tr>";
  html+="</table>";
  html+="<div id='view'"+a+" class='about_member_div'>";
        html+= xml_about;
  html+="</div><br />";
  my_div.innerHTML=html;
}

function create_maps(a){
advAJAX.post( {
         url : "./xml/activ_qth.php",
         parameters :
         {
            "id" : a
         },
         onSuccess : function(obj) {create_mapsF(obj.responseXML);}
});
}

 function create_mapsF(xml){

  var a = xml.getElementsByTagName("id").item(0).firstChild.data;
  var xml_call = xml.getElementsByTagName("call").item(0).firstChild.data;
  var xml_lat = xml.getElementsByTagName("lat").item(0).firstChild.data;
  var xml_lon = xml.getElementsByTagName("lon").item(0).firstChild.data;
  var my_div = document.getElementById('m_div'+a);

  var html="";
  html="<table width='50%'>";
  html+="<tr>";
  html+="<td><span id='about"+a+"' class='member_list' style='font-size: 8pt;' onClick='create_about_div("+a+")'> info </span></td>";
  html+="<td><span id='write"+a+"' class='member_list' style='font-size: 8pt;color:red;cursor:auto;'> location </span></td>";
  html+="<td><span id='qth"+a+"' class='member_list' style='font-size: 8pt;' onClick='create_qsl("+a+")'> qsl status </span></td>";
  html+="<td><span id='close"+a+"' class='member_list' style='font-size: 8pt;' onClick='close_div("+a+")'> close </span></td>";
  html+="</tr>";
  html+="</table>";

  if (xml_lat=="N" || xml_lon=="N"){
  html+="<div id='view"+a+"' class='about_member_div'>";
        html+= " at the moment we don't have informatios about geo location for: "+xml_call+" activation";
  html+="</div><br />";
  my_div.innerHTML=html;
  }
  else{
  html+="<div id='view"+a+"' style='height:400px;border:2px solid black;text-align:center;'>";
  html+="</div><br />";
  my_div.innerHTML=html;

      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("view"+a));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(xml_lat, xml_lon), 5);
    var icon = new GIcon();
    icon.image = "http://www.exdx.uznam.net.pl/images/pin1.png";
    icon.iconSize = new GSize(10, 10);
    icon.iconAnchor = new GPoint(6, 20);
    icon.infoWindowAnchor = new GPoint(5, 1);
    var point = new GPoint(xml_lon, xml_lat);
    var marker = new GMarker(point,icon);
    map.addOverlay(marker);

      }
  }
 }
 
function create_qsl(d){
my_div = document.getElementById('m_div'+d);
my_div.style.display="block";
advAJAX.post( {
         url : "./xml/xml_qsl.php",
         parameters :
         {
            "id" : d
         },
         onSuccess : function(obj) {create_qslF(obj.responseXML);}
});
}

function create_qslF(xml){
  var a = xml.getElementsByTagName("id").item(0).firstChild.data;
  var xml_call = xml.getElementsByTagName("call").item(0).firstChild.data;
  var xml_about = xml.getElementsByTagName("about").item(0).firstChild.data;
  var my_div = document.getElementById('m_div'+a);
  var html = "";

  if (xml_about=="N"){
  xml_about = " In our database we don't have informations about QSL status for this activation: "+xml_call;
  }
  html="<table width='50%'>";
  html+="<tr>";
  html+="<td><span id='about'"+a+" class='member_list' style='font-size: 8pt;' onClick='create_about_div("+a+")'> info </span></td>";
  html+="<td><span id='write'"+a+" class='member_list' style='font-size: 8pt;' onClick='create_maps("+a+")'> location </span></td>";
  html+="<td><span id='qth'"+a+" class='member_list' style='font-size: 8pt;color:red;cursor:auto;'> qsl status </span></td>";
  html+="<td><span id='close'"+a+" class='member_list' style='font-size: 8pt;' onClick='close_div("+a+")'> close </span></td>";
  html+="</tr>";
  html+="</table>";
  html+="<div id='view'"+a+" class='about_member_div'>";
        html+= xml_about;
  html+="</div><br />";
  my_div.innerHTML=html;
}
function close_div(div){
         var my_div = document.getElementById('m_div'+div);
         my_div.style.display="none";
}
function close_search(){
 var div_res=document.getElementById("search_result_view");
   var search_div = document.getElementById('search_area');
      var search_result = document.getElementById('search_result');
              search_result.style.display="none";
              search_div.style.display="block";
   search_div.innerHTML="search in our logs";
   if (div_res.style.display=="block") {div_res.style.display="none";}
}
function empty(){
var f_color=document.getElementById('f_search');
    f_color.value="";
    f_color.style.color="black";
 div_res=document.getElementById("search_result_view");
  if (div_res.style.display=="block") {div_res.style.display="none";}
}
function search_log(){
   var search_div = document.getElementById('search_area');
   var search_result = document.getElementById('search_result');
        search_div.style.display="none";
        search_result.style.display="block";
        document.getElementById('f_search').style.color="black";
        document.getElementById('f_search').value="write your call";
}

function search_a(){
var a=document.getElementById("f_search").value;

 if(a.length!=0 && a!="write your call"){

advAJAX.get(
{
   url: "./xml/xml_log.php?call=" + a,
    onSuccess : function(obj) {
    search_aF(obj.responseXML);
    }
});
}
else {
var f_color=document.getElementById("f_search");
    f_color.style.color="red";
    f_color.value="write your call";
}
};
//****************

function search_aF(xml)
{
  var call=document.getElementById("f_search").value;
  var myDiv = document.getElementById("search_result_view");
        myDiv.style.display="block";
  var b = xml.getElementsByTagName("b").item(0).firstChild.data;
  activationArray = xml.getElementsByTagName("a");
  sArray = xml.getElementsByTagName("s");
  rArray = xml.getElementsByTagName("r");
  
  var td = "";
  var htm = "";
  var html = "";
  if (b==2){
      htm +="<br /><div style='width:400px;border:1px solid black;'>";
      htm +="<table align='center' style='width:250px' cellspacing='0' cellpadding='0'>";
      htm +="<tr><td style='height:20px; font: bold 12px verdana; text-align:center;color:blue;' colspan='3'><b>call " + call + ":&nbsp;&nbsp;&nbsp;search result </b></td></tr>";

      htm +="<tr>";
      htm +="<td style='height:20px;width:130px;font: bold 10px verdana; text-align:left;color:blue;'>&nbsp;&nbsp;activations</td>";
      htm +="<td style='width:60px; font: bold 10px verdana; text-align:center;color:blue;'>qsl-rec</td>";
      htm +="<td style='width:60px; font: bold 10px verdana; text-align:center;color:blue;'>qsl-send</td>";
      htm +="<tr>";
      htm +="<tr><td style='height:2px;' colspan='3'></td></tr>";
  for (var i=0; i< activationArray.length; i++) {
  var rec=rArray.item(i).firstChild.data;
  var send=sArray.item(i).firstChild.data;
  if(rec=="N") rec="Not";
     else rec="Yes";
  if(send=="N") send="Not";
     else send="Yes";
     
    td +="<tr><td style='height:20px; font: bold 12px verdana; text-align:left;' >&nbsp;&nbsp;<b>" + activationArray.item(i).firstChild.data + "</b></td>";
    td +="<td style='height:20px; font: bold 12px verdana; text-align:center;' >"+rec+"</td>";
    td +="<td style='height:20px; font: bold 12px verdana; text-align:center;' >"+send+"</td>";
    td +="</tr>";
    }
  end ="</table>";
  end +="<p><span style='margin-top:10px;width:400px;font: bold 10px verdana;color:red;text-align:center'>";
  end +="<center>if you want to receive e-qsl card click below button</center>";
  end +="</span></p>";
  
  end +="<p><span style='margin-top:7px;width:400px;text-align:center'>";
  end +="<form method='POST' action='./e_qsl.php'>";
  end +="<input type='hidden' name='call' value='"+call+"' />";
  end +="<input style ='background:#808080; color:white; width:100px;height:20px;border: 1px solid black;font: bold 12px verdana;' type='submit' value='E-QSL' />";
  end +="</form>";
  end +="</span></p>";
  
  end +="</div>";
  html = htm + td + end;
  myDiv.innerHTML = html;
  }
  else {
      htm +="<br /><div style='width:400px;border:1px solid black;'>";
      htm +="<table align='center' style='width:290px' cellspacing='0' cellpadding='0'>";
      htm +="<tr><td style='height:20px; font bold 12px verdana; text-align:center;' colspan='3'><b>call " + call + ":&nbsp;&nbsp;&nbsp;search result </b></td></tr>";
      td +="<tr><TD style='height:20px; font bold 12px verdana;text-align:center;color:red;'> Not find your callsign in our logs. </td></tr>";
      end ="</table></div>";
  html = htm + td + end;
  myDiv.innerHTML = html;
  }
}

   function open_window(a) {
      var NEW_WIN = null;
      var url="./a_photos/big/"+a+".jpg";
      NEW_WIN =  window.open("", "Photos viewer", "menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width=500, height=400 ");
      NEW_WIN.location.href = url;
}

function view_a(d,n){
var my_div = document.getElementById('photo_'+d);
    my_div.style.display="block";
var photo="./a_photos/big/"+n+".jpg";
     my_div.innerHTML = "<img onClick='close_photo("+d+")' style='cursor:pointer' src='"+photo+"' border=2 alt='close this photo' />";

}
function close_photo(d){
var my_div = document.getElementById('photo_'+d);
    my_div.style.display="none";
}
//****************
