    var novaStranica = 0;
	var stranica = 0;
	
    //zove je swf svakih 1.5s
    function callJavascript(str) {
		novaStranica = stranica;
		stranica = 0;
	  	return novaStranica;
	}
	
	function changePoglavlje(newStranica) {
	  	stranica = newStranica;
	}	
	
    function showPopup(page, xPos, yPos) {         
        var urlLength = page.length;
        var pageId = page.substring(urlLength-9, urlLength-4);
        //alert("pageId2: " + pageId);        
        
        selectedArea = -1;
        if (yPos>=45 && yPos<225) {
            if (xPos<=210) {
                selectedArea=1;
            } else {
                selectedArea=2;
            }
        } else if (yPos>=225 && yPos<405) {
            if (xPos<=210) {
                selectedArea=3;
            } else {
                selectedArea=4;
            }
        } else {
            if (xPos<=210) {
                selectedArea=5;
            } else {
                selectedArea=6;
            }
        }                    
       // alert("selectedArea: " + selectedArea + ', pageId: ' + pageId);
        var firma;
        if (selectedArea ==1) {
            firma = eval('(firmePP.'+pageId+'a8)');            
            if (firma) 
                showFirma(pageId, 8, firma);
                
            firma = eval('(firmePP.'+pageId+'a1)');
            if (firma) 
                showFirma(pageId, 1, firma);
            
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
                
            firma = eval('(firmePP.'+pageId+'a11)');
            if (firma) 
                showFirma(pageId, 11, firma);  
        } else if (selectedArea ==2) {
            firma = eval('(firmePP.'+pageId+'a2)');            
            if (firma) 
                showFirma(pageId, 2, firma);
                
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
            
            firma = eval('(firmePP.'+pageId+'a8)');
            if (firma) 
                showFirma(pageId, 8, firma);
                
            firma = eval('(firmePP.'+pageId+'a11)');
            if (firma) 
                showFirma(pageId, 11, firma);  
        } else if (selectedArea ==3) {
            firma = eval('(firmePP.'+pageId+'a3)');            
            if (firma) 
                showFirma(pageId, 3, firma);
                
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
            
            firma = eval('(firmePP.'+pageId+'a9)');
            if (firma) 
                showFirma(pageId, 9, firma);
                
            firma = eval('(firmePP.'+pageId+'a11)');
            if (firma) 
                showFirma(pageId, 11, firma);  
        } else if (selectedArea ==4) {
            firma = eval('(firmePP.'+pageId+'a4)');            
            if (firma) 
                showFirma(pageId, 4, firma);
                
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
            
            firma = eval('(firmePP.'+pageId+'a9)');
            if (firma) 
                showFirma(pageId, 9, firma);
                
            firma = eval('(firmePP.'+pageId+'a11)');
            if (firma) 
                showFirma(pageId, 11, firma);  
        } else if (selectedArea ==5) {
            firma = eval('(firmePP.'+pageId+'a5)');            
            if (firma) 
                showFirma(pageId, 5, firma);
                
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
            
            firma = eval('(firmePP.'+pageId+'a10)');
            if (firma) 
                showFirma(pageId, 10, firma);
                
            firma = eval('(firmePP.'+pageId+'a12)');
            if (firma) 
                showFirma(pageId, 12, firma);  
        } else if (selectedArea ==6) {
            firma = eval('(firmePP.'+pageId+'a6)');            
            if (firma) 
                showFirma(pageId, 6, firma);
                
            firma = eval('(firmePP.'+pageId+'a7)');
            if (firma) 
                showFirma(pageId, 7, firma);
            
            firma = eval('(firmePP.'+pageId+'a10)');
            if (firma) 
                showFirma(pageId, 10, firma);
                
            firma = eval('(firmePP.'+pageId+'a12)');
            if (firma) 
                showFirma(pageId, 12, firma);  
        }
    }
    
    var selEnglish;
    var selWeb;
    var selEmail;
    
    function showFirma(pageId, pos, firma) { 
       // alert('showFirma: ' + pageId + ' pos: ' + pos);
        document.getElementById("popupImgDiv").style.background = 'url(\'ppJpgMiddle/'+pageId+'.jpg\') no-repeat #cecfce';
        if (pos == 1) {           
            document.getElementById("popupImgDiv").style.backgroundPosition ="-15px -75px"; 
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";            
        } else if (pos == 2) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-345px -75px";
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";
        } else if (pos == 3) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-15px -365px";
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";
        }  else if (pos == 4) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-345px -365px";
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";
        } else if (pos == 5) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-15px -665px";
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";
        }  else if (pos == 6) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-345px -665px";
            document.getElementById("popupImgDiv").style.width="335px";
            document.getElementById("popupImgDiv").style.height="300px";
            document.getElementById("popupImgDiv").style.top="80px";
        } else if (pos == 7) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-15px 0px";
            document.getElementById("popupImgDiv").style.width="690px";
            document.getElementById("popupImgDiv").style.height="980px";
            document.getElementById("popupImgDiv").style.top="2px";

        }  else if (pos == 8) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-5px -75px"; 
            document.getElementById("popupImgDiv").style.width="770px";
            document.getElementById("popupImgDiv").style.height="295px";
            document.getElementById("popupImgDiv").style.top="80px";
        }   else if (pos == 9) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-5px -370px"; 
            document.getElementById("popupImgDiv").style.width="770px";
            document.getElementById("popupImgDiv").style.height="295px";
            document.getElementById("popupImgDiv").style.top="80px";
        }   else if (pos == 10) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-5px -665px"; 
            document.getElementById("popupImgDiv").style.width="770px";
            document.getElementById("popupImgDiv").style.height="295px";
            document.getElementById("popupImgDiv").style.top="80px";
        }   else if (pos == 11) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-5px -75px"; 
            document.getElementById("popupImgDiv").style.width="770px";
            document.getElementById("popupImgDiv").style.height="590px";
            document.getElementById("popupImgDiv").style.top="20px";
        }   else if (pos == 12) {
            document.getElementById("popupImgDiv").style.backgroundPosition ="-15px -370px"; 
            document.getElementById("popupImgDiv").style.width="770px";
            document.getElementById("popupImgDiv").style.height="590px";
            document.getElementById("popupImgDiv").style.top="20px";
        }         
        document.getElementById('popupDiv').style.display='block';
        document.getElementById('popupCommands').style.display='block';
        
        if (firma.eglish) {
            document.getElementById('popupEnglish').innerHTML = firma.eglish;   
        } else {
            document.getElementById('popupEnglish').innerHTML = "";
        }
        
        if (firma.email) {
            selEmail = firma.email;
        } else {
            selEmail = "";
        }
        if (firma.web) { 
            selWeb = firma.web;
        } else {
            selWeb = "";
        }
        document.getElementById('oNamaDiv').style.display='none'; 
    }
    
    function hidePopup() {
        document.getElementById('popupEnglish').style.display='none';
        document.getElementById('popupCommands').style.display='none';
        document.getElementById('popupDiv').style.display='none';   
        document.getElementById('oNamaDiv').style.display='none';     
    }    
    
    function sendMail() {
        if (selEmail != "") {
            parent.location.href='mailto:'+selEmail+'?subject=Pronasao sam Vase preduzece u KATALOGU INFORMACIJA 2008';            
        } else {
            alert("Nije navedena e-mail adresa date firme.");
        }        
    }
    
    function goToWeb() {
        if (selWeb != "") {
            window.open("http://" + selWeb, "newWindow")
        } else {
            alert("Nije navedena web adresa date firme");
        }        
    }
    
    function showEnglish() {        
        document.getElementById('popupEnglish').style.display='block';
    }
    
    function hideEnglish() {
        document.getElementById('popupEnglish').style.display='none';
    }
    
    function dumpProps(obj, parent) {
       for (var i in obj) {
          if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
          if (!confirm(msg)) { return; }
          if (typeof obj[i] == "object") {
             if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
          }
       }
    }
    
    function searchAction() {
        var searchText = document.getElementById("inputSelect").value;
        var pocetakOznake=searchText.indexOf('oznaka');
        var oznaka = searchText.substring(pocetakOznake+7, searchText.length);    
        var pageId = oznaka.substring(0, 5);
        var pos = oznaka.substring(6, oznaka.length);
        //alert('(firmePP.'+pageId+'a' + pos + ')');
        var firma = eval('(firmePP.'+pageId+'a' + pos + ')');
        
        if (firma)
            showFirma(pageId, pos, firma);  
    }

    function showONama() {
        document.getElementById("popupImgDiv").style.background = 'url(\'../img/onama.jpg\') no-repeat #cecfce';
        document.getElementById("popupImgDiv").style.backgroundPosition ="0px 0px";
        document.getElementById("popupImgDiv").style.width="420px";
        document.getElementById("popupImgDiv").style.height="600px";
        document.getElementById("popupImgDiv").style.top="25px";     
        document.getElementById('popupDiv').style.display='block';   
        document.getElementById('popupImgDiv').style.display='block'; 
        document.getElementById('oNamaDiv').style.display='block';         
    }
    
    function showImg(img) {
        document.getElementById("popupImgDiv").style.background = 'url(\'../img/' + img + '\') no-repeat #cecfce';    
        if (img=='kcPoljoprivreda.jpg') {
            document.getElementById("popupImgDiv").style.width="760px";            
            document.getElementById("popupImgDiv").style.left = "200px";
        } else {
            document.getElementById("popupImgDiv").style.width="420px";            
            document.getElementById("popupImgDiv").style.left = "150px";
        }
        document.getElementById("popupImgDiv").style.height="600px";   
        document.getElementById('oNamaDiv').style.left = "-300px";
       //document.getElementById('oNamaDiv').style.color = "#06377b";
    }    
    
    var oldExistingBack = "";
    function showImgZoomed() { 
        var existingBack = document.getElementById("popupImgDiv").style.backgroundImage;   
        
        if ((existingBack.indexOf("url(pp") == 0) || (existingBack.indexOf("url(gm") == 0))
            return;
        
        if (existingBack.indexOf("Zoomed") == -1) {
    		oldExistingBack = existingBack;
	    	var existingBackStart = existingBack.substring(0, existingBack.length-5); 
	    	var existingBackExtension = existingBack.substring(existingBack.length-5, existingBack.length );
	    	document.getElementById("popupImgDiv").style.backgroundImage = existingBackStart + "Zoomed" + existingBackExtension;
	    	if (existingBack.indexOf('kcPoljoprivreda.jpg') != -1) {
	            document.getElementById("popupImgDiv").style.width="1540px";            
	            document.getElementById("popupImgDiv").style.height="1200px";      
	            document.getElementById("popupImgDiv").style.left = "200px";
	        } else {
	            document.getElementById("popupImgDiv").style.width="840px";            
	            document.getElementById("popupImgDiv").style.height="1200px";
	            document.getElementById("popupImgDiv").style.left = "150px";
	        } 
	        document.getElementById('oNamaDiv').style.left = "-400px";
        } else {
        	showImg(oldExistingBack);
        	document.getElementById("popupImgDiv").style.backgroundImage = oldExistingBack;  
        }
    }
