/*
Sitewide JS
*/

waPopups = [];

listenTabs = ["", "the_ram", "the_wolves", "animus", "audiobook"];
listenKeys = ["tab", "section", "image", "album", "track", "position"];

function popUpBlockHandler(openFunction, whatTried){
    $("body").append("<div id=\"dialog\" title=\"Pop-Up Blocker Detected\"><p style=\"width:250px;\">The "+whatTried+" tried to open a new window, but was blocked. Click \"Show Window\" to open.</p></div>");
    $("#dialog").dialog({
        bgiframe: true,
        resizable: false,
        width:300,
        height:200,
        modal: true,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.75
        },
        buttons: {
            Cancel: function() {
                $(this).dialog('close');
            },
            "Show Window": function() {
                openFunction();
                $(this).dialog('close');
            }
        }
    });
}

function detectEmptyPopup(waPopup){
    if(waPopup.window.location == "about:blank"){
        waPopup.close();
    }
}

function launchPopup(thisURL,windowName,width,height,left,top,extra){
    var openFunction=function(){

        waPopups[windowName] = open(thisURL, windowName, "width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable,left="+left+",top="+top+extra);
        if(!waPopups[windowName] || waPopups[windowName].closed || !waPopups[windowName].thisBodyId){
            waPopups[windowName] = window.open(thisURL, windowName, "width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable,left="+left+",top="+top+extra);
        } else waPopups[windowName].focus();

        // waPopups[windowName] = window.open( thisURL,windowName,"width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable,left="+left+",top="+top+"");
        if((waPopups[windowName]!=null) && (typeof waPopups[windowName]!="undefined")){
            waPopups[windowName].focus();
            if(windowName == "read_window"){
                setTimeout("detectEmptyPopup(waPopups['"+windowName+"'])", 2000);
            }
            return true;
        }
    }
    successfulOpen=openFunction();
    if(!successfulOpen){
        popUpBlockHandler(openFunction,"\"Listen\" player");
    }
}



/*
Book JS
*/

function initializeBook(){
    $("p.read a").click(function(){
        popupWidth = 900;
        popupHeight = 800;
        if(popupWidth > screen.width) popupWidth = screen.width;
        if(popupHeight > screen.height) popupHeight = screen.height;
        launchPopup($(this).attr("href"),"read_window",popupWidth,popupHeight,0,0,",scrollbars=0");
        return false;
    });
}


/*
Music JS
*/

function refreshPopup(tab, section, image, album, track, position){
    thisURL = "/listen/";
    if(tab > 0 && tab < listenTabs.length){
        thisURL += listenTabs[tab] + "/";
    }
    if(section > 0){
        thisURL += "section_"+section+"/";
    }
    if(image > 0){
        thisURL += "image_"+image+"/";
    }
    if(album > 0){
        thisURL += "album_"+album+"/";
    }
    if(track > 0){
        thisURL += "track_"+track+"/";
    }
    if(position > 0){
        thisURL += "position_"+position+"/";
    }
    launchPopup(thisURL,"listen_window",1130,641,0,0,",scrollbars=0");
}

function embedListenFullScreenButton(buttonWidth){
    swfobject.embedSWF("/swf/listen.swf", "listen_full_screen", buttonWidth, "25", flashVersionRequired, false, {xml:"/xml/listen.xml",language:thisLanguage}, {menu:"false",allowFullScreen:"true",allowScriptAccess:"always"});
}

function bindListenPopup(ref){
    if(thisLanguage == "fr"){
        $(ref).click(function(){
            launchPopup($(this).attr("href"),"listen_window",486,466,(screen.width-486),0,",scrollbars=0");
            return false;
        });
    }else{
        $(ref).click(function(){
            launchPopup($(this).attr("href"),"listen_window",1130,641,0,0,",scrollbars=0");
            return false;
        });
    }
}

function initializeMusic(){
    bindListenPopup(".view_music .standard a");
    embedListenFullScreenButton("170");
    
    if(window.document.location.href.indexOf("/test") != -1){
        $(".view_music .standard a").unbind().click(function(){
            tab = prompt("Popup tab:", "0");
            section = prompt("Popup section:", "0");
            image = prompt("Popup image:", "0");
            album = prompt("Popup album:", "0");
            track = prompt("Popup track:", "0");
            position = prompt("Popup position:", "0");
            refreshPopup(tab, section, image, album, track, position);
            return false;
        });
    }
}

