/*
   This JavaScript code was generated by Jemplate, the JavaScript
   Template Toolkit. Any changes made to this file will be lost the next
   time the templates are compiled.

   Copyright 2006 - Ingy döt Net - All rights reserved.
*/

if (typeof(Jemplate) == 'undefined')
    throw('Jemplate.js must be loaded before any Jemplate template files');

Jemplate.templateMap['item_detail'] = function(context) {
    if (! context) throw('Jemplate function called without context\n');
    var stash = context.stash;
    var output = '';

    try {
output += '<span class="item_display_back">back...</span>\n<span class="item_name">';
//line 2 "item_detail"
output += stash.get(['item', 0, 'name', 0]);
output += '</span><br/>\n<div class="timestrip_image">\n';
//line 8 "item_detail"
if (stash.get(['item', 0, 'expiration', 0]) > 14) {
output += '\n<img  src="';
//line 5 "item_detail"
output += stash.get('img_base');
output += '/months-';
//line 5 "item_detail"
output += stash.get(['item', 0, 'location', 0]);
output += '.jpg" alt="expires in ';
//line 5 "item_detail"
output += stash.get(['item', 0, 'formatted_expiration', 0]);
output += '">\n';
}
else {
output += '\n<img  src="';
//line 7 "item_detail"
output += stash.get('img_base');
output += '/days-';
//line 7 "item_detail"
output += stash.get(['item', 0, 'location', 0]);
output += '.jpg" alt="expires in ';
//line 7 "item_detail"
output += stash.get(['item', 0, 'formatted_expiration', 0]);
output += '">\n';
}

output += '\n<br/><a href="#" class="send_to_friend" id="send_';
//line 9 "item_detail"
output += stash.get(['item', 0, 'id', 0]);
output += '">Send to a friend</a>\n</div>\nExpires in: <br/>\n';
//line 12 "item_detail"
output += stash.get(['item', 0, 'location', 0]);
output += ': ';
//line 12 "item_detail"
output += stash.get(['item', 0, 'formatted_expiration', 0]);
output += ' ';
//line 14 "item_detail"
if (stash.get(['item', 0, 'expiration2', 0]) > 0) {
output += '<br/>';
//line 13 "item_detail"
output += stash.get(['item', 0, 'location2', 0]);
output += ': ';
//line 13 "item_detail"
output += stash.get(['item', 0, 'formatted_expiration2', 0]);
}

output += '\n<p>';
//line 16 "item_detail"
output += stash.get(['item', 0, 'note', 0]);
output += '</p>\n<p>\nSources:\n';
//line 19 "item_detail"
output += stash.get(['item', 0, 'source_description', 0]);
output += '<br />\n';
//line 26 "item_detail"
if (stash.get(['links', 0, 'size', 0])) {
output += '\n<ul class="item_links">\n';
//line 24 "item_detail"

// FOREACH 
(function() {
    var list = stash.get('links');
    list = new Jemplate.Iterator(list);
    var retval = list.get_first();
    var value = retval[0];
    var done = retval[1];
    var oldloop;
    try { oldloop = stash.get('loop') } finally {}
    stash.set('loop', list);
    try {
        while (! done) {
            stash.data['link'] = value;
output += '    <li class="item_link"><a href="';
//line 23 "item_detail"
output += stash.get(['link', 0, 'uri', 0]);
output += '">';
//line 23 "item_detail"
output += stash.get(['link', 0, 'title', 0]);
output += '</a></li>\n';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</ul>\n';
}

output += '\n</p>\n\n\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

Jemplate.templateMap['item_search_result'] = function(context) {
    if (! context) throw('Jemplate function called without context\n');
    var stash = context.stash;
    var output = '';

    try {
//line 13 "item_search_result"
if (! stash.get(['items', 0, 'size', 0])) {
output += '\n<p>Nothing found</p>\n';
}
else {
output += '\n';
//line 12 "item_search_result"

// FOREACH 
(function() {
    var list = stash.get('items');
    list = new Jemplate.Iterator(list);
    var retval = list.get_first();
    var value = retval[0];
    var done = retval[1];
    var oldloop;
    try { oldloop = stash.get('loop') } finally {}
    stash.set('loop', list);
    try {
        while (! done) {
            stash.data['item'] = value;
output += '\n    <div class="item">\n        <span class="item_search_result_entry">\n            <a href="#" class="item_detail" id="item_';
//line 7 "item_search_result"
output += stash.get(['item', 0, 'id', 0]);
output += '">';
//line 7 "item_search_result"
output += stash.get(['item', 0, 'name', 0]);
output += ':</a> ';
//line 7 "item_search_result"
output += stash.get(['item', 0, 'formatted_expiration', 0]);
output += ' ';
//line 7 "item_search_result"
output += stash.get(['item', 0, 'location', 0]);
output += '\n            ';
//line 9 "item_search_result"
if (stash.get(['item', 0, 'expiration2', 0]) > 0) {
output += ', ';
//line 8 "item_search_result"
output += stash.get(['item', 0, 'formatted_expiration2', 0]);
output += ' ';
//line 8 "item_search_result"
output += stash.get(['item', 0, 'location2', 0]);
output += '\n            ';
}

output += '\n        </span>\n    </div>\n';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '\n';
}

output += '\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

