//Centers an Element
jQuery.fn.center = function() {this.css("position", "absolute");this.css("top", ($(this).parent().height() - this.height()) / 2 + "px");this.css("left", ($(this).parent().width() - this.width()) / 2 + "px");return this;}
//Changes a video id = "ID of the element to put the video content in", n = "Video ID Number"
function ChangeVideo(id, n) {swfobject.embedSWF("http://player.videojuicer.com/bootstrap.swf", ""+id, "445", "250", "7.0.0", false, {AUTOPLAY: "0",seed_name: "pokerstars",presentation_id: ""+n}, {wmode: "transparent",allowFullScreen: "true",allowscriptaccess: "always"});}
$(document).ready(function() {
    //Load Scroll Bars
    $(".flexcroll").jScrollPane({ showArrows: true, scrollbarWidth: 15, reinitialiseOnImageLoad: true });
    //Attach Events to list of movies
    $(".movieListContainer .movie").each(function() {var href = "" + $("a", this).attr("href").match(/\d+.html/i);$(this).click(function() {$(".movieListContainer .movie").each(function() {$(this).removeClass("highlight")});$(this).addClass("highlight");ChangeVideo("MovieToPlay", href.substring(0, href.length - 5));$(".MovieTitle").html($(".movieListContainer .highlight h2 a").html());$(".MovieDescription").html($(".movieListContainer .highlight p").html());});$("a", this).click(function(e) {$(".movieListContainer .movie").each(function() { $(this).removeClass("highlight") }); $(this).parent().parent().addClass("highlight");ChangeVideo("MovieToPlay", href.substring(0, href.length - 5));e.preventDefault(); return false; });});
    //Show First Movie
    $(".MovieTitle").html($(".movieListContainer .highlight h2 a").html());
    $(".MovieDescription").html($(".movieListContainer .highlight p").html());
    //Attach Events for the gallery
    $("#Gallery .ImageList a").each(function() { $(this).click(function(e) { var myVar = $("#Gallery .ImageViewerImage")[0]; var myImg = new Image(); myImg.src = this.getAttribute("href"); $(myImg).load(function() { $(myVar).center(); }); myVar.setAttribute("src", this.getAttribute("href")); myVar.setAttribute("alt", $(this).children("img")[0].getAttribute("alt")); $("#Gallery .ImageViewer p").html($(this).children("img")[0].getAttribute("alt")); $(myVar).center(); e.preventDefault(); return false; }); });
    //Show the first image
    if ($("#Gallery .ImageList a").length > 0) { var myVar = $("#Gallery .ImageViewerImage")[0]; var myImg = new Image(); myImg.src = $("#Gallery .ImageList a:first").attr("href"); $(myImg).load(function() { $(myVar).center(); }); $(myVar).attr("src", $("#Gallery .ImageList a:first").attr("href")); $(myVar).attr("alt", $("#Gallery .ImageList a:first").children("img")[0].getAttribute("alt")); $("#Gallery .ImageViewer p").html($("#Gallery .ImageList a:first").children("img")[0].getAttribute("alt")); $(myVar).center(); };
});
//ScrollBar Fix
//var jScrollPane_old_height;

