tools = {
  options:{ readerBaseUrl:'/matongev2/standard.aspx'}
  };
  
tools.readBook = function(docID,searchString) {
  winH = screen.height;
  winW = screen.width;
    
  var url = tools.options.readerBaseUrl + '?docID=' + docID;
  if (searchString)
    url = url + '&s=' + searchString;

  mywin = window.open(url,
  'ComReader',
  'status=yes,top=0,left=0,width=' + (winW-10) + ',height=' + (winH - 80) + ',toolbar=no,menubar=no,location=no,scollbars=yes,resizable=yes');
  
  mywin.focus();
}

tools.updateSubjects = function(docid,container)
{
  this.debugMsg(docid);
  $.ajax({
    url: '/subjects.aspx?docid=' + docid,
    success: function(data) {
      $('#' + container).html(data);
    }
  });
}

tools.isIpad = function()
{
  return (navigator.userAgent.indexOf("iPad") > 0);
}
tools.showBooksOfSubject = function(subject)
{
  if (tools.isIpad())
  {
    winH = screen.height;
    winW = screen.width;
  }
  else
  {
    winH = screen.height /2;
    winW = screen.width /2;
  }  
    
  var url = '/subjects.aspx?subject=' + subject;

  mywin = window.open(url,
  'BooksSubject',
  'status=yes,top=0,left=0,width=' + (winW) + ',height=' + (winH) + ',toolbar=no,menubar=no,location=no,scollbars=yes,resizable=no');
  
  mywin.focus();
  
}
tools.debugMsg = function(msg) {
  try
  {
    console.log(msg);
  }
  catch(ee){}
}

var reaBook = tools.readBook;

