﻿$(function() {
    $("#recently").click(function() {
        $("#most-viewed, #pro-team, #products, #all").fadeOut("fast");
        $("#recently-added").fadeIn("slow");
        $("#most, #pros, #product, #all-videos").removeClass("selected");
        $(this).addClass("selected");
        return false;
    });
    $("#most").click(function() {
        $("#recently-added, #pro-team, #products, #all").fadeOut("fast");
        $("#most-viewed").fadeIn("slow");
        $("#recently, #pros, #product, #all-videos").removeClass("selected");
        $(this).addClass("selected");
        return false;
    });
    $("#pros").click(function() {
        $("#recently-added, #most-viewed, #products, #all").fadeOut("fast");
        $("#pro-team").fadeIn("slow");
        $("#recently, #most, #product, #all-videos").removeClass("selected");
        $(this).addClass("selected");
        return false;
    });
    $("#product").click(function() {
        $("#recently-added, #most-viewed, #pro-team, #all").fadeOut("fast");
        $("#products").fadeIn("slow");
        $("#recently, #most, #pros, #all-videos").removeClass("selected");
        $(this).addClass("selected");
        return false;
    });
    $("#all-videos").click(function() {
        $("#recently-added, #most-viewed, #products, #pro-team").fadeOut("fast");
        $("#all").fadeIn("slow");
        $("#recently, #most, #pros, #product").removeClass("selected");
        $(this).addClass("selected");
        return false;
    });
});

$(document).ready(function() { 
    var newWidth = $('#videoContent').width();
    $('#videoContent').css("margin-left", -(newWidth / 2));
});

function lookup(vimeoId) {
    var parameters = "{'vimdeoId':'" + vimeoId + "'}"
    
    $.ajax({
        type: "POST",
        url: '/Services/VideoServices.asmx/GetVideoData',
        data: parameters,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            $('#videoContent').html(msg.d.ClientEmbed); // Fill the suggestions box
            var newWidth = $('#videoContent').width();
            $('#videoContent').css("margin-left", -(newWidth / 2));
            $('.videoDetails').html(msg.d.HTMLString);
            
        },
        error: function(e) {
            alert(e.status)
        }
    });

}


