var xmlHttp
var image_id=1
////////////////////////////////////////////////////////////////////////////////

function keyPressed(evt) {
   var F5 = 116;
   if(document.layers) {
             if (evt.which == F5) {
              return false;
           }
   }else if(document.all){
          if (event.keyCode == F5) {
               event.keyCode = 0;
                window.event.returnValue = false;
             }
   }
}


if(document.layers){
     document.captureEvents(Event.MOUSEDOWN);
     document.captureEvents (Event.KEYDOWN);
}
document.onkeydown=keyPressed;
document.onmousedown=click;

////////////////////////////////////////////////////////////////////////////////


function x_onmouseover(str,acolor) {
document.getElementById(str).style.color=acolor;
}

function x_onmouseout(str,acolor) {
document.getElementById(str).style.color=acolor;
}
////////////////////////////////////////////////////////////////////////////////

function button_x_onclick(str)
{
switch(str)
{
case 'Prev':image_id--;SGetPicture(image_id);break;
case 'Next':image_id++;SGetPicture(image_id);break;
case 'First':image_id=0;SGetPicture(image_id);break;
case 'Last':image_id=1000;SGetPicture(image_id);break;
}
}
////////////////////////////////////////////////////////////////////////////////

function SGetPicture(image_id1)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="getcd.php"
url=url+"?q="+image_id1+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=button_x_onclick_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

////////////////////////////////////////////////////////////////////////////////



function SGetPictureDetail(image_id2)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="getgallery.php"
url=url+"?q="+image_id2+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=button_x_onclick_result1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


////////////////////////////////////////////////////////////////////////////////

function button_x_onclick_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if(xmlHttp.responseText.substr(0,3)=='max')
 {
  SGetPicture(xmlHttp.responseText.substr(3));
 }
 if(xmlHttp.responseText.substr(0,3)=='min')
 {
  SGetPicture(xmlHttp.responseText.substr(3));
 }
 else if((xmlHttp.responseText.substr(0,3)!='max')&&
  (xmlHttp.responseText.substr(0,3)!='min'))
 {
 document.getElementById("xxx").innerHTML=xmlHttp.responseText
 SGetPictureDetail(image_id)
 }
}
}

////////////////////////////////////////////////////////////////////////////////

function button_x_onclick_result1()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("xxx1").innerHTML=xmlHttp.responseText
 } 
}

////////////////////////////////////////////////////////////////////////////////
function button1_onclick()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="izbor6.php"+"?nocache=" + Math.random();
xmlHttp.onreadystatechange=button1_onclick_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function button1_onclick_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("asa").innerHTML=xmlHttp.responseText
 } 
}

////////////////////////////////////////////////////////////////////////////////


function MenuGallery(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="detail.php"
url=url+"?id="+str+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=MenuGallery_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function MenuGallery_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("contentdiv").innerHTML=xmlHttp.responseText
 } 
}


////////////////////////////////////////////////////////////////////////////////

function PrikaziObjekt(str1)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="prikaziobjekt.php"
url=url+"?objekt_ref="+str1+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=PrikaziObjekt_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function PrikaziObjekt_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("objektdetail").innerHTML=xmlHttp.responseText;
 } 
}

////////////////////////////////////////////////////////////////////////////////


function PrikaziGalerija(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="prikazigalerija.php"
url=url+"?id="+str+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=PrikaziDelaDetail_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function PrikaziGalerija_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("galerija").innerHTML=xmlHttp.responseText
 } 
}

////////////////////////////////////////////////////////////////////////////////



function MenuSubGallery(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="getcd.php"
url=url+"?q="+str+"&nocache=" + Math.random();
xmlHttp.onreadystatechange=MenuSubGallery_result
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function MenuSubGallery_result()
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint1").innerHTML=xmlHttp.responseText
 } 
}

////////////////////////////////////////////////////////////////////////////////



function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

////////////////////////////////////////////////////////////////////////////////