$(window).load(function() {
    $("#loginInput").focus(function(){
        if($(this).val() == "логин")
            $(this).val('');
    });
    $("#loginInput").blur(function(){
        if($(this).val() == '') {
            $(this).val("логин");
        }
    });

    $("#searchQ").focus(function(){
        if($(this).val() == "Поиск")
            $(this).val('');
    });
    $("#searchQ").blur(function(){
        if($(this).val() == '') {
            $(this).val("Поиск");
        }
    });

    // logo
    $("div.header div.logo a").focus(function(){
        $(this).blur();
    });
    // logo end

    // nav main
    $("div.nav-main li a").focus(function(){
        $(this).blur();
    });
    // nav main end

    // nav people
    $("div.nav-people li a").focus(function(){
        $(this).blur();
    });
    // nav people end

//clothes filter
	$("#clothesFilter dt a").click(function(){
		$(this).parent().toggleClass("open");
		if($(this).parent().hasClass("open")) {
			$($(this).attr("href")).hide();
		} else {
			$($(this).attr("href")).show();
		}
		return false;
	});
// goodCard
	$("#goodCard div.more-images span.item a").click(function(){
		$(this).blur();
		$("#goodCard div.more-images span.item").removeClass("selected");
		$(this).parent().parent().parent().addClass("selected");
		return false;
	});
// goodCardPics
	$("#goodCard div.info div.color span.item a").click(function(){
		$(this).blur();
		$("#goodCard div.info div.color span.item").removeClass("selected");
		$(this).parent().addClass("selected");
		return false;
	});

});


$(window).load(function(){
    $('#tabs').tabs();
});

function buildWindow ( url, title, settings ) {
    window.open ( url, "voteWindow", settings );
}

function RGBtoHex(R,G,B) {
    return toHex(R)+toHex(G)+toHex(B)
}

function toHex(N) {
    if (N == null) {
        return "00";
    }
    N = parseInt(N);
    if (N == 0 || isNaN(N)) {
        return "00";
    }
    N = Math.max(0, N);
    N = Math.min(N, 255);
    N = Math.round(N);
    return "0123456789ABCDEF".charAt((N-N%16)/16)
    + "0123456789ABCDEF".charAt(N%16);
};

var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

if (jQuery.browser.msie && (ie55 || ie6)) {
    $(window).load(function() {
        $(".hoverfix").live('mouseover', function () {
            $(this).addClass("hover")
        }).live('mouseout', function () {
            $(this).removeClass("hover")
        });
    });
}

$(window).load(function(){
    $("div.set-image div.map").click(function () {
        window.location.href = $(this).attr("rel");
    });
});
