$(function () {
$("#logo").show();
$("#EX_SL_video").hide();
$("#Tutorial").hide();
$.getScript("https://www.firstclass.com/Resources/VideosArr12.js",function(){
SetCategories();
$("#Tutorial").hide();
$("#Cat").attr('selected','selected');
});
$('#Cat').change(function () {
GetCategories($('#Cat').val());
});
$('#CurLink').change(function () {
GetVideo($('#CurLink').val());
});
});
/* Set the Categories Selection List */
function SetCategories() {
// $('#Cat option').remove();
$('#Cat').children('option:not(:first)').remove();
var Cats =[];
$.each(videos,function (i,v){
if ($.inArray(v.Category,Cats)== -1) {
$('#Cat').append('');
/* Add value to array */
Cats.push(v.Category);
}
});
};
/* Set the Video List Selection list based on the selected Category */
function GetCategories(Cat) {
if (Cat == 0) {
/* Hide the video selection */
$("#Tutorial").hide();
ClearScreen();
} else {
/* Get the proper videos and reveal the selection form field */
$('#CurLink').children('option:not(:first)').remove();
$.each(videos,function (i,v){
if (v.Category== Cat) {
$('#CurLink').append('');
}
});
$("#Tutorial").show();
/* Set value to first item and clear screen */
$("#CurLink").val("");
ClearScreen();
}
};
function ClearScreen() {
$("#vTitle").text("");
$("#vDescription").text("");
$("#logo").show();
$("#EX_SL_video").hide();
};
/* Function called when video selection is changed */
function GetVideo(CurLink) {
if (CurLink != "") {
$("#logo").hide();
$.getScript("https://www.firstclass.com/Resources/VideosArr12.js",function(){
$.each(videos,function (i,v){
if (CurLink == v.Code) {
$("#vTitle").text(v.Name);
$("#vDescription").text(v.Description);
}
});
$("#EX_SL_video").show();
$("#EX_SL_video").html('');
});
} else {
ClearScreen();
}
}