// This JavaScript was automatically generated by
// Jayrock.JsonRpc.Web.JsonRpcProxyGenerator, Jayrock, Version=0.9.8316.0, Culture=neutral, PublicKeyToken=null
// on Monday, September 06, 2010 at 2:54:24 PM (US Mountain Standard Time)

// Proxy version 1.0

function jsonHandler(url)
{
    /* Login to Scheduly and returns user info. */
    
    this["LoginReturnUserInfo"] = function(email, password, OffsetClientTimeZone, callback)
    {
        return call("LoginReturnUserInfo", [ email, password, OffsetClientTimeZone ], callback);
    }
    
    /* Sets user information in the session. */
    
    this["setUserInfoInSession"] = function(userID, callback)
    {
        return call("setUserInfoInSession", [ userID ], callback);
    }
    
    /* Gets user information from the session. */
    
    this["getUserInfoFromSession"] = function(callback)
    {
        return call("getUserInfoFromSession", [ ], callback);
    }
    
    /* Returns list of business clients info. */
    
    this["getClientListForBusiness"] = function(callback)
    {
        return call("getClientListForBusiness", [ ], callback);
    }
    
    /* Returns list of business service Providers info. */
    
    this["GetServiceProvidersList"] = function(callback)
    {
        return call("GetServiceProvidersList", [ ], callback);
    }
    
    /* Sets the client auto-approved-to-schedule status and the relationship status with the business. */
    
    this["updateClientStatus"] = function(userBusinessRelationshipID, isAutomated, callback)
    {
        return call("updateClientStatus", [ userBusinessRelationshipID, isAutomated ], callback);
    }
    
    /* Sets the client auto-approved-to-schedule status and the relationship status with the business. */
    
    this["deleteClient"] = function(clientID, userBusinessRelationshipID, callback)
    {
        return call("deleteClient", [ clientID, userBusinessRelationshipID ], callback);
    }
    
    /* Deletes all the client upcoming appointments at a specific business. */
    
    this["deleteUpcomingAppointmentsForClient"] = function(clientID, callback)
    {
        return call("deleteUpcomingAppointmentsForClient", [ clientID ], callback);
    }
    
    this["greetings"] = function(callback)
    {
        return call("greetings", [ ], callback);
    }
    
    this["Oren"] = function(ccc, callback)
    {
        return call("Oren", [ ccc ], callback);
    }
    
    /* Echoes back the text sent as input. */
    
    this["echo"] = function(text, callback)
    {
        return call("echo", [ text ], callback);
    }
    
    /* Returns empty Search object. */
    
    this["getSearchObject"] = function(callback)
    {
        return call("getSearchObject", [ ], callback);
    }
    
    /* Returns the search result as a List of SearchResultCollection object. Gets: Search Object. Search properties: Search.m_SearchCriteria, Search.m_SysID, Search.m_IsTagOnlySearch.m_SearchFor, Search.m_OrderBy, Search.m_FilterCityID, Search.m_FilterCategoryID. example: Search.m_SearchFor = 'Bus:all' or 'Bus:fav' or 'Bus:last' ... 'App:all' or 'App:latest'. */
    
    this["searchDB"] = function(searchObj, callback)
    {
        return call("searchDB", [ searchObj ], callback);
    }
    
    /* Returns CategoriesList object. */
    
    this["getCategoriesList"] = function(callback)
    {
        return call("getCategoriesList", [ ], callback);
    }
    
    /* Returns Cities object. */
    
    this["getCitiesList"] = function(callback)
    {
        return call("getCitiesList", [ ], callback);
    }
    
    /* Gets business full details. */
    
    this["getMyBusinessInfo"] = function(callback)
    {
        return call("getMyBusinessInfo", [ ], callback);
    }
    
    /* Gets user full details. */
    
    this["getPersonalInfo"] = function(callback)
    {
        return call("getPersonalInfo", [ ], callback);
    }
    
    /* Sets user personal info details. */
    
    this["updatePersonalInfo"] = function(firstName, lastName, phone, mobile, address, zipCode, userTimeZone, callback)
    {
        return call("updatePersonalInfo", [ firstName, lastName, phone, mobile, address, zipCode, userTimeZone ], callback);
    }
    
    /* Sets client/employee info details. */
    
    this["updatePartnerInfo"] = function(fullName, address, phone, mobile, price, userTimeZone, userID, callback)
    {
        return call("updatePartnerInfo", [ fullName, address, phone, mobile, price, userTimeZone, userID ], callback);
    }
    
    /* Sets user personal info details. */
    
    this["updateUserLoginInfo"] = function(email, newPassword, callback)
    {
        return call("updateUserLoginInfo", [ email, newPassword ], callback);
    }
    
    /* Sets business info details. */
    
    this["updateBusinessInfo"] = function(businessName, categoryID, phone, mobile, website, address, zipCode, addressX, addressY, zipCodeX, zipCodeY, callback)
    {
        return call("updateBusinessInfo", [ businessName, categoryID, phone, mobile, website, address, zipCode, addressX, addressY, zipCodeX, zipCodeY ], callback);
    }
    
    /* Adds new business for a user. */
    
    this["addBusiness"] = function(businessName, categoryID, phone, mobile, website, address, zipCode, countryID, stateID, cityID, addressX, addressY, zipCodeX, zipCodeY, callback)
    {
        return call("addBusiness", [ businessName, categoryID, phone, mobile, website, address, zipCode, countryID, stateID, cityID, addressX, addressY, zipCodeX, zipCodeY ], callback);
    }
    
    /* Adds new feedback. */
    
    this["SetFeedback"] = function(fullName, email, feedbackTypeID, message, callback)
    {
        return call("SetFeedback", [ fullName, email, feedbackTypeID, message ], callback);
    }
    
    /* Gets the RegionList from application which included: cities array, states array and countries array. */
    
    this["GetRegionListAsArrays"] = function(callback)
    {
        return call("GetRegionListAsArrays", [ ], callback);
    }
    
    /* Gets the CategoriesList from application which included: categoryID as array, categoryTitle as array and categoryDesc(description) as array. */
    
    this["GetCategoriesListAsArrays"] = function(callback)
    {
        return call("GetCategoriesListAsArrays", [ ], callback);
    }
    
    /* Gets specific businesses service's details. */
    
    this["getBusinessServicesInfo"] = function(businessID, serviceID, callback)
    {
        return call("getBusinessServicesInfo", [ businessID, serviceID ], callback);
    }
    
    /* Sets the first registration details in the Scheduly User object and set it in the Session. */
    
    this["SetFirstPhaseRegistration"] = function(email, password, firstName, lastName, phoneNum, mobile, address, zipCode, addressX, addressY, zipCodeX, zipCodeY, emailStatus, userID, userTimeZone, callback)
    {
        return call("SetFirstPhaseRegistration", [ email, password, firstName, lastName, phoneNum, mobile, address, zipCode, addressX, addressY, zipCodeX, zipCodeY, emailStatus, userID, userTimeZone ], callback);
    }
    
    /* Sets the second phase of business registration: details on the business itself. */
    
    this["SetSecondPhaseRegistration"] = function(businessName, categoryID, website, phoneNum, mobile, address, zipCode, addressX, addressY, zipCodeX, zipCodeY, callback)
    {
        return call("SetSecondPhaseRegistration", [ businessName, categoryID, website, phoneNum, mobile, address, zipCode, addressX, addressY, zipCodeX, zipCodeY ], callback);
    }
    
    /* Sets the third phase of business registration: details on the service. */
    
    this["SetThirdPhaseRegistration"] = function(serviceName, duration, price, overlap, description, timeList, callback)
    {
        return call("SetThirdPhaseRegistration", [ serviceName, duration, price, overlap, description, timeList ], callback);
    }
    
    /* Inserts all user with business info to DB. */
    
    this["BusinessRegistration"] = function(businessName, fName, lName, email, password, captcha, userTimeZone, emailStatus, uID, callback)
    {
        return call("BusinessRegistration", [ businessName, fName, lName, email, password, captcha, userTimeZone, emailStatus, uID ], callback);
    }
    
    /* Inserts all user with business info to DB. */
    
    this["FinishRegistration"] = function(su, callback)
    {
        return call("FinishRegistration", [ su ], callback);
    }
    
    /* Check if email exists. */
    
    this["CheckUserStatus"] = function(email, callback)
    {
        return call("CheckUserStatus", [ email ], callback);
    }
    
    /* Updates the appointment if was actualy executed or not. */
    
    this["UpdateAppointmentDone"] = function(AppointmentID, AppDone, callback)
    {
        return call("UpdateAppointmentDone", [ AppointmentID, AppDone ], callback);
    }
    
    /* Sets the user's time zone in session. */
    
    this["SetTimeZone"] = function(timezone, callback)
    {
        return call("SetTimeZone", [ timezone ], callback);
    }
    
    /* Gets the resources object to client side. */
    
    this["GetResourcesObj"] = function(callback)
    {
        return call("GetResourcesObj", [ ], callback);
    }
    
    /* Clear the session from the last appointment schedule. */
    
    this["ClearSession"] = function(callback)
    {
        return call("ClearSession", [ ], callback);
    }
    
    /* Returns instant of MyAppointments List by type. */
    
    this["getMyAppointmentsList"] = function(iPageNum, iAppointType, callback)
    {
        return call("getMyAppointmentsList", [ iPageNum, iAppointType ], callback);
    }
    
    /* Returns Upper links of MyAppointment page. */
    
    this["getMyAppointmentsLinks"] = function(callback)
    {
        return call("getMyAppointmentsLinks", [ ], callback);
    }
    
    /* Sets the Appointment status ID by the business. */
    
    this["setAppointmentStatusId"] = function(changeToStatusID, appointmentID, currentStatusID, callback)
    {
        return call("setAppointmentStatusId", [ changeToStatusID, appointmentID, currentStatusID ], callback);
    }
    
    /* Sets the Appointment status ID by the client. */
    
    this["setAppointmentStatusIdByClient"] = function(businessID, statusID, appointmentID, callback)
    {
        return call("setAppointmentStatusIdByClient", [ businessID, statusID, appointmentID ], callback);
    }
    
    /* Updates the Appointment userID and Comments fields. */
    
    this["updateAppointment"] = function(appointmentID, userID, comments, callback)
    {
        return call("updateAppointment", [ appointmentID, userID, comments ], callback);
    }
    
    /* Gets the favorites business for customerID. */
    
    this["getFavoritesBusinnes"] = function(customerID, callback)
    {
        return call("getFavoritesBusinnes", [ customerID ], callback);
    }
    
    /* Gets the latest business for customerID. */
    
    this["getLatestBusinnes"] = function(customerID, callback)
    {
        return call("getLatestBusinnes", [ customerID ], callback);
    }
    
    /* Gets all the businesses in the DB. */
    
    this["getAllBusinnesses"] = function(customerID, callback)
    {
        return call("getAllBusinnesses", [ customerID ], callback);
    }
    
    /* Sets in session the businesses that the user select in the first phase of the appointment wizard. */
    
    this["setSelectedBusinnesses"] = function(oSelectedBusinesses, callback)
    {
        return call("setSelectedBusinnesses", [ oSelectedBusinesses ], callback);
    }
    
    /* Gets from session the businesses that the user select in the first phase of the appointment wizard. */
    
    this["getSelectedBusinnesses"] = function(callback)
    {
        return call("getSelectedBusinnesses", [ ], callback);
    }
    
    /* Gets specific businesses service's details and sets them in session for phase2. */
    
    this["getBusinessServices"] = function(BusinessIDs, oSelectedBusinesses, callback)
    {
        return call("getBusinessServices", [ BusinessIDs, oSelectedBusinesses ], callback);
    }
    
    /* Gets the service's details after the businesses selection in phase 1 of the appoint wizard. */
    
    this["getSelectedBusinessesServicesesFromSession"] = function(callback)
    {
        return call("getSelectedBusinessesServicesesFromSession", [ ], callback);
    }
    
    /* Sets the service's details after the user selection in phase 2 of the appoint wizard. */
    
    this["getSelectedServicesesByUseresByUser"] = function(oSelectedServicesByUser, callback)
    {
        return call("getSelectedServicesesByUseresByUser", [ oSelectedServicesByUser ], callback);
    }
    
    /* Gets the service's details after the user selection in phase 2 of the appoint wizard. */
    
    this["getSelectedServicesesByUser"] = function(callback)
    {
        return call("getSelectedServicesesByUser", [ ], callback);
    }
    
    /* Sets the selected services. */
    
    this["setSelectedServices"] = function(ServicesIDs, oSelectedServicesByUser, callback)
    {
        return call("setSelectedServices", [ ServicesIDs, oSelectedServicesByUser ], callback);
    }
    
    /* Sets the selected service. */
    
    this["setSingleServiceSelected"] = function(ServicesID, callback)
    {
        return call("setSingleServiceSelected", [ ServicesID ], callback);
    }
    
    /* Sets the selected service. */
    
    this["getSingleSelectedService"] = function(callback)
    {
        return call("getSingleSelectedService", [ ], callback);
    }
    
    /* Gets the available appointments per date to service. */
    
    this["getAvailableAppointments"] = function(ServiceID, businessID, theDate, clientOffsetTimeZone, isMonthChanged, callback)
    {
        return call("getAvailableAppointments", [ ServiceID, businessID, theDate, clientOffsetTimeZone, isMonthChanged ], callback);
    }
    
    /* Sets the selected appointments per date to service. */
    
    this["setSelectedAppointments"] = function(oSelectedAppointments, callback)
    {
        return call("setSelectedAppointments", [ oSelectedAppointments ], callback);
    }
    
    /* Gets the selected appointments (by user) per date to service. */
    
    this["getSelectedAppointments"] = function(callback)
    {
        return call("getSelectedAppointments", [ ], callback);
    }
    
    /* Gets the selected appointments (by user) per date to service. */
    
    this["setNewAppointment"] = function(serviceID, startDateTime, endDateTime, callback)
    {
        return call("setNewAppointment", [ serviceID, startDateTime, endDateTime ], callback);
    }
    
    /* Gets the selected appointments (by user) per date to service with full details of the user (full name, email and phone number). */
    
    this["setNewAppointmentNotLogIn"] = function(serviceID, startDateTime, endDateTime, clientFullName, clientEmail, clientPhone, clientComment, callback)
    {
        return call("setNewAppointmentNotLogIn", [ serviceID, startDateTime, endDateTime, clientFullName, clientEmail, clientPhone, clientComment ], callback);
    }
    
    /* Gets the selected appointments (by user) per date to service with full details of the user (full name, email and phone number). */
    
    this["CreateNewUser"] = function(firstName, lastName, email, GMT, callback)
    {
        return call("CreateNewUser", [ firstName, lastName, email, GMT ], callback);
    }
    
    /* Returns selected services available hours. */
    
    this["getAvailableHoursForServices"] = function(callback)
    {
        return call("getAvailableHoursForServices", [ ], callback);
    }
    
    /* Returns HTML string of my approval appointments. */
    
    this["getMyApprovalAppointments"] = function(obj, callback)
    {
        return call("getMyApprovalAppointments", [ obj ], callback);
    }
    
    /* Returns HTML string of the suggested appointments (by the business) that waits for my approval. */
    
    this["getMyNotAnswerdAppointments"] = function(obj, callback)
    {
        return call("getMyNotAnswerdAppointments", [ obj ], callback);
    }
    
    /* Returns HTML string of my waiting appointments for the business approval. */
    
    this["getMyWaitingAppointments"] = function(obj, callback)
    {
        return call("getMyWaitingAppointments", [ obj ], callback);
    }
    
    /* Returns HTML string of my my history appointments. */
    
    this["getMyHistoryAppointments"] = function(obj, callback)
    {
        return call("getMyHistoryAppointments", [ obj ], callback);
    }
    
    /* Sets the new service at the chosen appointment. */
    
    this["updateAppointmentService"] = function(obj, callback)
    {
        return call("updateAppointmentService", [ obj ], callback);
    }
    
    /* Returns 'true' if the service availbe at this time (scheduleServiceID) and dueDate or 'false'. */
    
    this["checkAvailbleDate"] = function(obj, callback)
    {
        return call("checkAvailbleDate", [ obj ], callback);
    }
    
    /* Returns HTML string for closes availble dates and tims (scheduleServiceID) for the asked service. */
    
    this["getAvailbleDates"] = function(obj, callback)
    {
        return call("getAvailbleDates", [ obj ], callback);
    }
    
    /* Sets the new service at the chosen appointment. */
    
    this["updateAppointmentSchedule"] = function(obj, callback)
    {
        return call("updateAppointmentSchedule", [ obj ], callback);
    }
    
    /* Gets the notications for the chosen appointment. */
    
    this["getAppointmentNotifications"] = function(obj, callback)
    {
        return call("getAppointmentNotifications", [ obj ], callback);
    }
    
    /* Sets the notications for the chosen appointment. */
    
    this["setAppointmentNotifications"] = function(obj, callback)
    {
        return call("setAppointmentNotifications", [ obj ], callback);
    }
    
    /* Set the status of the chosen appointment. */
    
    this["setStatusAppointment"] = function(obj, callback)
    {
        return call("setStatusAppointment", [ obj ], callback);
    }
    
    /* Gets the cancelation cause of the busiess. */
    
    this["getCancelCause"] = function(obj, callback)
    {
        return call("getCancelCause", [ obj ], callback);
    }
    
    /* Gets the cancelation cause of the busiess. */
    
    this["getUserLatestServices"] = function(callback)
    {
        return call("getUserLatestServices", [ ], callback);
    }
    
    /* Returns all of my business appointments for the days ahead. */
    
    this["getMyBookedBusinessAppointmentsByDays"] = function(iBusinessID, sDateTime, iNumberOfDays, callback)
    {
        return call("getMyBookedBusinessAppointmentsByDays", [ iBusinessID, sDateTime, iNumberOfDays ], callback);
    }
    
    /* Returns all of my last modified business appointments for the days I asked ahead. */
    
    this["getModifiedAppointmentsByDays"] = function(iBusinessID, sDateTime, iNumberOfDays, callback)
    {
        return call("getModifiedAppointmentsByDays", [ iBusinessID, sDateTime, iNumberOfDays ], callback);
    }
    
    /* Returns all of my business appointments for the days ahead. */
    
    this["getMyBusinessAgendaByDays"] = function(sDateTime, iNumberOfDays, clientOffsetTimeZone, callback)
    {
        return call("getMyBusinessAgendaByDays", [ sDateTime, iNumberOfDays, clientOffsetTimeZone ], callback);
    }
    
    /* Returns my business appointments by selected status for the days ahead. */
    
    this["GetAppoitmentsByStatus"] = function(sDateTime, iNumberOfDays, statusID, callback)
    {
        return call("GetAppoitmentsByStatus", [ sDateTime, iNumberOfDays, statusID ], callback);
    }
    
    /* Delete single appointment. */
    
    this["DeleteAppointment"] = function(iAppointmentID, callback)
    {
        return call("DeleteAppointment", [ iAppointmentID ], callback);
    }
    
    /* Returns summery of my business appointments for the month. */
    
    this["getMyBookedBusinessAppointmentsByMonth"] = function(sDateTime, iMonth, callback)
    {
        return call("getMyBookedBusinessAppointmentsByMonth", [ sDateTime, iMonth ], callback);
    }
    
    /* Returns all of my business appointments sums. */
    
    this["getMyBusinessAppointmentsSummery"] = function(iUserID, iBusinessID, callback)
    {
        return call("getMyBusinessAppointmentsSummery", [ iUserID, iBusinessID ], callback);
    }
    
    /* Returns all of my business clients details. */
    
    this["getMyClientsList"] = function(iUserID, iBusinessID, callback)
    {
        return call("getMyClientsList", [ iUserID, iBusinessID ], callback);
    }
    
    /* Adds new client to business. */
    
    this["addNewClient"] = function(firstName, lastName, email, callback)
    {
        return call("addNewClient", [ firstName, lastName, email ], callback);
    }
    
    /* Adds new service provider to business. */
    
    this["addNewServiceProvider"] = function(firstName, lastName, email, callback)
    {
        return call("addNewServiceProvider", [ firstName, lastName, email ], callback);
    }
    
    /* Sets the partner relationship status with the business to 'delete'. */
    
    this["DeletePartner"] = function(partnerID, userBusinessRelationshipID, callback)
    {
        return call("DeletePartner", [ partnerID, userBusinessRelationshipID ], callback);
    }
    
    /* Update Service Provider Information */
    
    this["UpdaterServiceProvider"] = function(ServiceProviderId, serviceID, action, callback)
    {
        return call("UpdaterServiceProvider", [ ServiceProviderId, serviceID, action ], callback);
    }
    
    /* Returns list of services info of specific business. */
    
    this["getServicesListForBusiness"] = function(callback)
    {
        return call("getServicesListForBusiness", [ ], callback);
    }
    
    /* Returns list of dynamic schedules for all services for this business. */
    
    this["getServicesDynamicScheduleListForBusiness"] = function(callback)
    {
        return call("getServicesDynamicScheduleListForBusiness", [ ], callback);
    }
    
    /* Updates only the service details (name, price etc.) */
    
    this["updateServiceDetails"] = function(serviceID, serviceName, duration, price, overlap, status, description, serviceProviderID, spFullName, callback)
    {
        return call("updateServiceDetails", [ serviceID, serviceName, duration, price, overlap, status, description, serviceProviderID, spFullName ], callback);
    }
    
    /* Gets upcoming appointments for service. */
    
    this["getUpcomingAppointmentsForService"] = function(serviceID, callback)
    {
        return call("getUpcomingAppointmentsForService", [ serviceID ], callback);
    }
    
    /* Deletes the service from your business. */
    
    this["deleteService"] = function(serviceID, callback)
    {
        return call("deleteService", [ serviceID ], callback);
    }
    
    /* Returns the schedule agenda of specific service. */
    
    this["getServicesSchedule"] = function(serviceID, callback)
    {
        return call("getServicesSchedule", [ serviceID ], callback);
    }
    
    /* Sets the service schedule. */
    
    this["checkEffectedAppointmentsByTimeChanging"] = function(serviceId, dueDate, startTime, endTime, callback)
    {
        return call("checkEffectedAppointmentsByTimeChanging", [ serviceId, dueDate, startTime, endTime ], callback);
    }
    
    /* Sets the service schedule. */
    
    this["setServiceScheduleList"] = function(serviceId, timeList, callback)
    {
        return call("setServiceScheduleList", [ serviceId, timeList ], callback);
    }
    
    /* Sets the service working hours for specific date. */
    
    this["setServiceDynamicWorkingHours"] = function(serviceId, dueDate, fromTime, toTime, callback)
    {
        return call("setServiceDynamicWorkingHours", [ serviceId, dueDate, fromTime, toTime ], callback);
    }
    
    /* Delete specific dynamic schedule slot for service. */
    
    this["deletedynamicScheduleSlot"] = function(scheduleID, serviceId, dueDate, startTime, endTime, callback)
    {
        return call("deletedynamicScheduleSlot", [ scheduleID, serviceId, dueDate, startTime, endTime ], callback);
    }
    
    /* Cancels all appointments which infected from the new schedule plan. */
    
    this["cancelAppointmentsAfterServiceScheduleChanged"] = function(callback)
    {
        return call("cancelAppointmentsAfterServiceScheduleChanged", [ ], callback);
    }
    
    /* Deletes all the service upcoming appointments. */
    
    this["deleteUpcomingAppointmentsForService"] = function(serviceID, callback)
    {
        return call("deleteUpcomingAppointmentsForService", [ serviceID ], callback);
    }
    
    /* Adds new single appointment, the comments can use for the non-registered-client. */
    
    this["insertAppointment"] = function(serviceID, startTime, endTime, clientID, comments, statusID, CyclicNumber, callback)
    {
        return call("insertAppointment", [ serviceID, startTime, endTime, clientID, comments, statusID, CyclicNumber ], callback);
    }
    
    /* Sets user reminders to on/off. */
    
    this["UpdateReminders"] = function(userID, setOn, callback)
    {
        return call("UpdateReminders", [ userID, setOn ], callback);
    }
    
    /* Check if email exists. */
    
    this["CheckUserNameAvailability"] = function(email, statusID, callback)
    {
        return call("CheckUserNameAvailability", [ email, statusID ], callback);
    }
    
    /* Create new user. */
    
    this["CreateUser"] = function(firstName, lastName, email, captcha, userTimeZone, callback)
    {
        return call("CreateUser", [ firstName, lastName, email, captcha, userTimeZone ], callback);
    }
    
    /* Create new business account. */
    
    this["RegisterBusiness"] = function(firstName, lastName, email, businessName, categoryID, phone, mobile, website, address, zipCode, captcha, addressX, addressY, zipCodeX, zipCodeY, userTimeZone, callback)
    {
        return call("RegisterBusiness", [ firstName, lastName, email, businessName, categoryID, phone, mobile, website, address, zipCode, captcha, addressX, addressY, zipCodeX, zipCodeY, userTimeZone ], callback);
    }
    
    /* Creates new password. */
    
    this["CreateNewPassword"] = function(email, callback)
    {
        return call("CreateNewPassword", [ email ], callback);
    }
    
    /* Gets user information. */
    
    this["getUserInfo"] = function(userID, callback)
    {
        return call("getUserInfo", [ userID ], callback);
    }
    
    /* Logout from Scheduly. */
    
    this["Logout"] = function(callback)
    {
        return call("Logout", [ ], callback);
    }
    
    /* Login to Scheduly. */
    
    this["Login"] = function(email, password, OffsetClientTimeZone, callback)
    {
        return call("Login", [ email, password, OffsetClientTimeZone ], callback);
    }
    
    /* Returns an array of method names implemented by this service. */
    
    this["system.listMethods"] = function(callback)
    {
        return call("system.listMethods", [ ], callback);
    }
    
    /* Returns the version server implementation using the major, minor, build and revision format. */
    
    this["system.version"] = function(callback)
    {
        return call("system.version", [ ], callback);
    }
    
    /* Returns a summary about the server implementation for display purposes. */
    
    this["system.about"] = function(callback)
    {
        return call("system.about", [ ], callback);
    }
    
    var url = typeof(url) === 'string' ? url : 'http://www.scheduly.com/WebServices/jsonHandler.ashx';
    var self = this;
    var nextId = 0;

    function call(method, params, callback)
    {
        var request = { id : nextId++, method : method, params : params };
        return callback == null ? 
            callSync(method, request) : callAsync(method, request, callback);
    }

    function callSync(method, request)
    {
        var http = newHTTP();
        http.open('POST', url, false, self.httpUserName, self.httpPassword);
        setupHeaders(http, method);
        http.send(JSON.stringify(request));
        if (http.status != 200)
            throw { message : http.status + ' ' + http.statusText, toString : function() { return message; } };
        var response = JSON.eval(http.responseText);
        if (response.error != null) throw response.error;
        return response.result;
    }

    function callAsync(method, request, callback)
    {
        var http = newHTTP();
        http.open('POST', url, true, self.httpUserName, self.httpPassword);
        setupHeaders(http, method);
        http.onreadystatechange = function() { http_onreadystatechange(http, callback); }
        http.send(JSON.stringify(request));
        return request.id;
    }

    function setupHeaders(http, method)
    {
        http.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
        http.setRequestHeader('X-JSON-RPC', method);
    }

    function http_onreadystatechange(sender, callback)
    {
        if (sender.readyState == /* complete */ 4)
        {
            var response = sender.status == 200 ? 
                JSON.eval(sender.responseText) : {};
            
            response.xmlHTTP = sender;
                
            callback(response);
        }
    }

    function newHTTP()
    {
        if (typeof(window) != 'undefined' && window.XMLHttpRequest)
            return new XMLHttpRequest(); /* IE7, Safari 1.2, Mozilla 1.0/Firefox, and Netscape 7 */
        else
            return new ActiveXObject('Microsoft.XMLHTTP'); /* WSH and IE 5 to IE 6 */
    }
}