/*
Video JS
*/

function initializeExperience(){
    /* $("#content ol li a").mouseover(function(){
        thisPositionY = parseInt($(this).position().top) - 32;
        $("#content ol").css("background", "url(/images/video/sidebar_index_over.png) no-repeat 0 " + thisPositionY + "px");
    }).mouseout(function(){
        $("#content ol").css("background", "");
    }); */
    thisURL = window.document.location.toString();
    if (thisURL.match("#")) {
        thisAnchor = thisURL.split("#")[1];
        if(thisAnchor == "listeners_guide") $(".sidebar").addClass("listeners_guide");
    }
    $(".sidebar h3 a").click(function(){
        if($(".sidebar").hasClass("listeners_guide")){
            $(".sidebar").removeClass("listeners_guide");
        }else{
            $(".sidebar").addClass("listeners_guide");
        }
        return false;
    });
    //alert($("ul.related").position().top);
    if($("ul.related").is("*") && $("ul.related").position().top > 155){
        new_related_height = 228 + 145 - $("ul.related").position().top;
        $("ul.related").css("height",new_related_height+"px")
    }
}



/*
Gallery Index JS
*/

function initializeGalleryIndex(){
    $("#content li > a").each(function(i){
        $("img", this).addClass("thumb");
        thisImageName = $("img", this).attr("alt");
        $(this).css({zIndex:"2"}).append("<img class=\"bg\" src=\"/images/galleries/index_bg/" + thisImageName + ".jpg\">");
        $("img.bg", this).css({opacity:"0",zIndex:"-1",position:"absolute",left:"0",top:"0",border:"0"});
    });
    $("a").mouseover(function(){
        if($.browser.msie && parseInt($.browser.version) <= 6){
            $("img.thumb", this).css({border:"1px solid #fff",left:"-1px",top:"13px"});
        }
        $("img.bg", this).css({opacity:"0.25"});
    }).mouseout(function(){
        if($.browser.msie && parseInt($.browser.version) <= 6){
            $("img.thumb", this).css({border:"0",left:"0",top:"14px"});
        }
        $("img.bg", this).css({opacity:"0"});
    }).click(function(){
        $("img.bg", this).animate({opacity:"0.5"}, 100, function(){
            $(this).animate({opacity:"0.25"}, 100);
        });
    });
};



/*
Gallery JS
*/

