




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

{ "title": "One of Our Thursdays is Missing", "author": "Jasper Fforde", "alink": "http://www.amazon.de/One-Thursdays-Missing-Jasper-Fforde/dp/0340963085%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0340963085", "aimg":"http://ecx.images-amazon.com/images/I/51Lb6DiKwvL._SL160_.jpg","when":"finally" },
    { "title": "Moon Palace", "author": "Paul Auster", "alink": "http://www.amazon.de/Moon-Palace-Paul-Auster/dp/0571168639%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0571168639", "aimg":"http://ecx.images-amazon.com/images/I/41QBYM79D1L._SL160_.jpg","when":"right now" },
    { "title": "An Idiot Abroad", "author": "Stephen Merchant", "alink": "http://www.amazon.de/Idiot-Abroad-Karl-Pilkington/dp/1847679269%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1847679269", "aimg":"http://ecx.images-amazon.com/images/I/51D4gXcZsJL._SL160_.jpg","when":"right now" },
    { "title": "Ewig Dein: Roman", "author": "Daniel Glattauer", "alink": "http://www.amazon.de/Ewig-Dein-Roman-ebook/dp/B006ZUK0I6%3FSubscriptionId%3D03T6B6P5GH4CW5567X82%26tag%3Ditconservatio-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB006ZUK0I6", "aimg":"http://ecx.images-amazon.com/images/I/41KslbnNOYL._SL160_.jpg","when":"right now" }
        
   ]
  };
  
  var table = document.getElementById("mytable");

  for (x in data.books)
  {
    var book = data.books[x];
    var aa="<a href=\""+fixalink(book.alink)+"\">";
    
    tc = table.insertRow( table.rows.length ).insertCell(0);
    tc.colSpan="2";
    tc.align="center";
    tc.innerHTML = "<i>"+book.when+":</i>";

    tr = table.insertRow( table.rows.length )
    tc = tr.insertCell(0);
    tc.innerHTML = aa+book.title+"</a><br/>by&nbsp;"+book.author;
    
    tc = tr.insertCell( tr.cells.length);
    
    tc.innerHTML += aa+"<img src=\""+book.aimg+"\"/></a>";
  }
  
}

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;
  
}
