if (document.images) {
	n1on = new Image();    n1on.src = "images/nav-brands-on.gif";
	n2on = new Image();    n2on.src = "images/nav-products-on.gif";
	n3on = new Image();    n3on.src = "images/nav-support-on.gif";
	n4on = new Image();    n4on.src = "images/nav-reference-on.gif";
	n5on = new Image();    n5on.src = "images/nav-a2a-on.gif";
	n6on = new Image();    n6on.src = "images/nav-kupatila-on.gif";

	h1on = new Image();    h1on.src = "images/home-nav-brands_on.gif";
	h2on = new Image();    h2on.src = "images/home-nav-products_on.gif";
	h3on = new Image();    h3on.src = "images/home-nav-support_on.gif";
	//h4on = new Image();    h4on.src = "images/home-nav-company_on.gif";
	h4on = new Image();    h4on.src = "images/home-nav-reference_on.gif";
	h5on = new Image();    h5on.src = "images/home-nav-a2a_on.gif";
	h6on = new Image();    h6on.src = "images/home-nav-kupatila_on.gif";
}

function imgOn(imgName) {
	if (document.images) {
		oSrc=document[imgName].src;
		document[imgName].src = eval(imgName + "on.src");
	}
}
function imgOff(imgName) {
	if(oSrc){
		document[imgName].src = oSrc;
	}
}

function setBg(id){
	document.getElementById(id).style.backgroundImage='url(images/home-product_on.gif)';
}

function setBgOff(id){
	document.getElementById(id).style.backgroundImage='url(images/home-product.gif)';
}

function otvori(nesto){
		var obj = nesto;
		var state = document.getElementById(obj).style.display;
		if(state == "block"){
			document.getElementById(obj).style.display="none";
		} else {
			document.getElementById(obj).style.display="block";
		}
		return;
}
// AJAX
function ajaxRequest(){
 		var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE
 		if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  			for (var i=0; i<activexmodes.length; i++){
   				try{
    				return new ActiveXObject(activexmodes[i]);
   				}
   				catch(e){
    				alert("Vaš browser ne podržava AJAX.");
   				}
  			}
 		}
 		else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  			return new XMLHttpRequest();
 		else
  			return false;
	}

// expand brands
function expandBrands(cid,where)
{
	var mypostrequest=new ajaxRequest();
	mypostrequest.onreadystatechange=function(){
		if (mypostrequest.readyState==4){
			if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){
				document.getElementById(where).childNodes[0].nodeValue = mypostrequest.responseText;
			}
			else{
				alert("Greška prilikom obrade zahteva.");
			}
		}
	}
	var parameters="load=true&cid="+cid;
	mypostrequest.open("POST", "ajax/ajaxcomon.php", true);
	mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	mypostrequest.send(parameters);

}

