function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
 
if (http_request.overrideMimeType) {

http_request.overrideMimeType('text/html');

}
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

var xmlhttp;

function countViews(ide)
{  
xmlhttp=GetXmlHttpObject();
var url="http://www.albertbahn.hu/viewcounter.php";
url=url+"?id="+ide;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=function()
{
    if(xmlhttp.readyState==4)
    {
    var iden = "v"+ide;
    document.getElementById(iden).innerHTML=xmlhttp.responseText;
    }
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function sendComment(ide)
{
var urlap = "hsz"+ide;
ny = encodeURIComponent(document.getElementById(urlap).nyelv.value);
com = encodeURIComponent(document.getElementById(urlap).comment.value);
if (com=="")
{
alert("It is not possible to send empty comments!");
}
else
{
document.getElementById(urlap).kuld.value = "Sending comment...";
xmlhttp=GetXmlHttpObject();
var url = "http://www.albertbahn.hu/"+ny+"/admin/comment.php";
var params = "id="+ide+"&comment="+com;
xmlhttp.open("POST", url, true);

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.onreadystatechange = function() {
	if(xmlhttp.readyState == 4) {
	var iden = "h"+ide;
    document.getElementById(iden).innerHTML=xmlhttp.responseText;
	}
}
xmlhttp.send(params);
}
}

function Kinyit(item) {

   obj=document.getElementById(item);
   visible=(obj.style.display!="none");
   
   if (item!="figyu") {
   key=document.getElementById("x" + item);
   if (visible) {

     obj.style.display="none";
     key.innerHTML="[+]";

   } else {

      obj.style.display="block";
      key.innerHTML="[–]";

        }
   }
   else {
   if (visible) {

     obj.style.display="none";
    } 
    else {

      obj.style.display="block";
      }
   }
 }


//Newsbar

  var newsBar;
            
  function Legfrissebb() {
  
  var options = {
        startupDelay:500,
        largeResultSet : true,
        title : " ",
        horizontal : false,
        linkTarget : GSearch.LINK_TARGET_BLANK,
        autoExecuteList : {
        cycleTime : GSnewsBar.CYCLE_TIME_SHORT,
          executeList : ['"railway" OR "railroad" OR "trainset" OR "locomotive" OR "rail network" OR "rail" AND "track" -"est" -"sport" -"sports" -"film" -"drf.com" -"kanglaonline" -"cup" -"championship"']
  }
         }
  
    newsBar = new GSnewsBar(document.getElementById("newsBar-bar"), options);
    newsBar.ns.setResultOrder(google.search.Search.ORDER_BY_DATE);
    }
    
  function Legfontosabb() {
  
  var options = {
        startupDelay:500,
        largeResultSet : true,
        title : " ",
        horizontal : false,
        linkTarget : GSearch.LINK_TARGET_BLANK,
        autoExecuteList : {
        cycleTime : GSnewsBar.CYCLE_TIME_SHORT,
          executeList : ['"railway" OR "railroad" OR "trainset" OR "locomotive" OR "rail network" OR "rail" AND "track" -"est"']
  }
         }
     newsBar = new GSnewsBar(document.getElementById("newsBar-bar"), options);
     newsBar.ns.setResultOrder(google.search.Search.ORDER_BY_RELEVANCE);
    }


//Google Maps

  //<![CDATA[
var map;

    function load()
    {
      if (GBrowserIsCompatible())
      {
        map = new GMap2(document.getElementById("map"));
        map.setMapType(G_PHYSICAL_MAP); 
        map.removeMapType(G_SATELLITE_MAP);
        map.addMapType(G_PHYSICAL_MAP);
        map.setCenter(new GLatLng(48.980217,10.722656), 4);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());       
        var exml = new EGeoXml("exml", map, "http://www.albertbahn.hu/kml/euterkepe.kml");
        exml.parse();

              }
    }

//Térképnyitogató

function Terkinyit(item) {

   obj=document.getElementById(item);
   visible=(obj.style.display!="none");

   if (visible) {

     obj.style.display="none"; 

   } else {

      obj.style.display="block";
      map.checkResize(); 
      map.setCenter(new GLatLng(48.980217,10.722656), 4);
      

        }
}

    //]]>
