﻿function SwitchClass(oObject, sNewClass)
{
    jQuery(oObject).attr("class", sNewClass);
}

function switchItems(idItemToHide, idItemToShow) {
    jQuery("#" + idItemToHide).fadeOut(200, function() {
        jQuery("#" + idItemToShow).fadeIn(500, function() {
            this.style.removeAttribute("filter");
        });
    });
}

// removes all selected from this class and make the object selected
function switchClassToSelected(sClassName, oObject) {
    jQuery("." + sClassName + "Selected").removeClass(sClassName + "Selected").addClass(sClassName);
    jQuery(oObject).removeClass(sClassName).addClass(sClassName + "Selected");
}

function SingleArrowMouseOver(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/single_arrow_right_rollover.gif");
    }
    catch(excep)
    {}
}
function SingleArrowMouseOut(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/single_arrow_right.gif");
    }
    catch (excep)
    { }
}

function SingleArrowMouseOverTransparent(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/arrow_red_transparent.png");
    }
    catch (excep)
    { }
}
function SingleArrowMouseOutTransparent(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/arrow_white_transparent.png");
    }
    catch (excep)
    { }
}

function DoubleArrowMouseOver(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/double_arrow_right_rollover.gif");
    }
    catch (excep)
    { }
}
function DoubleArrowMouseOut(oLink) {
    try {
        jQuery(oLink).children("img").attr("src", "images/double_arrow_right.gif");
    }
    catch (excep)
    { }
}

function showHideArtists(artistTypeNum, maxArtistTypeNum) {
    for (i = 0; i <= maxArtistTypeNum; i++) {
        if (i != artistTypeNum) {
            jQuery("#artistsItems" + i).hide();
        }
    }
    jQuery("#artistsItems" + artistTypeNum + "").toggle(500);
}

function showArtistInfoPanel(idPanel, oSource, oPanelsLoadDynamicContentJason, idHiddenPanelButton) {
    jQuery(".panelSelector").hide();
    hideObjectsPanel("divArtistPanelAudioMiddle");
    hideObjectsPanel("divArtistPanelVideoMiddle");

    jQuery("#" + idPanel + "Middle").show();
    jQuery("#" + idPanel + "Right").show();

    if (idPanel == "divArtistPanelAudio" || idPanel == "divArtistPanelVideo") {
        showObjectsPanel(idPanel + "Middle");
    }

    // set css
    jQuery(".rightMenuSelected").removeClass("rightMenuSelected").addClass("rightMenu");
    jQuery(".RightMenuDivSelected").removeClass("RightMenuDivSelected").addClass("RightMenuDiv");
    jQuery(oSource).addClass("rightMenuSelected");
    jQuery(oSource).parent("div").addClass("RightMenuDivSelected");

    var bReturn = oPanelsLoadDynamicContentJason[idPanel];
    oPanelsLoadDynamicContentJason[idPanel] = false;

    if (bReturn && idHiddenPanelButton != "") {
        jQuery("#" + idHiddenPanelButton).click();
    }
}

function setArtistPhoto(iItemIndex) {
    jQuery(".PhotoContainer").hide();
    jQuery(".PhotoContainer:eq(" + iItemIndex + ")").fadeIn(300);
}

function middlePhotosPrev() {
    var oDiv = jQuery(".PhotoContainer:visible");
    if (oDiv.prev(".PhotoContainer").hasClass("PhotoContainer")) {
        oDiv.hide();
        oDiv.prev(".PhotoContainer").fadeIn(300);
    }
}
function middlePhotosNext() {
    var oDiv = jQuery(".PhotoContainer:visible");
    if (oDiv.next(".PhotoContainer").hasClass("PhotoContainer")) {
        oDiv.hide();
        oDiv.next(".PhotoContainer").fadeIn(300);
    }
}

function rightSmallPhotosPrev() {
    var oDiv = jQuery(".rightSmallPhotosContainer:visible");
    if (oDiv.prev(".rightSmallPhotosContainer").hasClass("rightSmallPhotosContainer")) {
        oDiv.hide();
        oDiv.prev(".rightSmallPhotosContainer").show();
    }
}
function rightSmallPhotosNext() {
    var oDiv = jQuery(".rightSmallPhotosContainer:visible");
    if (oDiv.next(".rightSmallPhotosContainer").hasClass("rightSmallPhotosContainer")) {
        oDiv.hide();
        oDiv.next(".rightSmallPhotosContainer").show();
    }
}

function setArtistVideo(iItemIndex) {
    jQuery(".VideoContainer").hide();
    jQuery(".VideoContainer:eq(" + iItemIndex + ")").fadeIn(300);
}

function rightSmallVideosPrev() {
    var oDiv = jQuery(".rightSmallVideosContainer:visible");
    if (oDiv.prev(".rightSmallVideosContainer").hasClass("rightSmallVideosContainer")) {
        oDiv.hide();
        oDiv.prev(".rightSmallVideosContainer").show();
    }
}
function rightSmallVideosNext() {
    var oDiv = jQuery(".rightSmallVideosContainer:visible");
    if (oDiv.next(".rightSmallVideosContainer").hasClass("rightSmallVideosContainer")) {
        oDiv.hide();
        oDiv.next(".rightSmallVideosContainer").show();
    }
}

// a work around for hiding a panel with flash player and don't stop the player
function hideObjectsPanel(idPanel) {
    jQuery("#" + idPanel).css('visibility', 'hidden').css('width', '0px').css('height', '0px');
}
function showObjectsPanel(idPanel) {
    jQuery("#" + idPanel).css('visibility', 'visible').css('width', '').css('height', '');
}