jsonHandler.rpcMethods = ["LoginReturnUserInfo","setUserInfoInSession","getUserInfoFromSession","getClientListForBusiness","GetServiceProvidersList","updateClientStatus","deleteClient","deleteUpcomingAppointmentsForClient","greetings","Oren","echo","getSearchObject","searchDB","getCategoriesList","getCitiesList","getMyBusinessInfo","getPersonalInfo","updatePersonalInfo","updatePartnerInfo","updateUserLoginInfo","updateBusinessInfo","addBusiness","SetFeedback","GetRegionListAsArrays","GetCategoriesListAsArrays","getBusinessServicesInfo","SetFirstPhaseRegistration","SetSecondPhaseRegistration","SetThirdPhaseRegistration","BusinessRegistration","FinishRegistration","CheckUserStatus","UpdateAppointmentDone","SetTimeZone","GetResourcesObj","ClearSession","getMyAppointmentsList","getMyAppointmentsLinks","setAppointmentStatusId","setAppointmentStatusIdByClient","updateAppointment","getFavoritesBusinnes","getLatestBusinnes","getAllBusinnesses","setSelectedBusinnesses","getSelectedBusinnesses","getBusinessServices","getSelectedBusinessesServicesesFromSession","getSelectedServicesesByUseresByUser","getSelectedServicesesByUser","setSelectedServices","setSingleServiceSelected","getSingleSelectedService","getAvailableAppointments","setSelectedAppointments","getSelectedAppointments","setNewAppointment","setNewAppointmentNotLogIn","CreateNewUser","getAvailableHoursForServices","getMyApprovalAppointments","getMyNotAnswerdAppointments","getMyWaitingAppointments","getMyHistoryAppointments","updateAppointmentService","checkAvailbleDate","getAvailbleDates","updateAppointmentSchedule","getAppointmentNotifications","setAppointmentNotifications","setStatusAppointment","getCancelCause","getUserLatestServices","getMyBookedBusinessAppointmentsByDays","getModifiedAppointmentsByDays","getMyBusinessAgendaByDays","GetAppoitmentsByStatus","DeleteAppointment","getMyBookedBusinessAppointmentsByMonth","getMyBusinessAppointmentsSummery","getMyClientsList","addNewClient","addNewServiceProvider","DeletePartner","UpdaterServiceProvider","getServicesListForBusiness","getServicesDynamicScheduleListForBusiness","updateServiceDetails","getUpcomingAppointmentsForService","deleteService","getServicesSchedule","checkEffectedAppointmentsByTimeChanging","setServiceScheduleList","setServiceDynamicWorkingHours","deletedynamicScheduleSlot","cancelAppointmentsAfterServiceScheduleChanged","deleteUpcomingAppointmentsForService","insertAppointment","UpdateReminders","CheckUserNameAvailability","CreateUser","RegisterBusiness","CreateNewPassword","getUserInfo","Logout","Login","system.listMethods","system.version","system.about"];