current_section = default_section = "current";
anchors = ["cu","dl"];
sections = ["current","download"];
jQuery.easing.def = "easeInOutQuart";
cu_position = false;
if(!Array.indexOf){
    Array.prototype.indexOf = function(obj){
        for(var i=0; i<this.length; i++){
            if(this[i]==obj){
                return i;
            }
        }
        return -1;
    }
}
function changeSection(new_section,i,changeSpeed){
    if(changeSpeed === undefined) changeSpeed = 400;
    if(new_section !== current_section){
        if(new_section !== "full"){
            if(current_section == "current"){
                if(new_section == "download"){
                    /* $(".gallery_controls #current").css("background","none").children().each(function(){
                        if($(this).text() != "Image Gallery"){
                            $(this).css("opacity","0.001");
                        }
                    }); */
                    if($.browser.msie && parseInt($.browser.version) <= 6){
                        $(".gallery_controls #current").addClass("hidden");
                        $(".gallery_controls #download").animate({top:"-441px"}, changeSpeed, "easeOutExpo", function(){$(".gallery_controls #download").removeClass("hidden");});
                    }else{
                        $(".gallery_controls #current").addClass("hidden");
                        $(".gallery_controls #download").animate({top:"-441px"}, changeSpeed, "easeOutExpo");
                        $(".gallery_controls #download").removeClass("hidden");
                    }
                }
            }else if(current_section == "download"){
                if(new_section == "current"){
                    if($.browser.msie && parseInt($.browser.version) <= 6){
                        $(".gallery_controls #download").addClass("hidden");
                        $(".gallery_controls #download").animate({top:"0px"}, changeSpeed, "easeOutExpo", function(){$(".gallery_controls #current").removeClass("hidden");});
                    }else{
                        $(".gallery_controls #download").addClass("hidden");
                        $(".gallery_controls #download").animate({top:"0"}, changeSpeed, "easeOutExpo");
                        $(".gallery_controls #current").removeClass("hidden");
                    }
                }
            }
            new_href = $(".previous_next .previous a").attr("href");
            if(new_href){
                new_href = new_href.split("#")[0];
                if(new_section !== default_section){
                    new_href = new_href + "#" + anchors[sections.indexOf(new_section)];
                }
                $(".previous_next .previous a").attr("href", new_href);
            }
            new_href = $(".previous_next .next a").attr("href");
            if(new_href){
                new_href = new_href.split("#")[0];
                if(new_section !== default_section){
                    new_href = new_href + "#" + anchors[sections.indexOf(new_section)];
                }
                $(".previous_next .next a").attr("href", new_href);
            }
            current_section = new_section;
        }
    }
}
function modify_px_value(originalValue,desiredChange){
    originalValue=parseInt(originalValue.substring(0,originalValue.length-2))+desiredChange;
    return originalValue+"px";
}
function getGalleryState(){
    return current_section;
}
function setGalleryState(name,control_section,reloadDelay){
    if(window.location.pathname != "/gallery/"+name+"/" && window.location.pathname.slice(0,-21) != "/gallery/"+name+"/"){
        window_location = "/gallery/"+name+"/";
        if(window.location.pathname.slice(-21) == "test_setgallerystate/"){
            window_location += "test_setgallerystate/";
        }
        reloadDelay = parseInt(reloadDelay);
        if(reloadDelay > 0){
            setTimeout("window.location = window_location;",reloadDelay);
        }else{
            window.location = window_location;
        }
    }else{
        window.focus();
    }
}
function embedGalleryFullScreen(thisNumber, buttonWidth, buttonHeight, isStandalone){
    swfobject.embedSWF("/swf/burland_fullscreen.swf", "gallery_full_screen", buttonWidth, buttonHeight, flashVersionRequired, false, {xml:"/xml/gallery.xml",number:thisNumber,language:thisLanguage,standalone:isStandalone}, {menu:"false",allowFullScreen:"true",allowScriptAccess:"always"});
    // ,wmode:"transparent"
}

function adjustQuote(){
    var imageHeight = $("#gallery_image img").height();
    if(imageHeight > 100){
        if(imageHeight + $("#gallery_image p.quote").height() > 515){
            $("#gallery_image p.quote").css("font-size","13px");
        }
    }else{
        setTimeout(adjustQuote, 500);
    }
}

function initializeGallery(){
    adjustQuote();
    thisNumber = window.location.pathname.split("/").reverse();
    if(thisNumber[0] == ""){
        thisNumber = thisNumber[1];
    }else{
        thisNumber = thisNumber[0];
    }
    thisURL = window.document.location.toString();
    if (thisURL.match("#")) {
        thisAnchor = thisURL.split("#");
        thisAnchor = anchors.indexOf(thisAnchor[1]);
        if(thisAnchor !== -1) changeSection(sections[thisAnchor],thisAnchor,0);
    }
    $(".gallery_controls h2").each(function(i){
        $(this).click(function(){
            new_section = $(this).parent().attr("id");
            changeSection(new_section,i,400);
        });
        /* if($.browser.msie && parseInt($.browser.version) <= 6){
            $(this).mouseover(function(){
                if($(this).parent().attr("id") == "download"){
                    $(this).css("background-position-y","-26px");
                }else{
                    $(this).css("background-position-y","-25px");
                }
            }).mouseout(function(){
                $(this).css("background-position-y","0");
            });
        } */
    });
    if($.browser.msie && parseInt($.browser.version) <= 6){
        disabledUpClass = 'disabled_up';
        disabledDownClass = 'disabled_down';
        $("#current .down.disabled").removeClass("disabled").addClass(disabledDownClass);
        $("#current .up.disabled").removeClass("disabled").addClass(disabledUpClass);
    }else{
        disabledUpClass = disabledDownClass = 'disabled';
    }
    $("#current .down").click(function(){
        if($(this).attr("class").substring(5, 13) !== "disabled"){
            if(cu_position === false) cu_position = $("#current .gallery_thumbs").css("top");
            if((-1*parseInt(cu_position.substring(0,cu_position.length-2))) + 688 >= $("#current .gallery_thumbs div:last-child").position().top){
                $(this).addClass(disabledDownClass);
            }
            /* tempOne = (-1*parseInt(cu_position.substring(0,cu_position.length-2))) + 688;
            tempTwo = $("#current .gallery_thumbs div:last-child").position().top;
            prompt("", tempOne+" !>= "+tempTwo); */
            cu_position = modify_px_value(cu_position, -396);
            $("#current .gallery_thumbs").stop(true).animate({top:cu_position}, 700, "easeOutExpo");
            $("#current .up").removeClass(disabledUpClass);
        }
        return false;
    });
    $("#current .up").click(function(){
        if($(this).attr("class").substring(3, 11) !== "disabled"){
            if(cu_position === false) cu_position = $("#current .gallery_thumbs").css("top");
            if((-1*parseInt(cu_position.substring(0,cu_position.length-2))) <= 451){
                $(this).addClass(disabledUpClass);
            }
            cu_position = modify_px_value(cu_position, 396);
            $("#current .gallery_thumbs").stop(true).animate({top:cu_position}, 700, "easeOutExpo");
            $("#current .down").removeClass(disabledDownClass);
        }
        return false;
    });
    $("a").each(function(){
        if($(this).attr("href") == ""){
            $(this).click(function(){
                return false;
            });
        }
    });
    embedGalleryFullScreen(thisNumber, "200", "25", false);
    // swfobject.embedSWF("/swf/burland_fullscreen.swf", "gallery_full_screen", "200", "25", flashVersionRequired, false, {xml:"/xml/gallery.xml",number:thisNumber,language:thisLanguage}, {menu:"false",allowFullScreen:"true",allowScriptAccess:"always"});
    if($.browser.msie && parseInt($.browser.version) <= 6){
        $(".gallery_controls #current a").mouseover(function(){
            $(this).addClass("hover");
        }).mouseout(function(){
            $(this).removeClass("hover");
        });
    }
}



