var xmlhttp = false; 

function AjaxRequest(type, url, typen, hide, params){
 xmlhttp=false; 
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); 
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); 
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); 
        }
 var MyTime = new Date;
      xmlhttp.open(type, url+'&UnikTid='+MyTime.getTime(), true);
	  xmlhttp.setRequestHeader("Content-Type", "text/html; charset=UTF-8;"); 
     if (params)
      xmlhttp.setRequestHeader("Content-length", params.length);
      xmlhttp.setRequestHeader("Connection", "close");
      xmlhttp.onreadystatechange=function ()
   {
    if (xmlhttp.readyState==4) 
     {
      var content = xmlhttp.responseText;
	  if (content) {
      document.getElementById(typen).innerHTML = content;
      }
	   
     }
   }



      xmlhttp.send(params);

 }
 
function ChangeLan(varde)
  {
  AjaxRequest("GET", "ajax.functions.php?lan="+varde, 'centers');
  }

function getKommun(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?getKommun=k_"+kommun, 'kommuner');
 }
function getKommunCenterExist(kommun)
 {
  document.getElementById("kommuner").innerHTML = '<img src="img/loader.gif" alt="Laddar">';
  document.getElementById("centers").innerHTML = "";
  AjaxRequest("GET", "ajax.functions.php?getKommunCenterExist=k_"+kommun, 'kommuner');
 }
function getKommuner(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?getKommuner=k_"+kommun, 'kommuner');
 }
 function getCenters(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?getCenters=k_"+kommun, 'centers');
 }
  function getShopCenters(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?type=shop&getCenters=k_"+kommun, 'centers');
 }


function getShopKommun(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?getShopKommun=k_"+kommun, 'kommuner');
 }

function getKommunNoSelect(kommun)
 {
  AjaxRequest("GET", "ajax.functions.php?getKommunNoSelect=k_"+kommun, 'kommuner');
 }

