﻿
function DovrsiOpis(destFieldName){	
    var obj = document.getElementById(destFieldName);      
    if (obj != null){
	    var val=obj.value;	    
	    var w=window.open('/fcd/Dohvati/OpisTerena.aspx?start='+escape(val)+'&fieldname='+escape(destFieldName),'ChooseDescription',
		    'width=1024,height=600,resizeable=yes,toolbar=no,location=no,menubar=no,directories=no,scrollbars=yes');
	    w.focus();	
	}
}

function PrenesiOpis(listname, textname){
    var list = document.getElementById(listname);  
    var tb = document.getElementById(textname);  
    if (list!=null && tb!=null){
        var ind=list.selectedIndex;
		if (ind==-1) return;							
		tb.value=list.options[ind].text;		
    }
}

function PrenesiValue(listname, textname){
    var list = document.getElementById(listname);  
    var tb = document.getElementById(textname);  
    if (list!=null && tb!=null){
        var ind=list.selectedIndex;
		if (ind==-1) return;							
		tb.value=list.options[ind].value;		
    }
}

function DovrsiKoord(destFieldName){	
    var obj = document.getElementById(destFieldName);  
    if (obj != null){
	    var val=obj.value;
	    var w=window.open('/fcd/Dohvati/Koord.aspx?start='+escape(val)+'&fieldname='+escape(destFieldName),'ChooseKoord',
		    'width=1024,height=600,resizeable=yes,toolbar=no,location=no,menubar=no,directories=no,scrollbars=yes');
	    w.focus();	
	}
}

function PrenesiVrijednost(lb, tbName){
    var tb = document.getElementById(tbName);
    var ind = lb.selectedIndex;
    if (ind != -1){
        tb.value = lb.options[ind].text;
    }
    else
        tb.value = '';
}

function OznaciOstale(lb1, lb2Name, lb3Name, lb4Name){
    var lb2 = document.getElementById(lb2Name);
    var lb3 = document.getElementById(lb3Name);
	var lb4 = document.getElementById(lb4Name);
    var ind = lb1.selectedIndex;
    lb2.selectedIndex = ind;
    lb3.selectedIndex = ind;
	lb4.selectedIndex = ind;
}

function PrikaziReference(s, standard){

    /*var i;
	var s="";
	var list= document.forms[0].ListaZaReference;
	var len=list.length;		
	for(i=0; i<len; i++){
		if (i!=0){
			s+="_";
		}
		s+=list.options[i].value;				
	}*/
	if (s=="") return;
	var w=window.open('/fcd/biblio/Referenca.aspx?word=1&id='+s + '&standard='+standard,'referenca',
		'width=800,height=600,resizable=yes,toolbar=no,location=no,menubar=no,directories=no,scrollbars=yes');
	w.focus();
}
function DodajZaReferencu(cb){				
	var list=document.forms[0].ListaZaReference;//document.getElementById('ListaZaReference');
	var len=list.length;
	if (cb.checked){															
		list.options[len]=new Option(cb.value,cb.value);															
	}
	else{				
		var i;
		for(i=0; i<len ; i++){
			if (list.options[i].value==cb.value){
				list.options[i]=null;
				break;
			}
		}										
	}
}







