// Switches the appearance of the tabs
function Switch(tab) {
	if(document.getElementById(tab).className == "inactiveTab") {
		document.getElementById(tab).className = "overTab";
	} else {
		document.getElementById(tab).className = "inactiveTab";
	}
}

// Toggles the visibility of a div
function Show(div) {
	var style = document.getElementById(div).style;
	style.display = "block";
	if(div=="allCat") {
		document.getElementById('seeAll').className='allActive';
	}
}
function Hide(div) {
	var style = document.getElementById(div).style;
	style.display = "";
	if(div=="allCat") {
		document.getElementById('seeAll').className='allInactive';
	}
}

  function createRequestObject() { 

       var req; 
    

       if(window.ActiveXObject) { 
          req = new ActiveXObject("Microsoft.XMLHTTP"); 
		         } else if(window.XMLHttpRequest){ 
          req = new XMLHttpRequest(); 
       } else { 
          alert('Problem creating the XMLHttpRequest object'); 
       } 
    
       return req; 
    
    } 
    
    var http = createRequestObject(); 
    
    function sendRequest(q) { 
		document.getElementById("testiram").innerHTML="<br><h3>Loading Images ... Please Wait!</h3><br><br>";
       http.open('get', 'http://www.softutorials.com/slike.php?q='+q); 
       http.onreadystatechange = handleResponse; 
       http.send(null); 
    
    } 

    function sendRequest2(q) { 
       http.open('get', 'http://www.softutorials.com/includes/ubacimenu.php?q='+q); 
       http.onreadystatechange = handleResponse2; 
       http.send(null); 

    
    } 

	    function sendRequest3(q,qba) { 
			document.getElementById("subcatba").innerHTML="loading ...";
       http.open('get', 'http://www.softutorials.com/subcat.php?ajdi='+q+'&ajdidva='+qba); 
       http.onreadystatechange = handleResponse3; 
       http.send(null); 
    
    } 

    function stavisliku(q) { 
	document.getElementById("slika").style.display='none';
	document.getElementById("slikafinal").value=q;
       http.open('get', 'http://www.softutorials.com/slike.php?izabro=1&q='+q); 
       http.onreadystatechange = handleResponse; 
       http.send(null); 
    
    } 



		    function handleResponse2() { 
       if(http.readyState == 4 && http.status == 200){ 
    
          var response = http.responseText; 
    
          if(response) { 
document.getElementById("submenu").innerHTML=response;
moveIt('birdy',-247);
	document.getElementById("heder").innerHTML='<A HREF="javascript:;" onclick="backba(240)"><h3>Back</h3></A>';

		  }
	   }
		}


	    function handleResponse() { 
    	document.getElementById("slika").style.display='';

       if(http.readyState == 4 && http.status == 200){ 
    
          var response = http.responseText; 
    
          if(response) { 
document.getElementById("testiram").innerHTML=response;
		  }
	   }
		}


	    function handleResponse3() { 
       if(http.readyState == 4 && http.status == 200){ 
          var response = http.responseText; 
          if(response) { 
document.getElementById("subcatba").innerHTML=response;
		  }
	   }
		}

function moveIt(id,x)
{

var supported = (document.getElementById);
if (!supported) return;
var divPath = document.getElementById(id);
var currPos = parseInt(divPath.style.left);
if (currPos > -240){
brzina_x = ( -242 - currPos ) / 4;
brzina_x=Math.round(brzina_x);
currPos += brzina_x;
divPath.style.left = currPos;
setTimeout("moveIt('" + id + "'," + x+ ")",10);
}
}

function backba(x)
{
var supported = (document.getElementById);
if (!supported) return;
var divPath = document.getElementById('birdy');
var currPos = parseInt(divPath.style.left);
if (currPos != 0){
brzina_x = ( 2 - currPos ) / 4;
brzina_x=Math.round(brzina_x);
currPos += brzina_x;
divPath.style.left = currPos;
setTimeout("backba('birdy'," + x+ ")",10);
}else{
	document.getElementById("heder").innerHTML='<h3>Categories</h3>';
	document.getElementById("submenu").innerHTML="";
}

}
