




var atag = "itconversatio-21";
  
function whatiread()
{
  
  
  var data=
  {"books": [

{ "title": "Ulysses (Penguin Modern Classics)", "author": "James Joyce", "alink": "http://www.amazon.de/Ulysses-Penguin-Modern-Classics/dp/0141182806%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0141182806", "aimg":"http://ecx.images-amazon.com/images/I/51xG-r4r8%2BL._SL160_.jpg","when":"right now" },
    { "title": "The Pillars of the Earth", "author": "Ken Follett", "alink": "http://www.amazon.com/Pillars-Earth-Ken-Follett/dp/0451166892%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0451166892", "aimg":"http://ecx.images-amazon.com/images/I/5105Y4BTXEL._SL160_.jpg","when":"right now" },
    { "title": "Shopgirl: A Novella", "author": "Steve Martin", "alink": "http://www.amazon.com/Shopgirl-Novella-Steve-Martin/dp/0786891076%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0786891076", "aimg":"http://ecx.images-amazon.com/images/I/41Q3WS9PARL._SL160_.jpg","when":"right now" }
        
   ]
  };
  
  var table = document.getElementById("mytable");

  for (x in data.books)
  {
    var book = data.books[x];
    
    var tr1 = table.insertRow( table.rows.length );
    var tr2 = table.insertRow( table.rows.length );
    
    tc = tr1.insertCell(0);
    tc.colSpan="2";
    tc.align="center";
    tc.innerHTML = "<i>"+book.when+":</i>";
    
    tc = tr2.insertCell(0);
    
    var aa="<a href=\""+fixalink(book.alink)+"\">";
    
    tc.innerHTML = aa+book.title+"</a><br/>by&nbsp;"+book.author;    
    tc = tr2.insertCell( tr1.cells.length);
    tc.innerHTML = aa+"<img src=\""+book.aimg+"\"/></a>";
    var img = tc.firstChild;    
    //img.width = 80;
  }
  
}

function fixalink(alink)
{
  if (alink.indexOf("tag=")<0)
  {
    alink = appendparm(alink, "tag="+atag);
  }
  return alink;
}

function appendparm(url, parm)
{
  var sep="?";
  if (url.indexOf("?")>0)
    sep="&";
  return url+sep+parm;
  
}