//AJAX dio za red letova, tip -> odlasci / dolasci; raspored -> dnevni / sezonski; wrapper -> div container u kojem se puni sadržaj -> wrapper momentalno off


var xmlHttp



// function Red_Leta(raspored, tip, wrapper)
function Red_Leta(raspored, tip)
{ 
 // debug
 // alert("a jel" + raspored + " " + tip +  " " + wrapper)

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url="../../_lib/red_leta.php"
url=url+"?raspored=" + raspored
url=url+"&tip=" + tip
url=url+"&sid="+Math.random()	
if (raspored=="sez")
	{	
	 if (tip=="A")
	 {
		document.getElementById('mblrl_odlasci').style.backgroundImage="url(/images/mbl_red_leta_w.jpg)"
		document.getElementById('mblrl_odlasci').style.borderBottom="thin solid white"
		document.getElementById('mblrl_odlasci').style.borderRight="thin solid white"
		document.getElementById('mblrl_dolasci').style.backgroundImage="none"
		document.getElementById('mblrl_dolasci').style.borderBottom="thin none white"
		document.getElementById('mblrl_dolasci').style.borderLeft="thin none white"
	 }
	 if (tip=="D")
	 {
		document.getElementById('mblrl_dolasci').style.backgroundImage="url(/images/mbl_red_leta_w.jpg)"
		document.getElementById('mblrl_dolasci').style.borderBottom="thin solid white"
		document.getElementById('mblrl_dolasci').style.borderLeft="thin solid white"
		document.getElementById('mblrl_odlasci').style.backgroundImage="none"
		document.getElementById('mblrl_odlasci').style.borderBottom="thin none white"
		document.getElementById('mblrl_odlasci').style.borderRight="thin none white"
	 } 
		xmlHttp.onreadystatechange=stateChanged_sez 
	}
if (raspored=="dn")
	{ 	
	 if (tip=="A")
	 {
		document.getElementById('mblrl_odlasci').style.backgroundImage="url(/images/mbl_red_leta_w.jpg)"
		document.getElementById('mblrl_odlasci').style.borderBottom="thin solid white"
		document.getElementById('mblrl_dolasci').style.backgroundImage="none"
		document.getElementById('mblrl_dolasci').style.borderBottom="thin none white"
	 }
	 if (tip=="D")
	 {
		document.getElementById('mblrl_dolasci').style.backgroundImage="url(/images/mbl_red_leta_w.jpg)"
		document.getElementById('mblrl_dolasci').style.borderBottom="thin solid white"
		document.getElementById('mblrl_odlasci').style.backgroundImage="none"
		document.getElementById('mblrl_odlasci').style.borderBottom="thin none white"
	 }
		xmlHttp.onreadystatechange=stateChanged 
	}
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged_sez() 
{	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
 document.getElementById('red_letova_tabela_s').innerHTML=xmlHttp.responseText 
 } 
}

function stateChanged() 
{	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
 document.getElementById('red_letova_tabela').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;
}

//AJAX dio za SEZONSKI DIO red-a letova, tip -> odlasci / dolasci; wrapper -> div container u kojem se puni sadržaj -> wrapper momentalno off

// function Red_Leta(raspored, tip, wrapper)
function Red_Leta_Sez(tip)
{ 
 // debug
 // alert("a jel" + raspored + " " + tip +  " " + wrapper)

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url="../../_lib/red_leta_sezonski_AJAX.php"
//var url="../../_lib/red_leta.php"
url=url+"?&tip_leta=" + tip
url=url+"&sid="+Math.random()	
	
xmlHttp.onreadystatechange=stateChanged_sez 

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

function stateChanged_sez() 
{	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
 document.getElementById('sezonski_select_2_ajax').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;
}


// pomoc prilikom pagainga kod pretrge sezonskih letova

function SubmitSezonski ()
{
	document.sezonski_pretraga.submit();
}


