<?php

include "../../lib/v1/src/dawanda.php";
$api = new DaWandaAPI("380d7924396f5596116f3d8815c97dfd8c975582", "de");
if ($_GET["username"]) {
    $firstPuzzle = null;
    $error = null;
    $products = null;
    try {
        $products = $api->getProductsForShop($_GET["username"], array("per_page" => 7));
    } catch (Exception $e) {
        $error = "Username is invalid!";
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>DaWanda API: PHP Framework</title>
  <script type="text/javascript" charset="utf-8" src="lib/jquery.js"></script>
  <script type="text/javascript" src="lib/jquery.puzzle.js"></script>
  <script type="text/javascript">
    function changePuzzle(source) {
      var src = source.replace("thumb", "big");
      var img = new Image();
      img.src = src;
      
      img.onload = function() {
        $("#puzzle").empty();
        $("#puzzle").append('<img src="'+ src +'" width="'+img.width+'" height="'+img.height+'" />');