var xmlHttp = createXmlHttpRequestObject();
var xmlHttpa = createXmlHttpRequestObjecta();



function createXmlHttpRequestObject() 
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        // try to create XMLHttpRequest object
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {} // ignore potential error
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}
function createXmlHttpRequestObjecta() 
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttpa;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlHttpa = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
    for (var i=0; i<XmlHttpVersions.length && !xmlHttpa; i++) 
    {
      try 
      { 
        // try to create XMLHttpRequest object
        xmlHttpa = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {} // ignore potential error
    }
  }
  // return the created object or display an error message
  if (!xmlHttpa)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttpa;
}
function EditD(id)	
{
var url="editd.php" +"?id="+id;
xmlHttp.onreadystatechange=obsluhaStateChange0;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function EditV(id)	
{
var url="editv.php" +"?id="+id;
xmlHttp.onreadystatechange=obsluhaStateChange1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function obsluhaStateChange0()
{
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		var nText = document.getElementById("txt0");
		nText.innerHTML = xmlHttp.responseText;
	}
}
function obsluhaStateChange1()
{
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		var nText = document.getElementById("txt1");
		nText.innerHTML = xmlHttp.responseText;
	}
}


function Menu(adm, men, co,id) 
{
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		document.getElementById("menu").innerHTML = xmlHttp.responseText;
//fh = fopen('incl/'+id+'.htm', 0); // Open the file for reading
//		var nNadpis = document.getintextElementById("mainnadpis");
//		nNadpis.innerHTML = xmlHttp1.responseText;
	}
	}
xmlHttp.open("GET","ajax-menu.php" +"?menuhl="+men+"&co="+co+"&id="+id+"&adm="+adm,true);
	xmlHttp.send(null);
//	xmlHttp.open("GET",url,true);
	//xmlHttp.send(null);

xmlHttpa.onreadystatechange=function()
	{
		if(xmlHttpa.readyState == 4 && xmlHttpa.status == 200)
	{
		document.getElementById("maintextt").innerHTML =  xmlHttpa.responseText;
	}
	}
	xmlHttpa.open("GET","ajax-text.php" +"?menuhl="+men+"&co="+co+"&id="+id,true);
	xmlHttpa.send();
//if(document.getElementById('adminodkaz').href<>'') {
//document.getElementById('adminodkaz').href='admin-editpage_'+id+'.html';
//}





	if(men == 1)
	{

		if(co== 1)	
		{
			document.title = 'ofsetový tisk - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_ofsetovy-tisk.html';}
	//	location.hash = 'akcidencni-tisk.html';
		}
		if(co== 2)
		{
			document.title = 'fotogalerie - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_fotogalerie.html';}
//		location.hash = 'knihy-a-casopisy.html';
		}
		if(co== 3)
		{
			document.title = 'výroba obalů - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_vyroba-obalu.html';}
		}
		if(co== 4)	
		{
			document.title = 'knihařské zpracování - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_kniharske-zpracovani.html';}
		}
		if(co== 5)	
		{
			document.title = 'grafické návrhy a zpracování - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_graficke-navrhy-a-zpracovani.html';}
		}
	}
	if(men == 2)
	{
		if(co== 1)
		{
			document.title = 'naše technologické vybavení - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_nase-technologicke-vybaveni.html';}
		}
		if(co== 2)
		{
			document.title = 'o nás - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_o-nas.html';}
		}
		if(co== 3)	
		{
			document.title = 'ekologie - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_ekologie.html';}
		}
		if(co== 4)	
		{
			document.title = 'reference - Ofsetová tiskárna DEKAMERON Brno';	
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_reference.html';}
		}
		if(co== 5)	
		{
			document.title = 'kariéra - Ofsetová tiskárna DEKAMERON Brno';
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_novinky.html';}
		}
		if(co== 6)	
		{
			document.title = 'novinky - Ofsetová tiskárna DEKAMERON Brno';
			if(adm=='A') {document.getElementById('adminodkaz').href='admin-editpage_'+id+'_novinky.html';}
		}
	}
}



function Hover1(co) {
document.getElementById('m_komun'+co).style.backgroundImage="url('images/komunbgrhover.png')"; document.getElementById('m_komun'+co).style.width='282px';document.getElementById('m_komun'+co).style.zIndex='100';document.getElementById('m_komun'+co).style.height='155px';document.getElementById('m_komun'+co).style.fontSize='1.2em'; 
}

function RHover(co) {
document.getElementById('m_komun'+co).style.backgroundImage="url('images/komunbgr.jpg')"; document.getElementById('m_komun'+co).style.width='223px';document.getElementById('m_komun'+co).style.height='119px';document.getElementById('m_komun'+co).style.zIndex='1';document.getElementById('m_komun'+co).style.fontSize='1em'}

function Poptavka() {

document.getElementById("overlay").style.display='';
	document.getElementById("overlay").style.position='fixed';
	document.getElementById("overlay").style.top='0';
	document.getElementById("overlay").style.left='20%';
document.getElementById("overlay").style.height='100%';
document.getElementById("overlay").style.width='60%'; 
	var obr= document.getElementById("overlay");

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		document.getElementById("overlay").innerHTML = xmlHttp.responseText;
//		var nNadpis = document.getElementById("mainnadpis");
//		nNadpis.innerHTML = xmlHttp1.responseText;
	}
	}
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:10%; height:10%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',1000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:20%; height:20%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',2000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:30%; height:30%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',3000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:40%; height:40%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',4000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:50%; height:50%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',5000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:60%; height:60%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',6000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:70%; height:70%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',7000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:80%; height:80%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',8000);
xmlHttp.open("GET","onlineobjednavka.php",true);
xmlHttp.send();

}

function Registrace() {

document.getElementById("overlay").style.display='';
	document.getElementById("overlay").style.position='absolute';
	document.getElementById("overlay").style.overflow='auto';
	document.getElementById("overlay").style.top='0%';
	document.getElementById("overlay").style.left='0%';
document.getElementById("overlay").style.height='100%';
document.getElementById("overlay").style.width='100%';
document.getElementById("overlay").style.zIndex=1000;
/*document.getElementById("menu").style.display='none';
document.getElementById("maintext").style.display='none';*/

	var obr= document.getElementById("overlay");

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		document.getElementById("overlay").innerHTML = xmlHttp.responseText;
//		var nNadpis = document.getElementById("mainnadpis");
//		nNadpis.innerHTML = xmlHttp1.responseText;
	}
	}
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:10%; height:10%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',1000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:20%; height:20%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',2000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:30%; height:30%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',3000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:40%; height:40%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',4000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:50%; height:50%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',5000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:60%; height:60%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',6000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:70%; height:70%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',7000);
aaa=setTimeout(obr.innerHTML = '<div style=" margin-left:auto; margin-right:auto; width:80%; height:80%; margin-top:5%; margin-bottom:5%;text-align:left; color:white; font-weight:bold; background:url(images/bgrform.png)"></div>',8000);
xmlHttp.open("GET","registrace.php",true);
xmlHttp.send();

}

function Objednavka() {
	myWindow=window.open("http://www.dekameron.cz/melon/klient/","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, fullscreen=yes");
	myWindow.focus();
}