/*
Fine Art JS
*/

function initializeFineArt(){
    embedGalleryFullScreen("1", "100", "24", true);
    //swfobject.embedSWF("/swf/burland_fullscreen.swf", "gallery_full_screen", "100", "24", flashVersionRequired, false, {xml:"/xml/gallery.xml",standalone:true,language:thisLanguage}, {menu:"false",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"});
}



/*
Listen JS
*/

function flashPopup(strUrl,strWindowName,strWindowFeatures){
	var reference = window.open(strUrl,strWindowName,strWindowFeatures);
	var success = (reference != null);
	return success;
}
function initializeListen(){
    thisTab = thisSection = 0;
    values = [0, 0, 0, 0, 0]
    thisData = window.location.pathname.slice(8);
    if(thisData.slice(-1) == "/"){
        thisData = thisData.slice(0,-1);
    }
    thisData = thisData.split("/");
    for(var i=0; i<thisData.length; i++){
        //alert(thisData[i]);
        for(var k=0; k<listenKeys.length; k++){
            if(listenKeys[k] == "tab" && listenTabs.indexOf(thisData[i]) != -1){
                values[k] = listenTabs.indexOf(thisData[i]);
                //alert("tab is "+values[k]+", aka "+thisData[i]);
            }else if(thisData[i].substring(0, listenKeys[k].length+1) == listenKeys[k]+"_"){
                values[k] = thisData[i].substring(listenKeys[k].length+1);
                //alert(listenKeys[k]+" is "+thisData[i].substring(listenKeys[k].length+1));
            }
        }
    }
    swfobject.embedSWF("/swf/listen.swf", "listen_player", "1111", "536", flashVersionRequired, false, {xml:"/xml/listen.xml",language:thisLanguage,tab:values[listenKeys.indexOf("tab")],section:values[listenKeys.indexOf("section")],image:values[listenKeys.indexOf("image")],album:values[listenKeys.indexOf("album")],track:values[listenKeys.indexOf("track")],position:values[listenKeys.indexOf("position")]}, {menu:"false",allowFullScreen:"true",allowScriptAccess:"always"});
}
function initializeListenFr(){
    thisSection = 0;
    newSection = window.location.pathname.slice(8);
    if(newSection.slice(-1) == "/"){
        newSection = newSection.slice(0,-1);
    }
    if(newSection == "the_wolves"){
        thisSection = 1;
    }else if(newSection == "animus"){
        thisSection = 2;
    }else if(newSection == "audiobook"){
        thisSection = 3;
    }
    swfobject.embedSWF("/listen/AudioPlayer.swf", "listen_player", "486", "486", "9.0.0", false, {xml:"/listen/test.xml",section:thisSection,language:thisLanguage},{allowscriptaccess:"always"});
}



