﻿$(document).ready(function() {
  // Add the page method call as an onclick handler for the div.

  $.StoreChant = function(chanttxt, chantfile) {
    $.ajax({
      type: "POST",
      url: "chants.aspx/GetThemChants",
      data: '{"chanttxt":"' + chanttxt + '","chantfile":"'+ chantfile+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger Success Message in Flash      
        ajoyYes();
      }
    });
  };
  
    $.resizeImage = function(fileText) {
    $.ajax({
      type: "POST",
      url: "changes.aspx/resizeImage",
      data: '{"fileName":"'+ fileText+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger resized Message in Flash   
      fromAjoy("resized", msg.d);
      }
    });
  };
  
    $.PutinDB = function(topic, story, photoFile) {
    $.ajax({
      type: "POST",
      url: "changes.aspx/Iamdone",
      data: '{"topictxt":"' + topic + '","storytxt":"'+ story +'","photoFile":"'+ photoFile+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger done Message in Flash      
  
        fromAjoy(msg.d);
      }
    });
  };
  
  
  $.StoreChant_sp = function(chanttxt, chantfile) {
    $.ajax({
      type: "POST",
      url: "chants_sp.aspx/GetThemChants",
      data: '{"chanttxt":"' + chanttxt + '","chantfile":"'+ chantfile+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger Success Message in Flash      
        ajoyYes();
      }
    });
  };
  
    $.resizeImage_sp = function(fileText) {
    $.ajax({
      type: "POST",
      url: "changes_sp.aspx/resizeImage",
      data: '{"fileName":"'+ fileText+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger resized Message in Flash   
      fromAjoy("resized", msg.d);
      }
    });
  };
  
    $.PutinDB = function(topic, story, photoFile) {
    $.ajax({
      type: "POST",
      url: "changes_sp.aspx/Iamdone",
      data: '{"topictxt":"' + topic + '","storytxt":"'+ story +'","photoFile":"'+ photoFile+'"}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Trigger done Message in Flash      
  
        fromAjoy(msg.d);
      }
    });
  };
  
  
  
});