﻿try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}


var xmlHttp

function showNews(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showNews.php"
	url=url+"?id="+str
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showNewsArchive()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showNewsArchive.php"
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showOfferArchive()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showOfferArchive.php"
	xmlHttp.onreadystatechange=stateChanged2 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showGallerysFirst()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showGallerysFirst.php"
	xmlHttp.onreadystatechange=stateChanged3 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showGalleryFirst(id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/galleryFirstInclude.php"
	url=url+"?id="+id


    xmlHttp.onreadystatechange=stateChanged4
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showGallerySecond(id,title,cid)
{
    xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/gallerySecondInclude.php"
	url=url+"?id="+id+"&title="+title+"&cid="+cid
	xmlHttp.onreadystatechange=stateChanged4 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showImageName(id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showImageNameSecond.php"
	url=url+"?id="+id
	xmlHttp.onreadystatechange=stateChanged5
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function changeBackground(id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var mytime="&ms="+new Date().getTime();
	var url="data/ajax/showIzbiraOzadja.php"
	url=url+"?id="+id+mytime
	xmlHttp.onreadystatechange=stateChanged6
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	$('.IzbiraOzadjaContainer').toggle(0)
	$('.IzbiraDMC').toggle(0)
	$('.topArrowL').toggle(0)
}

function showLatestNews()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showLatestNews.php"
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showLatestOffer()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
	var url="data/ajax/showLatestOffer.php"
	xmlHttp.onreadystatechange=stateChanged2
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("NewsContainer").innerHTML=xmlHttp.responseText
 barva();
 } 
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("ActualContainer").innerHTML=xmlHttp.responseText 
 } 
}

function stateChanged3() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("underGtext").innerHTML=xmlHttp.responseText
 } 
}

function stateChanged4()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("GalleryFirst").innerHTML=xmlHttp.responseText
 $('#pnlButtons a').lightBox();
 $('#GFimg a').lightBox();
 } 
}

function stateChanged5() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("tukiImeRukni").innerHTML=xmlHttp.responseText
 } 
}

function stateChanged6() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 //document.getElementById("HereBgCSS").innerHTML=xmlHttp.responseText 
 //document.getElementById("HereBgCSS").innerHTML=xmlHttp.responseText 
 //pnlBackground
 document.getElementById("pnlBackground").src = xmlHttp.responseText;
 //alert(xmlHttp.responseText)
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

