/********************************/
/*	 Za GBL izdelal 	*/
/*	 Igor Samotorčan	*/
/* vse pravice pridržane	*/
/********************************/

function natisni_stran(){
	if(!document.getElementById("vsebina")) return;

	var con = document.getElementById("vsebina").innerHTML;

	nat = window.open ("", "natisni","menubar=1,resizable=1,scrollbars=1,width=625,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(document.getElementById("vsebina").innerHTML);
	nat.document.write("<p>Spletni naslov: " + location.href + "</p></body></html>");  

}

function priljubljene(){


	if (navigator.appName == "Microsoft Internet Explorer") {

		var url= location.href; 
		var title= document.title; 

		window.external.AddFavorite(url,title);

	} else {
		alert('Pritisnite Ctrl+D');
	}

}

function povecaj(slika,sir,vis){

	//if(xpop.closed == false) xpop.close();

	 xpop=window.open('/foto.php?img=' + slika,'fotke','width=' + sir + ',height=' + vis);
	 xpop.focus();
}

function popup(url,name,data)
	{
	 www=window.open(url,name,data);
	 www.focus();
	}


var tmp_string = '...iskalni niz';

function user_najdi(obrazec){

  if(obrazec.keywords.value == '' || obrazec.keywords.value == tmp_string)
  {
	obrazec.keywords.value = tmp_string;
	return false;
  }

}

function pocisti_polje(polje){
  if(polje.value == tmp_string){
	polje.value = '';
  }
}




	function oceni(zapis, faktor)
	{
		document.getElementById("blorum"+zapis).style.width = (faktor * 11) + "px";
	}

	function pocisti(zapis)
	{
		document.getElementById("blorum"+zapis).style.width = "0px";
	}



	function glasuj(blorum, ocena)
	{
		url = "/ajax/glasuj_blorum.php?blorum=" + blorum + "&ocena=" + ocena;

		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState == 4)
			{
				if(document.getElementById("ocena_info"))
				{
					document.getElementById("ocena_info").innerHTML = xmlhttp.responseText;
				}
				else
				{
					alert(xmlhttp.responseText);
				}
			}
		}

		xmlhttp.setRequestHeader('Accept','message/x-formresult');
		xmlhttp.send(null);
		return false;
	}


function potrditev_brisanja(msg)
{

		 if (confirm(msg ? msg: "®elite odstraniti zapis?")) return true;  else return false;
}


function potrditev(msg)
{

		 if (spremenjeno && confirm(msg ? msg: "®elite odstraniti zapis?")) return true;  else return false;
}


function slika(slika)
{

	var nat = window.open ("", "natisni","menubar=0,status=1,resizable=1,scrollbars=0,width=100,height=100");



	nat.document.write('<html><head><title>' + document.title + '</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /></head>');
	nat.document.write('<body style="padding: 0px; margin: 0px" onload="window.resizeTo(document.images[0].width+10, document.images[0].height+40)">');
	nat.document.write('<img src="' + slika + '" onclick="window.close();" style="cursor: pointer;">');
	nat.document.write('</body></html>');
	nat.document.close();

}

function xclear(polje, besedilo)
{
	if(polje.value == besedilo)
	{
		polje.value = "";
	}
}


function aLogin()
{

   new Ajax.Request("/uporabniki/q/aCheck?popup",{
			method:'post',
			parameters: 
                        {
				login_uporabnik: $('login_uporabnik').value,
				login_geslo: $('login_geslo').value
			},
			onSuccess: function(stat)
                        {
                                var podatki = stat.responseText.evalJSON();

				$('aInf').innerHTML = podatki.info;
			
                                if(podatki.prijavljen == 'Y')
                                {
                                   alert("prijavljen - redirekt");
                                }

                             return false;
			},
			onFailure: function()
                        {
				$('aInf').innerHTML = 'Napaka pri prijavi (ajax)';
				
				return false;
			}
		}
	);
	
	
return false;
}



function aForum()
{

   new Ajax.Request("/forum/q/aCheck?popup",{
			method:'post',
			parameters: {
				login_uporabnik: $('login_uporabnik').value,
				login_geslo: $('login_geslo').value
			},
			onSuccess: function(stat){

				$('aInf').innerHTML = stat.responseText;
				
			},
			onFailure: function(){
				$('aInf').innerHTML = 'Napaka pri prijavi (ajax)';
			}
		}
	);
	
	
return false;
}

function aSporna()
{
   new Ajax.Request("/forum/q/aSporna",{
			method:'post',
			parameters: 
                        {
				zapis: $('zapis').value,
				pritozba: $('pritozba').value
			},
			onSuccess: function(stat)
                        {
                                var podatki = stat.responseText.evalJSON();
                                
				$('aInf').innerHTML = podatki.info;
				
				if(podatki.status == 'Y')
				{
                                   $('forma').style.display = 'none';
                                }

                             return false;
			},
			onFailure: function()
                        {
				$('aInf').innerHTML = 'Napaka pri prijavi (ajax)';
				
				return false;
			}
		}
	);
	
	
return false;
}


function aThumbs(zapis,smer)
{
   new Ajax.Request("/forum/q/ajax_thumbs",{
			method:'post',
			parameters: 
                        {
				zapis: zapis,
				smer: smer
			},
			onSuccess: function(stat)
                        {
                             var podatki = stat.responseText.evalJSON();

                            // alert(podatki.msg);
                             if(podatki.msg)
                             {
                                alert(podatki.msg);
                             }
                             else
                             {
			        $("thumb" + zapis + "_info").innerHTML = "Glasov: " + podatki.glasov;
                             }

                             return false;
			},
			onFailure: function()
                        {
				$("thumb" + zapis + "_stat").innerHTML = 'Napaka pri glasovanju (ajax)';
				
				return false;
			}
		}
	);
	
	
return false;
}




function fPrikaziPost(id)
{
       $("fi" + id).style.display = 'none';
       $("fz" + id).style.display = 'block';

}







var vrstica = null;


function cez(elementx, barva) {
        if (vrstica == elementx) return;
        elementx.style.backgroundColor = barva;
}

function ven(elementx, barva) {
        if (vrstica == elementx) return;
        elementx.style.backgroundColor = barva;
}


function izbrana(elementx, barva, osnova)
{

              elementx.style.backgroundColor = barva;

      //  if (vrstica) {
//                vrstica.style.backgroundColor = osnova;
                if(vrstica == elementx)
                {
                           vrstica.style.backgroundColor = osnova;
                           vrstica = null;
                  return;
                }
       // }

              vrstica = elementx;

}