﻿var vidArray = new Array();
var count;
for (count = 0; count < 4; count++) {
    vidArray[count] = new Array();
}
vidArray[0][0] = "easy-flavorful-salad";
vidArray[0][1] = "Arugula, Roasted Cherry Tomatoes " + escape('&') + " Bocconcini Salad";
vidArray[0][2] = "/Recipes/11713/1/Arugula-Roasted-Cherry-Tomatoes-Bocconcini-Salad.aspx";
vidArray[1][0] = "tasty-tuna-steaks";
vidArray[1][1] = "Grilled Tuna, Arugula, Fennel, Black-Eyed Peas " + escape('&') + " Tomato Salad";
vidArray[1][2] = "/Recipes/11716/1/Grilled-Tuna-Arugula-Fennel-Black-Eyed-Peas-And-Tomato-Salad.aspx";
vidArray[2][0] = "simple-chicken-salad";
vidArray[2][1] = "Grilled Italian Chicken Salad with Romaine Spears " + escape('&') + " Roasted Red Peppers";
vidArray[2][2] = "/Recipes/11714/1/Grilled-Italian-Chicken-Salad-With-Romaine-Spears-And-Roasted-Red-Peppers.aspx";
vidArray[3][0] = "lettuce-taco-salad";
vidArray[3][1] = "Turkey Lettuce Tacos";
vidArray[3][2] = "/Recipes/11715/1/Turkey-Lettuce-Tacos.aspx";

$(document).ready(function() {
    //var page = window.location.hash.replace("#", "");
    var vhost = window.location.hostname.toString().toLowerCase();
    var vloc = window.location.toString().toLowerCase();
    var page = vloc.replace("http://" + vhost + "/tyler/videos/", "").replace(".aspx", "");
    if (page.length < 2) {
        setArrow(0);
    }
    else {
        if (page == vidArray[0][0])
            setArrow(0);
        if (page == vidArray[1][0])
            setArrow(1);
        if (page == vidArray[2][0])
            setArrow(2);
        if (page == vidArray[3][0])
            setArrow(3);
    }
});

function playVid(vid) {
    setArrow(vid);

    var vhost = window.location.hostname.toString().toLowerCase();
    var page = "http://" + vhost + "/tyler/videos/" + vidArray[vid][0] + ".aspx";

    var flash = getMovie('flashContent');

    flash.doVideo(vidArray[vid][0], page, vidArray[vid][1].replace('%26','&'), vidArray[vid][2]);
}

function setArrow(vid) {
    $("ul.arrow > li").css("visibility", "hidden");
    var temp = $("ul.arrow > li").eq(vid).css("visibility", "visible");
}

function getVidItem(page) {
    var retIndex = 0;
    for (index = 0; index < vidArray.length; index++) {
        if (vidArray[index][0] == page) {
            retIndex = index;
            break;
        }
    }
    return retIndex;
}
