<?php


function jeemod_chapter($nid){
  $viewmode = "chapter";

  $rep = array(
    "nid" => $nid,
    "viewmode" => $viewmode
  );

  if($nodeview = node_view(node_load($nid),$viewmode)){
    $rep = $rep+array(
      'node' => drupal_render($nodeview),
    );
    drupal_json_output($rep);
  }
}

function jeemod_static(){
  $viewmode = "full";


  // get node by url
  $path = drupal_get_normal_path(preg_replace('/^\//', '', $_GET['href']));
  $nid = end(explode("/", $path));

  $rep = array(
    // "get" => $_GET,
    // "path" => $path,
    "nid" => $nid,
    "viewmode" => $viewmode
  );

  if($nodeview = node_view(node_load($nid),$viewmode)){
    $rep = $rep+array(
      'node' => drupal_render($nodeview),
    );
    drupal_json_output($rep);
  }
}