﻿// copyright MAJENKA - http://majenka.net

// Majenka script service           
    
//================================================================================================    

function ScriptService() {}

// last parameter 'returnXmlHttp' values true|false
// if true the xmlHttp is returned
// else the object tree is returned
// is optional    
ScriptService.Invoke = function(method, parameters, async, callback, returnXmlHttp)
{
    SOAPClient.Invoke(scriptServiceUrl, method, parameters, async, callback, returnXmlHttp);
}

//================================================================================================    
   
// user script service functions    

function UserScriptService() {}

UserScriptService.GetUser = function(userId, callBack, returnXmlHttp)
{
    var parameters = new SOAPClientParameters();
    parameters.add('userId', userId);
            
    ScriptService.Invoke('GetUser', parameters, true, callBack, returnXmlHttp);
}
 
//================================================================================================    
   
// forum script service functions    

function ForumScriptService() { }

ForumScriptService.GetForum = function(forumId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('forumId', forumId);
            
    ScriptService.Invoke('GetForum', parameters, true, callBack, false);
}
    
//================================================================================================    

// photo script service functions    

function PhotoScriptService() {}

PhotoScriptService.GetSlide = function(photoId, previous, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('photoId', photoId);
    parameters.add('previous', previous);
            
    ScriptService.Invoke('GetSlide', parameters, true, callBack, false);
}

//================================================================================================    

// news script service functions    

function NewsScriptService() {}

NewsScriptService.GetNews = function(newsId, callBack, returnXmlHttp)
{
    var parameters = new SOAPClientParameters();
    parameters.add('newsId', newsId);
            
    ScriptService.Invoke('GetNews', parameters, true, callBack, returnXmlHttp);
}

NewsScriptService.GetNewsMenu = function(callBack, returnXmlHttp)
{            
    ScriptService.Invoke('GetNewsMenu', null, true, callBack, returnXmlHttp);
}

//================================================================================================    

// map script service functions    

function MapScriptService() {}

MapScriptService.GetMapByDirectoryId = function(directoryId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('directoryId', directoryId);
            
    ScriptService.Invoke('GetMapByDirectoryId', parameters, true, callBack, false);
}

MapScriptService.GetMapByNewsId = function(newsId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('newsId', newsId);
            
    ScriptService.Invoke('GetMapByNewsId', parameters, true, callBack, false);
}

MapScriptService.GetMapByPhotoId = function(photoId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('photoId', photoId);
            
    ScriptService.Invoke('GetMapByPhotoId', parameters, true, callBack, false);
}

MapScriptService.GetMapByVideoId = function(videoId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('videoId', videoId);
            
    ScriptService.Invoke('GetMapByVideoId', parameters, true, callBack, false);
}

MapScriptService.GetMapByWebPageId = function(webPageId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('webPageId', webPageId);
            
    ScriptService.Invoke('GetMapByWebPageId', parameters, true, callBack, false);
}
    
MapScriptService.GetMapByWhatsOnId = function(whatsOnId, callBack)
{
    var parameters = new SOAPClientParameters();
    parameters.add('whatsOnId', whatsOnId);
            
    ScriptService.Invoke('GetMapByWhatsOnId', parameters, true, callBack, false);
}  
 
//================================================================================================    

// email script service functions 

function EmailScriptService() {}   

EmailScriptService.SendMessage = function(name, emailAddress, message, callBack)
{   
    var parameters = new SOAPClientParameters();
    parameters.add('emailAddress', emailAddress);
    parameters.add('name', name);
    parameters.add('message', message);
            
    ScriptService.Invoke('SendMessage', parameters, true, callBack, false);
}