﻿var l_hn=location.hostname;
var l_p=location.protocol;

function deb(err)
{
//alert(err);
}
function cleanStr(s){
return s.replace(/[šŠ]/g,"s").replace(/[žŽ]/g,"z").replace(/[čČ]/g,"c").replace(/[^a-zA-Z0-9\.\/\?:]/g,"_")
}


$("document").ready(function(){

$("#addonsSlider").easySlider({
    prevText:"Prejšnji",
    prevId:"addonsPrev",
    nextText:"Naslednji",
    nextId:"addonsNext",
    controlsShow:false
});

if ($("#addonsSlider table").length>1 || 1)
    $("#addonsNext").show();

$("#buildsSlider").easySlider({
    prevText:"Prejšnji",
    prevId:"buildsPrev",
    nextText:"Naslednji",
    nextId:"buildsNext",
    controlsShow:false
});
if ($("#buildSlider table").length>1 || true)
    $("#buildsNext").show();


$(".shContent").hide();
$(".shTitle").mouseenter(function(){
$(this).parents("div.shWrapper:first").find(".shContent").show("fast");
});
$(".shWrapper").mouseleave(function(){
$(this).find(".shContent").hide("fast");
});

 $("a[id*=rate]").click(function(){
 $.ajax({
       type: "POST",
       url: "rate.aspx",
       data: "id="+$(this).attr("id"),
       success: function(msg){
            alert( "Hvala za oceno" );
            },
       failure: function(msg){
            //alert();
            }
     });
 });

// Download click:  return xt_click(this,'C', '1', '', 'T');
// Action click:    return xt_click(this,'C', '1', '', 'A')
$("*[name*='download']").click(function(){
var cn=cleanStr($(this).attr("name"));
try{
    return xt_click(this,'C', '1', cn, 'T');
}catch(err){}
});


$("select.filterList").each(function(){
    if(!location.href.match( $(this).attr("id")+"=" ))
        $(this).find("option:first").attr("selected","selected");
    $(this).change(function(){
        if($(this).find("option[selected]").text().toLowerCase()=="izberi")
        {
            var fn = "Filter::"+$(this).attr("id")+"::Odstrani";
            xt_click(this,"C","1",fn,"N");            
            location.href="default.aspx#a_addons";
        }
        else
        {
            var val=$(this).find("option[selected]").text();
            var qs=$(this).attr("id")+"="+escape(val);
            qs="default.aspx?"+ qs+"#a_addons";            
            var fn="Filter::"+$(this).attr("id")+"::"+cleanStr(val);
            xt_click(this,"C","1",fn,"N");
            location.href=qs;
        }
    });
});
$("a[id*='_allAddons']").click(function(){
    var cn="Filter::All_Addons";
    xt_click(this,"C","1",cn,"N");
});
$("a[id*='_topAddons']").click(function(){
    var cn="Filter::Top_Addons";
    xt_click(this,"C","1",cn,"N");
});



$("img[src*='ni_sistem']").click(function(){
    $(this).parents("div.brec:first").next().find(".shContent").show("fast");
});


//exit clicks
$("#topNav a").click(function(){
    var cn="ExitClick::TopNav::" + cleanStr($(this).text());
    xt_click(this,"C","1",cn,"S");
});
$("#footer_links a").click(function(){
    var cn="ExitClick::Foot::" + cleanStr($(this).find("span").text());
    xt_click(this,"C","1",cn,"S");
});
$("#footer_microsoft a").click(function(){
    var cn="ExitClick::Foot::Microsoft";
    xt_click(this,"C","1",cn,"S");
});  
});