﻿// JScript File

function LoadCategory(catID) {
    var resObj = WebTV.frontend.lib.AjaxMethods.GetCategory(catID);
	if (resObj.error){
		//alert("Errore"); 
    }
    //else {
		res = resObj.value;
		return res;
	//}
}

function LoadVideoFromCat(catID) {
	var resObj=WebTV.frontend.lib.AjaxMethods.GetVideoInCategory(catID);
	if (resObj.error){
		//alert("E' avvenuto un'errore caricando i video della categoria:\n\n" + resObj.error.Message.toString()); 
    }
    //else {
		res=resObj.value;
		return res;
	//}
}

function LoadVideoInformation(videoID) {
	var resObj=WebTV.frontend.lib.AjaxMethods.GetVideo(videoID);
	if (resObj.error)
	{
		//alert("E' avvenuto un'errore caricando i dati del video:\n\n" + resObj.error.Message.toString()); 
    }
    else {
		res=resObj.value;
		return res;
	}
}

function LoadVideosInEvidence()
{
    var resObj=WebTV.frontend.lib.AjaxMethods.GetVideoBox();
	if (resObj.error)
	{
		//alert("E' avvenuto un'errore caricando i dati del video:\n\n" + resObj.error.Message.toString()); 
    }
    else {
		res=resObj.value;
		return res;
	}
}


function LoadPageInfo(infoID) {
	var resObj=WebTV.frontend.lib.AjaxMethods.GetInfoPage(infoID);
	if (resObj.error){
		//alert("E' avvenuto un'errore caricando i dati della pagina testuale:\n\n" + resObj.error.Message.toString()); 
		res.Contents="Pagina testuale non trovata";
    }
    else {
		res=resObj.value;
	}
	return res;
}

function SearchVideo(Keyword, CatID, Status)
{
    var resObj = WebTV.frontend.lib.AjaxMethods.SearchVideo(Keyword, CatID, Status);
	if (resObj.error){
		res.Contents = "Errore nella ricerca.";
    }
    else {
		res = resObj.value;
	}
	return res;
}



function LoadHelp()
{
    var resObj = WebTV.frontend.lib.AjaxMethods.LoadHelp();
	if (resObj.error){
		res.Contents = "Errore nel caricamento dell'help.";
    }
    else {
		res = resObj.value;
	}
	return res;
}