// Javascript koda je avtorsko zaščitena by omnia studios, d.o.o


			function pageselectCallback(page_index, jq){
			page_index++;			
			spodnjilimit=(page_index-1)*8;
			zgornjilimit=page_index*8;
			$('.visc').empty()
			
			$('.hiddenc .cmnt').each(function(){
			cmntid=$(this).attr("id");
			cmntid=cmntid.substr(2);
			new_content="";
			
			if(cmntid<=zgornjilimit && cmntid>spodnjilimit){
			new_content=$(".hiddenc #cm"+cmntid).clone();
			$('.visc').append(new_content);
			}
			});
			
			
                return false;
            }
           
            /** 
             * Callback function for the AJAX content loader.
             */
            function initPagination() {
                var num_entries = $('.hiddenc .cmnt').length;
                // Create pagination element
                $("#pages").pagination(num_entries, {
                    num_edge_entries: 1,
                    num_display_entries: 3,
                    callback: pageselectCallback,
                    items_per_page:8
                });

             }










			function pageselectCallbackArhiv(page_index, jq){
			page_index++;			
			spodnjilimit=(page_index-1)*30;
			zgornjilimit=page_index*30;
			$('.visible').empty()
			
			$('.arhivtable tr').each(function(){
			cmntid=$(this).attr("id");
			cmntid=cmntid.substr(2);
			new_content="";
			
			if(cmntid<=zgornjilimit && cmntid>spodnjilimit){
			new_content=$(".arhivtable #id"+cmntid).clone();
			$('.visible').append(new_content);
			}
			});
			
			
                return false;
            }
           
            /** 
             * Callback function for the AJAX content loader.
             */
            function initPaginationArhiv(){
                var num_entries = $('.arhivtable li').length;
                // Create pagination element
                $("#pagesarhiv").pagination(num_entries, {
                    num_edge_entries: 1,
                    num_display_entries: 8,
                    callback: pageselectCallbackArhiv,
                    items_per_page:30
                });
             }
			
			function icmnt(id){

			$.ajax({
  			url: "/izbrisikomentar.php?id="+id,
  			success: function(html){
  			alert(html);			
 			$(".com"+id).animate({height: 0, opacity: 0},500);
  			}
			});
			
			}
			
			

