//fuction to return the xml http object
function getXMLHTTP() {
		var xmlhttp=false;
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{
			try{
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		return xmlhttp;
  }




function getModelSeries(znackaId,typ_zar) {
		var strURL="templates/vyber_seria.php?znacka="+znackaId+"&typ_zar="+typ_zar+"&randval="+Math.random();

		var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('modeldiv').innerHTML=req.responseText;
					} else {
						alert("Chyba XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}

function getModelPN(znackaId) {
		var strURL="templates/vyber_pn.php?znacka="+znackaId+"&randval="+Math.random();

		var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('pn_div').innerHTML=req.responseText;
					} else {
						alert("Chyba XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
	

function getModel(znackaId,modelId,typ_zar) {
		var strURL="templates/vyber_model.php?znacka="+znackaId+"&model="+modelId+"&typ_zar="+typ_zar+"&randval="+Math.random();
		var req = getXMLHTTP();

		if (req) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('seria_div').innerHTML=req.responseText;
					} else {
						alert("Chyba XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
