﻿/// <depends path="$skin/scripts/sn/SN.js" />
/// <depends path="$skin/scripts/jquery/jquery.js" />
/// <depends path="$skin/scripts/jquery/plugins/jquery.rating.js" />
/// <depends path="$skin/scripts/jquery/plugins/jquery.cookie.js" />

SN.RatingControl = { rating: function(contentId, starsId, hoverPanelId, isReadOnly, rateValue) { $("#" + starsId + " input[type=radio]").rating('enable'); if (hoverPanelId != "") { $("#" + starsId).attr("hoverPanelId", hoverPanelId); $("#" + starsId).hover(function() { SN.RatingControl.hoverEffectOn($(this).attr("hoverPanelId")) }, function() { SN.RatingControl.hoverEffectOff($(this).attr("hoverPanelId")) }); SN.RatingControl.updateHoverPanel(hoverPanelId, rateValue); } }, hoverEffectOn: function(hoverPanelId) { $("#" + hoverPanelId).show(); }, hoverEffectOff: function(hoverPanelId) { $("#" + hoverPanelId).hide(); }, updateHoverPanel: function(hoverPanelId, rateValue) { $("#" + hoverPanelId + " #rating-avg").html(rateValue.AverageRate); var i = 0; for (i = 0; i < rateValue.HoverPanelData.length; i++) { $("#" + hoverPanelId).find("#rating-scale-" + (i + 1)).css("width", SN.RatingControl.toInt(rateValue.HoverPanelData[i].Value) + "%"); $("#" + hoverPanelId).find("#rating-value-" + (i + 1)).html("(" + rateValue.HoverPanelData[i].Value + "%)"); } }, toInt: function(n) { return Math.round(Number(n)); }, initialize: function(contentId, starsId, hoverPanelId, isReadOnly, rateValue) {
    $(document).ready(function() { SN.RatingControl.rating(contentId, starsId, hoverPanelId, isReadOnly, rateValue); $.each($.browser, function(i) { if ($.browser.msie) { $("#" + hoverPanelId).each(function() { $(this).find("div.rating-inside").css("background", "none"); }); } }); }); var average = SN.RatingControl.toInt(rateValue.AverageRate * rateValue.Split); $("#" + starsId + " input:radio[value=" + average + "]").attr("checked", true); $("#" + starsId + " input[type=radio]").rating({ split: rateValue.Split, callback: function(value, link) {
        $.ajax({ url: window.location.protocol + '//' + window.location.host + '/StarVotes.mvc/Rate?id=' + contentId + '&vote=' + value + '&isgrouping=' + rateValue.EnableGrouping, beforeSend: function(a) { $("#" + starsId + " input[type=radio]").rating('disable'); }, context: hoverPanelId, success: function(arg) {
            SN.RatingControl.updateHoverPanel(hoverPanelId, arg); if (!arg.Success) {
                var error = arg.ErrorMessage; if (error == null) { error = "Error has occured!"; }
                alert(error); return false;
            } 
        }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert("Unexcepted error!"); } 
        });
    } 
    }); var $starsId = $("#" + starsId); $($starsId).find("label").each(function() { $(this).hide(); $starsId.show(); });
} 
}
$(document).ready(function() { $('.sn-rating-search-btn').click(function() { if (isNaN($(".sn-rating-search-from").val())) { alert("From field: Only numbers can be entered in the field!"); return false; } else if ($(".sn-rating-search-from").val() == "") { alert("From field: Please enter a value!"); return false; } else if ($(".sn-rating-search-from").val() < 1 || $(".sn-rating-search-from").val() > 5) { alert("From field: Value must be between 1 and 5!"); return false; } if (isNaN($(".sn-rating-search-to").val())) { alert("To field: Only numbers can be entered in the field!"); return false; } else if ($(".sn-rating-search-to").val() == "") { alert("To field: Please enter a value!"); return false; } else if ($(".sn-rating-search-to").val() < 1 || $(".sn-rating-search-to").val() > 5) { alert("To field: Value must be between 1 and 5!"); return false; } else if ($(".sn-rating-search-from").val() > $(".sn-rating-search-to").val()) { alert("From field's value must be lower than To field's value!"); return false; } else { return true; } }); }); $(document).ready(function() {
    if ($("#promo")) {
        var showTab = function() { var showID = $('.promotabs li:first a').attr('rel'); $('.promotabs li:last').slideDown(); $('.promotabs li:first').css('display', 'none'); $('.slj_promocontent').hide(); $(showID).fadeIn('slow', function() { $('.promotabs li:first').remove().appendTo('.promotabs'); }); }
        var selectTab = function(event) {
            event.preventDefault(); isClicked = true; if (isReady) { isReady = false; var showThis = $(this).attr('href'); var thisTab = $(this).parents('li'); $('.promotabs li:last').slideDown(); $(thisTab).css('display', 'none'); $('.slj_promocontent').hide(); $(showThis).fadeIn('slow', function() { $(thisTab).remove().appendTo('.promotabs').find('a').bind('click', selectTab); isReady = true; }); }
            else return;
        }; $('.promotabs li:first').hide().remove().appendTo('.promotabs'); $('#promo').hover(function() { clearInterval(rotator); }, function() { rotator = setInterval(showTab, 5000); }); var rotator = setInterval(showTab, 5000);
    }; if ($('#slj_topchart')) {
        var selectCat = function(event) { event.preventDefault(); event.stopPropagation(); var targetChart = $(this).attr('rel'); var indexOfChar = targetChart.slice(-1) - 1; $(this).parents('li').siblings('li').removeClass('selected'); $(this).parents('li').addClass('selected'); $('#slj_lists').animate({ left: -chartWidth * indexOfChar + 'px' }, 400); }
        var chartWidth = 300; var noOfCharts = $('.slj_chartbody').length; $('#slj_lists').css('width', chartWidth * noOfCharts + 'px'); var chartHeight = $('#slj_lists').height(); $('#slj_topchart_body').height(chartHeight); $('#slj_topchart .slj_catselector li a').click(selectCat);
    } 
}); function median_webaudit() { var d = document, s = screen ? screen.width + 'x' + screen.height : ""; var u = d.URL ? new String(d.URL) : ""; var r = d.referrer ? new String(d.referrer) : ""; return "@s=" + s + "@u=" + escape(u.substring(0, 183)) + "@r=" + escape(r.substring(0, 127)); }
var same = Math.floor(Math.random() * 100000000) + median_webaudit();