/*
Site Map JS
*/

function initializeSiteMap(){
    $("#content a").each(function(){
        if($(this).attr("href").slice(0,8) == "/listen/"){
            bindListenPopup(this);
        }else if($(this).attr("href").indexOf("/booklet/") != -1){
            bindBookletClick(this);
        }
    }).mouseover(function(){
        thisHref = $(this).attr("href");
        $("#content a[href='"+thisHref+"']").addClass("hover");
    }).mouseout(function(){
        thisHref = $(this).attr("href");
        $("#content a[href='"+thisHref+"']").removeClass("hover");
    });
}



function bindBookletClick(ref){
    $(ref).click(function(){
        if(thisLanguage == "fr" && $(this).attr("href").slice($(this).attr("href").length - 12) != "_en_anglais/"){
            if(screen.width >= 1280){
                launchPopup($(this).attr("href"),"booklet_window_fr",1280,654,0,20,",scrollbars=1");
            }else{
                launchPopup($(this).attr("href"),"booklet_window_fr",1024,510,0,20,",scrollbars=1");
            }
        }else{
            launchPopup($(this).attr("href"),"booklet_window",1000,658,0,20,",scrollbars=0");
        }
        return false;
    });
}



function initializeBooklet(){
    function bindPreviousClick(){
        $("#content li.previous a").click(function(){
            $("div#content").removeClass("page_"+currentPage);
            if(currentPage == lastPage){
                $("#content li.next").html("<a href=\"#next\">next ></a>");
                bindNextClick();
            }
            if(currentPage >= 1){
                changePage(--currentPage);
            }
            if(currentPage == 0){
                $("#content li.previous").html("< previous");
            }
            $("div#content").addClass("page_"+currentPage);
            return false;
        });
    }
    function bindNextClick(){
        $("#content li.next a").click(function(){
            $("div#content").removeClass("page_"+currentPage);
            if(currentPage == 0){
                $("#content li.previous").html("<a href=\"#previous\">< previous</a>");
                bindPreviousClick();
            }
            if(currentPage < lastPage){
                changePage(++currentPage);
            }
            if(currentPage == lastPage){
                $("#content li.next").html("next >");
            }
            $("div#content").addClass("page_"+currentPage);
            return false;
        });
    }
    function changePage(toPage){
        $("div#content").removeClass();
        $("div.all_pages div.img").css("opacity","0.0001");
        $("div#content").addClass("page_"+toPage);
        $("div.all_pages div.img").fadeTo(750, 1);
        if(toPage == 0){
            window.location = window.location.pathname + "#";
        }else{
            window.location = window.location.pathname + "#page_" + toPage;
        }
    }

    $("#content div.all_pages_no_js").removeClass().addClass("all_pages");
    $("#content ul.controls_no_js").removeClass().addClass("controls");
    currentPage = window.document.location.toString();
    if (currentPage.match("#")) {
        currentPage = currentPage.split("#")[1];
        currentPage = currentPage.split("_")[1];
        currentPage = parseInt(currentPage);
        if(isNaN(currentPage)){
            currentPage = 0;
        }
    }else{
        currentPage = 0;
    }
    if(currentPage > 0){
        $("#content li.previous").html("<a href=\"#previous\">< previous</a>");
        bindPreviousClick();
        $("div#content").addClass("page_"+currentPage);
    }else{
        $("div#content").addClass("page_0");
    }
    if(currentPage < lastPage){
        bindNextClick();
    }else{
        $("#content li.next").html("next >");
    }
    if($(window).height() < 630){ // 630 minimum height
        function scaleValue(originalValue, minValue, fractionOfValue){
            return ((originalValue - minValue) * fractionOfValue) + minValue;
        }
        changeInHeight = 630 - $(window).height();
        if(thisBodyClass == "audiobook"){
            if(changeInHeight > 184) changeInHeight = 184; // 446 most compact, 630 - 446 = 184
            fractionChangeInHeight = 1 - (changeInHeight / 184);
            $("#booklet #header").css("top",scaleValue(0, -8, fractionChangeInHeight)+"px"); // 0px
            $("#booklet #content h2").css("top",scaleValue(-39, -47, fractionChangeInHeight)+"px"); // -39px
            $(".all_pages").css("top",scaleValue(50, -48, fractionChangeInHeight)+"px"); // 0px
            $("#booklet #content ul.controls").css("top",scaleValue(518, 322, fractionChangeInHeight)+"px"); // 518px
        }else{
            if(changeInHeight > 76) changeInHeight = 76; // 554 most compact, 630 - 554 = 76
            fractionChangeInHeight = 1 - (changeInHeight / 76);
            $("#booklet #header").css("top",scaleValue(0, -8, fractionChangeInHeight)+"px"); // 0px
            $("#booklet #content h2").css("top",scaleValue(-39, -47, fractionChangeInHeight)+"px"); // -39px
            $(".all_pages").css("top",scaleValue(0, -48, fractionChangeInHeight)+"px"); // 0px
            $("#booklet #content ul.controls").css("top",scaleValue(518, 440, fractionChangeInHeight)+"px"); // 518px
        }
    }
}

