function getTorahToday(day, type)
{
  var pars = {section: 'xajax', task: 'getTorahToday', day: day, type: type};
  if (pagePreviewMode)
  {
    pars.preview = 1;
  }
  //$.get(url, pars, function(resp) 
  $.getJSON(url, pars, function(data, textStatus)
  {
    $('#contentTitle').remove();
    //$('#mainContent').html(resp);
    //window.console.log(typeof(addthis)==undefined);
    //if (addthis==undefined)
    if (typeof(addthis)!=undefined)
    {
      $('#mainContent').html(data.content);
      addthis.button('#addthis_button', {}, {url: data.url, title: data.title});
    }
  }
  );
}

function getTorahFilesToday(day, type)
{
  var pars = {section: 'xajax', task: 'getTorahFilesToday', day: day, type: type};
  if (pagePreviewMode)
  {
    pars.preview = 1;
  }
  $.get(url, pars, function(resp) {$('#mainContentTop').html(resp); });
}

function getTorahRecent(page, search, type)
{
	 var searchParam = '&' + $('#searchForm').serialize();
	 var pars = 'section=xajax&task=getTorahRecent&page=' + page + searchParam + '&type=' + type;
	 $.get(url, pars, function(resp) {$('#recentTorah').html(resp); });
}

function changeLection(day, type)
{
	 getTorahToday(day, type);
	 getTorahFilesToday(day, type);
	 getDedicationToday(day, type);
	 return false;
}

function getDedicationToday(day, type)
{
  var pars = {section: 'xajax', task: 'getDedicationToday', day: day, type: type};
  if (pagePreviewMode)
  {
    pars.preview = 1;
  }
  $.get(url, pars, function(resp) {eval(resp); });
}


