//save the record
        scraperwiki::save(array('id'), $record);
    }
}
require 'scraperwiki/simple_html_dom.php';
ini_set('max_execution_time', 600);
setlocale(LC_ALL, 'fr_FR.UTF8');
//the firt time, we set manually the first page
$value = "/recherche/resultats/map/Centre/tr/by";
//if $value is a valid page
while ($value != "") {
    $htmlCentre = scraperWiki::scrape("http://www.athome.lu" . $value);
    $domCentre = new simple_html_dom();
    $domCentre->load($htmlCentre);
    //find the announces in the current page and store the records
    findAnnounces($domCentre);
    //look for the next page link
    $value = "";
    foreach ($domCentre->find('.next') as $data) {
        $value = $data->href;
    }
}
/***************** Functions *********************/
function findAnnounces($strDataDom)
{
    //for each page, there are up to 10 records, each of them marked with DOM class 'plus'
    foreach ($strDataDom->find('.plus') as $data) {
        $value = $data->href;
        //is it a valid URL for an announce?
        if (strrpos($value, "www.athome.lu/")) {
            //go into the announce
        }
    }
}
require 'scraperwiki/simple_html_dom.php';
ini_set('max_execution_time', 1200);
setlocale(LC_ALL, 'fr_FR.UTF8');
$counter = 0;
//the first time, set manually the first page
$value = "/recherche/resultats/tr/rt/w/d,Luxembourg%7CBelair,Limpertsberg,Rollingergrund,Merl%3Ba,Bertrange%3Ba,Strassen/ig/h,f";
//while $value is not blank
while ($value != "") {
    $htmlCentre = scraperWiki::scrape("http://www.athome.lu" . $value);
    $domCentre = new simple_html_dom();
    $domCentre->load($htmlCentre);
    //find the announces in the current page and store the records
    findAnnounces($domCentre, $counter);
    //look for the next page link
    $value = "";
    foreach ($domCentre->find('.next') as $data) {
        $value = $data->href;
    }
}
//if there are no records, insert a blank record
/*
if ($counter == 0){
    $record=array();
    $record["id"] = 0;
    $record["url"] = "No records for today :(";
    $record["submitter"] = 0;
    //save the record
    scraperwiki::save(array('id'), $record);