function popup(url,ime,podatki)
		{
		 window.open(url,ime,podatki);
		}


function nalozi_fotko(lokacija, eee, w, h){

  var slika = '<table><tr><td width="575" height="478" align="center"><img src="' + eee + '" border="0" width="' + w + '" height="' + h + '" onload="info_fotke(0,' + w + ',' + h + ');"></td></tr></table>';

  info_fotke(1, w, h);

  if (document.getElementById)
	{
		x = document.getElementById(lokacija);
		x.innerHTML = slika;
	}
	else if (document.all)
	{
		x = document.all[lokacija];
		x.innerHTML = slika;
	}
  else
  {
	alert('Uporabljate zastareli brkljalnik. Naložite si novejšo verzijo programa (IE, Mozilla, Firefox, Opera...).');
  }

}


function info_fotke(s,w,h)
{
  if(s==1) prikazi_info('ifotke',w,h)
  else skrij_info('ifotke')
}

function prikazi_info(object,w,h) {

  if (document.getElementById)
  {
	document.getElementById(object).style.width = w;
	document.getElementById(object).style.height = h;
	document.getElementById(object).style.visibility = 'visible';
  }
  else if (document.all)
  {
	document.all[object].style.width = w;
	document.all[object].style.height = h;
	document.all[object].style.visibility = 'visible';
  }
}

function skrij_info(object) {

  if (document.getElementById)
  {
	document.getElementById(object).style.visibility = 'hidden';
  }
  else if (document.all)
  {
	document.all[object].style.visibility = 'hidden';
  }
}



function natisni_stran(){
   if(document.getElementById("vsebina")){
	var con = document.getElementById("vsebina").innerHTML;

	nat = window.open ("", "okno","menubar=1,resizable=1,scrollbars=1,width=580,height=480");

	nat.document.write('<html><head><title>Natisni - ' + document.title + '</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /><link href="./css/tiskanje.css" rel="stylesheet" type="text/css" /></head><body style="padding: 9px;">');
	nat.document.write('<h1>' + document.title + '</h1>' + document.getElementById("vsebina").innerHTML);
	nat.document.write("<p>Spletni naslov: " + location.href + "</p></body></html>");  
   }
}


function poslji_prijatelju(){

	nat = window.open ("poslji.php?" + location.href, "okno","menubar=0,resizable=0,scrollbars=0,width=380,height=300");
 
}


function pocisti_polje(polje, tmp_string){
  if(polje.value == tmp_string){
	polje.value = '';
  }
}





function dodaj_related(addvalue)
{

  var array = related;
  size = array.length;
  addindex = size;
  var obstaja = 0;
  var i = addindex+1
   // alert(addvalue);
   idc = addvalue.split("|");


	 for(var j = 0; j < array.length; j++)
	 {
								   //	alert(array[j-1]);
		 ids = array[j].split("|");
	  if(ids[0] == idc[0])
	  {
		 obstaja = 1;
	  }
	 }

  if(obstaja == 0)
  {
	array[i] = array[i-1];
	array[addindex] = addvalue;
	array.length = array.length-1;
  }

  showArray(array);


}

function odstrani_related(array,idzapisa)
{

  size = array.length;
  delindex = idzapisa;
  validNo = (delindex != "NaN");
  inRange = ( (delindex >= 0) && (delindex <= array.length) );

  if (validNo && inRange)
  {
	for (var i=0; i<=size; i++)
	array[i] = ((i == delindex) ? "delete" : array[i]);
	  for (var j=delindex; j<size-1; j++)
		 if (j != size) array[j] = array[j+1];
		 array.length = size-1;
	showArray(array);

   } else alert("Izven indeksa...");

}

function showArray(array)
{

  var ss;
  arraytext = '';
  arraysifre = '';

  for (var i=0; i<array.length; i++)
  {
	ss = array[i].split("|");
	arraytext += ' <a href="javascript:odstrani_related(related,'+i+');">' + ss[1] + '</a>;';
	arraysifre += ss[0] + ',';
  }

if(arraytext=='') arraytext = msg_prazen; //'Ni navezav kategorij artiklov';

document.getElementById('message').innerHTML = arraytext;
document.getElementById('prejemniki').value = arraysifre;

}
