//jquery
$(document).ready(function(){


   $('input[title!=""]').hint();



//$("#cancellogin").click(function(){
//    $(" #fadeall").fadeOut(50);
//    $("#loginform").fadeOut(200);
//});
//$("#hreflogin").click(function(){
//    $(" #fadeall").fadeIn(50);
//    $("#loginform").fadeIn(200);
//    return false;
//});
//




///category
    $("a.liexpand").live("click", function(){
       $(this).removeClass("liexpand").addClass("liexpanded").parent("li").find("ul").slideDown(300);
    });
    $("a.liexpanded").live("click", function(){
       $(this).removeClass("liexpanded").addClass("liexpand").parent("li").find("ul").slideUp(300);
    });


    $("a.acat").click(function(){
        $(this).parent("li").find(".kvadratik").click();
        return false;
    })

    $("li.ulcatli").hover(function(){
        $(this).find(".liexpand").css("background-position","0 -11px")
        $(this).find(".liexpanded").css("background-position","0 -33px")
    }, function(){
        $(this).find(".liexpand").css("background-position","0 0")
        $(this).find(".liexpanded").css("background-position","0 -22px")

    })





///////////////////////////////////////////////////////////////////////////////
// phone

    $("#streetlidedown").toggle(function(){
                $("#streetlistselect").stop().fadeIn(100);
                $("#streetlistselect").shadow();
            }, function(){
                $("#streetlistselect").stop().fadeOut(100);
                $("#streetlistselect").shadowDestroy();
    });

    $("#streetlist li").click(function(){
        str=$(this).text();
        $("#street").removeClass('inactive').val(str);
        $("#streetlistselect").stop().fadeOut(100);
        $("#streetlistselect").shadowDestroy();
    });



//adstring
    if (adstring1arrnum<1){
        $("#adstringbutright").addClass("adbutinactive");
    }
    $("#adstring1text").text(adstring1[0]);
//

//    alert(adstring1arrnum);
    $("#adstringbutleft").click(function(){
        if (!$(this).hasClass("adbutinactive")){
            adstring1current--;
            if (adstring1current<=0){
                adstring1current=0;
                $(this).addClass("adbutinactive");
                $("#adstringbutright").removeClass("adbutinactive");
            } else {
                $("#adstringbutright").removeClass("adbutinactive");
            }
            $("#adstring1text").text(adstring1[adstring1current]);
        }
//        alert(adstring1current);
    })

    $("#adstringbutright").click(function(){
        if (!$(this).hasClass("adbutinactive")){
            adstring1current++;
            if (adstring1current>=adstring1arrnum){
                adstring1current=adstring1arrnum;
                $(this).addClass("adbutinactive");
                $("#adstringbutleft").removeClass("adbutinactive");
            } else {
                $("#adstringbutleft").removeClass("adbutinactive");
            }
            $("#adstring1text").text(adstring1[adstring1current]);
        }
       // alert(adstring1current);
    });



//////////////////////////////////////////////////////////////////////////////
//menu
    $("#show_menu_float").toggle(function(){
        $("#menu_float").css("visibility", "visible")
//        alert($(this).css('width'));
    }, function(){
        $("#menu_float").css("visibility", "hidden")
    })
    $("body").click(function(){
        $("#menu_float").css("visibility", "hidden");
    })

//////////////////////////////////////////////////////////////////////////////

//afisha
    if (division=='afisha'){
        $("a.fancy").fancybox({
            'hideOnContentClick': true,
            'titleShow':false

        });

    }



});