$(document).ready(function() {

$(".maxad").each(function(){
$(this).css({width: "auto",height: "auto"});if($(this).attr("width")>$(this).attr("height")){$(this).css("height","34px");}else{$(this).css("width","37px");}

})


koncano=1;
$(".changetv").click(function(){
if(koncano==1 && $("#dejanskimovie").attr("class")!=$(this).attr('id')){
koncano=0;
prejsnjiclassa=$("#tvhover").attr("class");
prejsnjiclass=prejsnjiclassa.replace("hover","");
$("#tvhover").removeClass(prejsnjiclassa).addClass(prejsnjiclass).attr("id","");

parentclass=$(this).parent().attr("class");
$(this).parent().attr({id:"tvhover"}).removeClass(parentclass).addClass(parentclass+"hover");

var objectta="<object width='560' id='dejanskimovie' class='"+$(this).attr('id')+"' style='display:none' height='340'><param name='movie' value='"+$(this).attr('id')+"&hl=en&fs=1&rel=0'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><param name='wmode' value='transparent'></param><embed src='"+$(this).attr("id")+"&hl=en&fs=1&rel=0' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='544' height='296'></embed></object>";
$("#dejanskimovie").fadeOut(500);
setTimeout(function(){$(".tv").html(objectta);$("#dejanskimovie").fadeIn(500);},501);
setTimeout(function(){koncano=1;},1200);
}
return false;
});

$("form#com").submit(function(){

if($("#commentime").val().length==0 || $("#commentopis").val().length==0 || $("#commentid").val().length==0){alert("Niste izpolnili vseh obveznih polj!");}
else
{

$(".subm").attr('disabled','disabled').addClass("disbutt").val("Objavljam ...");
opis=$("#commentopis").val().replace(/\n/g,"|||||");
opisshow=$("#commentopis").val().replace(/\n/g,"<br />");
ime=$("#commentime").val();
id=$("#commentid").val();
stev=$("#cmntstev").val();
$.ajax({
  url: "/postcmnt.php?ime="+ime+"&opis="+opis+"&id="+id,
  success: function(html){
  $(".subm").val("Objavljeno!");
  novcmnt="<div class='cmnt' id='cm"+stev+"'><div class='komentarstatushold' style='background: #f4f4f4; width: 700px;'><div class='komentarstatus' style='width: 690px;'><div style='float: left;'>Objavil <span style='color: #222;'>"+ime+"</span> ravnokar </div></div></div><div class='komentarcontent' style='background: #fff; border: 2px #f4f4f4 solid; width: 665px; padding: 20px 26px 20px 20px; margin: 0px;'><div>"+html+"</div></div></div>";
  
  setTimeout(function(){$(".compostf").animate({height:"0px",opacity:"0"},1000)},500);
  setTimeout(function(){$(".hiddenc").append(novcmnt);$("#nocmn").css("display","none");initPagination();window.location.href='#komentarji';},1500);
  
  }
});

}


return false;
});
if(document.location.hash.substr(1)!="" && document.location.hash.substr(1)!="naslovnica" && location.pathname.indexOf("/video")!=0 && location.pathname.indexOf("/arhiv/")!=0){
$("."+document.location.hash.substr(1)+"").addClass("on");
$("#ul"+document.location.hash.substr(1)+"").css("display","block").addClass("ulon");

if($(".on").length==0){$(".naslovnica").addClass("on");}else{
$("html").css("backgroundColor","#"+$(".on").children().attr("id"))
}
$(".tvcontainer").hide();
$(".horizontaliframe").attr("src","/ads/728.php?barva="+$(".on").children().attr("id"));
}else if(location.pathname.indexOf("/video")!=-1){
$(".video").addClass("on");

if($(".on").length==0){$(".naslovnica").addClass("on");}else{
$("html").css("backgroundColor","#"+$(".on").children().attr("id"))
}

$(".horizontaliframe").attr("src","/ads/728.php?barva="+$(".on").children().attr("id"));

}else if(location.pathname.indexOf("/arhiv/")==0){



arhiviskanja=location.pathname.replace("/arhiv/","");
arhiviskanja=arhiviskanja.split("/");
arhiviskanja=arhiviskanja[0];
$("."+arhiviskanja+"").addClass("on");

if($(".on").length==0){$(".naslovnica").addClass("on");}else{
$("html").css("backgroundColor","#"+$(".on").children().attr("id"))
}
$(".horizontaliframe").attr("src","/ads/728.php?barva="+$(".on").children().attr("id"));



}else if(location.pathname.indexOf("/video/")==0){




$(".video").addClass("on");

if($(".on").length==0){$(".naslovnica").addClass("on");}else{
$("html").css("backgroundColor","#"+$(".on").children().attr("id"))
}
$(".horizontaliframe").attr("src","/ads/728.php?barva="+$(".on").children().attr("id"));




}
else{
$(".naslovnica").addClass("on");
$("#ulnaslovnica").css("display","block").addClass("ulon");
$(".horizontaliframe").attr("src","/ads/728.php");
}



$("ul.nav li div a").click(function () {

if(location.pathname=="/" && $(".on").children().attr("id") != $(this).attr("id") && $(".on").css("opacity")==1){

$(".ulon").fadeOut(500).removeClass("ulon");
thisul=$(this).html().toLowerCase().replace("\n","");

if(thisul=="naslovnica"){
$(".tvcontainer").fadeIn(500);
$(".horizontaliframe").attr("src","/ads/728.php");

}else{
$(".tvcontainer").fadeOut(500);
$(".horizontaliframe").attr("src","/ads/728.php?barva="+$(this).attr("id"));

}



setTimeout(function(){$("#ul"+thisul).fadeIn(500).addClass("ulon");},500);
$("html").animate({backgroundColor:"#"+$(this).attr("id")+""},1000);
$(".on").animate({opacity: "0"},"slow").removeClass("on");
$(this).parent().parent().find(".active").animate({opacity: "1"},1000).addClass("on");
}else{
thisul=$(this).html().toLowerCase().replace("\n","");
window.location.href='/#'+thisul;

}
});

$("ul.nav li div a").mouseover(function () {$(this).parent().parent().find(".neactive").css({background:"url(img/menuh.png) repeat-x"});});

$("ul.nav li div a").mouseout(function () {$(this).parent().parent().find(".neactive").css({background:"none"});});
initPagination();
initPaginationArhiv();

$(".anketa").click(function(){
$(this).parent().html("<center><img src='/img/pollload.gif' id='pollisloading' alt=\"Loading ...\"/></center>");
target=$(this).attr("target");
tid=$(this).attr("id");
	
$.ajax({
  url: "/vote.php?target="+target+"&id="+tid,
  success: function(htmla){
  $("#pollisloading").parent().parent().html(htmla);
  }
});



return false;

});

});