$(function() {
    if (scripts_isIE6) $(document).pngFix();
    
    var so = new SWFObject("swf/entertainment_nav.swf", "entertainmentNav", "958", "300", "8", "#000000");
    so.addParam("wmode", "transparent");
    so.write("ent-top-flash");
    if(version["major"] < 8) {
        $("#ent-nav").fadeIn("normal");
    }

    if ($.fn.prettyPhoto) {
        $("a[rel^='prettyPhoto']").prettyPhoto({
            animationSpeed: 'normal',
            padding: 40,
            opacity: 0.65,
            showTitle: true,
            allowresize: true,
            counter_separator_label: '/',
            theme: 'dark_rounded'
        });
    }
    if ($.fn.jScrollPane) {
        $('.scroll-pane').jScrollPane({
            showArrows: true,
            arrowButtonSpeed: 40
        });
    }
    
    $(".showmore a").click( function(e) {
    	e.preventDefault();
    	var t = $(this);
    	var cls = t.attr("rel");
    	$("."+cls).slideToggle("slow", function() {
	    	if( $("."+cls).css("display") == "block") {
	    		t.text("Show Less");
	    	} else {
	    		t.text("Show More");    	
	    	}
    	});
    });

});			

var version = deconcept.SWFObjectUtil.getPlayerVersion();
if (version["major"] < 8) {
    document.write('<script type="text/javascript" src="/scripts/dropmenu.options.js"></script>');
    document.write('<script type="text/javascript" src="/manager/include/scripts/dropmenu.ent.js"></script>');
}

/* External Interface functions */
function openFlashMenu(str) {
    $("#ent-top-flash").height(300);
}

function closeFlashMenu(str) {
    $("#ent-top-flash").height(110);
}

function videoEnded(str) {
    //THIS FUNCTION IS CALLED BY THE FLASH VIDEO 
    //PLAYER WHEN VIDEO FINISHES PLAYING.
    setTimeout('videoClose()', 500);
}

function videoClose() {
    $("#ent-mid-flash").remove();
    $("#ent-mid-slideshow").fadeIn("fast");
    rotateBanner();
}

function HomeBannerData(index, image, imgURL) {

    this.isFaded = false;
    this.index = index;
    this.image = image;
    this.imgURL = imgURL;
    this.html = "";
    this.addLine = function (content) {
        this.html += (content + "\n");
    }
    this.writeBanner = function () {
        document.write(this.html);
    };
    this.addLine("<div id=\"slideshow" + this.index + "\" style=\"width:766px;position:absolute;left:0px;top:0px;z-index:0;visibility:hidden;\">");
    this.addLine("<a href=\"" + this.imgURL + "\"><img src=" + this.image + " border=\"0\" alt=\"\" title=\"\" /></a>");
    this.addLine("</div>");
}

function RotateBannerData(index) {

    var data = bannerData[index];
    if (data != null) {
        selectedHomeBannerID = index;
        var showing = $("#slideshow" + showingBannerIndex);
        var toShow = $("#slideshow" + index);
        toShow.css({
            "display": "none",
            "z-index": "2",
            "visibility": "visible"
        });
        toShow.fadeIn("slow", function () {
            showing.css("z-index", "0");
            toShow.css("z-index", "1");
        });
        showingBannerIndex = index;
    }
}

function rotateBanner() {
    var id = selectedHomeBannerID + 1;
    if (id >= bannerData.length) id = 0;
    RotateBannerData(id);
    resetBannerRotation();
}

function resetBannerRotation() {
    setTimeout('rotateBanner();', 7000);
}
