﻿//pathArray = window.location.pathname.split( '/' );
var urlHash = "";
var iehash ="";
function historyk()
{
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
 var ieversion=new Number(RegExp.$1) 
 if (ieversion<8)
 {
 return false;
 }
 }

 if (window.location.hash==urlHash) {

 return;
 }

     urlHash = window.location.hash;
	 var trueHash = new Array();
	 var ieh = new Array();
	 var dziwak2;
	trueHash =urlHash.split("#");


	if(trueHash[1]=="lokalizacja")
	{
		dziwak2=1;
	}
	else if(trueHash[1]=="odkurzacze-centralne-formularz-doboru" || trueHash[1]=="pompy-ciepla-formularz-doboru")
	{
	dziwak2=3;

	}
	else
	{
	dziwak2=0;
	}

	wczytaj('class/tabelka_ajax.php','load='+trueHash[1] ,'tabelka','0');
	wczytaj('class/tresc_ajax.php','load='+trueHash[1]  ,'infobox',	dziwak2); 
	wczytaj('class/menu_ajax.php','load='+trueHash[1]  ,'menu','0');

     
 

}



function nicjacjaAJAX(){
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla
http_request = new XMLHttpRequest();
}
else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {

return false;
}

return http_request;
}



function wczytaj(url, parameters, diva, dziwak) {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
 var ieversion=new Number(RegExp.$1) 
 if (ieversion<8)
 {
 return false;
 }
 }
var http_request1=nicjacjaAJAX(); 
http_request1.onreadystatechange = function(){ obslugaAJAX(http_request1, diva, dziwak); };
http_request1.open('POST', url, true);
http_request1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request1.setRequestHeader("Content-length", parameters.length);
http_request1.setRequestHeader("Connection", "Keep-Alive");
http_request1.send(parameters);

}



function obslugaAJAX(http_requestobj, diva2, dziwak) {
if (http_requestobj.readyState == 1) {
//document.getElementById(diva).innerHTML = "Ładowanie...";

}
if (http_requestobj.readyState == 4) {
if (http_requestobj.status == 200) {
if(http_requestobj.responseText!="")
{
if(dziwak == 2)
{
document.title =  http_requestobj.responseText;
}
else
{
document.getElementById(diva2).innerHTML = http_requestobj.responseText;
}
if(dziwak == 3)
{
	 multiselector_init();
}
	 
else if(dziwak == 1)
{
mapaStart();
emailCloak();

}
else
{
emailCloak();
}
}
}

}
}

function mAJAXis(kontrolka, ile, dziwak3)
{
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
 var ieversion=new Number(RegExp.$1) 
 if (ieversion<8)
 {
 document.location.href=kontrolka+".html";
// document.getElementById('iehistory').setAttribute("src","blank.php?link="+kontrolka+'&ile='+ile+'&bone='+dziwak3);
 }
 }



	if(ile==1)
	{
		wczytaj('class/tresc_ajax.php','load='+kontrolka  ,'infobox',	dziwak3); 
			wczytaj('class/title_ajax.php','load='+kontrolka ,'title',	'2'); 
	}
	else if (ile==2)
	{
		wczytaj('class/tresc_ajax.php','load='+kontrolka ,'infobox',	dziwak3); 
		wczytaj('class/menu_ajax.php','load='+kontrolka  ,'menu','0');
			wczytaj('class/title_ajax.php','load='+kontrolka ,'title',	'2'); 
	}
	else if (ile==3)
	{

		wczytaj('class/tabelka_ajax.php','load='+kontrolka ,'tabelka','0');
		wczytaj('class/tresc_ajax.php','load='+kontrolka ,'infobox',	dziwak3); 
		wczytaj('class/menu_ajax.php','load='+kontrolka ,'menu','0');
			wczytaj('class/title_ajax.php','load='+kontrolka ,'title',	'2'); 
	}
	

document.location.hash=kontrolka;


}