function initializeFrenchBooklet(){
    if($(window).width() < 1265){
        $("#content ul.booklet_pages li").each(function(){
            thisNum = $(this).attr("id").substring(5);
            $("img", this).attr("src", "/images/booklet/french/1024/"+thisBodyClass+"/"+thisNum+".jpg");
        });
    }
}



/*
Landing JS
*/

function initializeLanding(){
    bindListenPopup(".view_music .standard a");
    embedListenFullScreenButton("118");
    embedGalleryFullScreen("1", "200", "25", true);
    if(thisLanguage == "en"){
        swfobject.embedSWF("/swf/VideoPlayer.swf", "video_player", "358", "299", "9.0.28", false, {videoID:videoID, autoPlay:"false"},{allowscriptaccess:"always"});
    }
}



/*
Browser-specific JS
*/

function initializeSafari(){
    $(".previous_next").addClass("safari");
}

function initializeIE6(){
    $(".box_set img").replaceWith("<div id=\"box_set_image_ie6\"></div>");
}



$(document).ready(function(){
    if($("html").attr("id") == "fr"){
        thisLanguage = "fr";
    }else{
        thisLanguage = "en";
    }
    $(".navigation .listen a, #site_map a#listen, a.listen, , p.listen a").click(function(){
        if(thisLanguage == "fr"){
            launchPopup($(this).attr("href"),"listen_window",486,486,(screen.width-486),0,",scrollbars=0");
        }else{
            launchPopup($(this).attr("href"),"listen_window",1130,641,0,0,",scrollbars=0");
        }
        return false;
    });
    bindBookletClick("a.booklet");
    if($.browser.msie){
        flashVersionRequired = "9.0.124";
    }else{
        flashVersionRequired = "9";
    }
    thisBodyId = $("body").attr("id");
    thisBodyClass = $("body").attr("class");
    if(thisBodyId=="landing"){
        initializeLanding();
    }else if(thisBodyId=="experience"){
        initializeExperience();
    }else if(thisBodyId=="galleries"){
        initializeGalleryIndex();
    }else if(thisBodyId=="gallery"){
        initializeGallery();
    }else if(thisBodyId=="listen"){
        if(thisLanguage == "fr"){
            initializeListenFr();
        }else{
            initializeListen();
        }
    }else if(thisBodyId=="visual_art"){
        initializeFineArt();
    }else if(thisBodyId=="site_map"){
        initializeSiteMap();
    }else if(thisBodyId=="booklet" && thisLanguage == "fr"){
        initializeFrenchBooklet();
    }else if(thisBodyId=="booklet"){
        initializeBooklet();
    }else if(thisBodyId=="music" && thisBodyClass=="page_1"){
        initializeMusic();
    }
    /* if($.browser.msie && parseInt($.browser.version) <= 6){
        s=document.createElement("script");
        s.setAttribute("src","/js/pngfix-1.2.js");
        s.setAttribute("type","text/javascript");
        document.getElementsByTagName("head")[0].appendChild(s);
    } */
    if($.browser.safari){
        initializeSafari();
    }
    if($.browser.msie && parseInt($.browser.version) <= 6){
        initializeIE6();
    }
    $(".box_set > a").mouseover(function(){
        $(".box_set p a").addClass("hover");
    }).mouseout(function(){
        $(".box_set p a").removeClass("hover");
    }).attr("target","_new_offsite_richshapero_store");
});