/* 
   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['main.tt'] = function(context) {
    if (! context) throw('Jemplate function called without context\n');
    var stash = context.stash;
    var output = '';

    try {
//line 1 "main.tt"
stash.set('count', 0);
output += '\n';
//line 15 "main.tt"

// FOREACH 
(function() {
    var list = stash.get('clips');
    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['clip'] = value;
//line 2 "main.tt"
stash.set('c_class', stash.get(['clip', 0, 'match', [ 'class:[^ ]+' ]]));
//line 3 "main.tt"
if (stash.get('count') % 5 == 0) {
output += '<div class="cliptipBOX">';
}

output += '\n<div class="w1BG';
//line 4 "main.tt"
output += stash.get(['c_class', 0, 0, 0, 'replace', [ 'class:', '' ]]);
output += '">\n<div class="wTOP">\n<div class="wBOTTOM">\n<h3 class="clipTITLE">';
//line 7 "main.tt"
if (stash.get(['genre', 0, stash.get('count'), 0])) {
//line 7 "main.tt"
stash.set('genre_label', stash.get(['genre', 0, stash.get('count'), 0, 0, 0]));
}
else {
//line 7 "main.tt"
stash.set('genre_label', '湘南人');
}

//line 7 "main.tt"
if (!((! stash.get(['genre', 0, stash.get('count'), 0, 1, 0]) || stash.get(['genre', 0, stash.get('count'), 0, 1, 0]) == '0'))) {
//line 7 "main.tt"

// FILTER
output += (function() {
    var output = '';

output += stash.get('genre_label')  + ':'  + stash.get(['genre', 0, stash.get('count'), 0, 1, 0, 'join', [ '・' ]]);

    return context.filter(output, 'truncate', [ 10 ]);
})();

}
else {
//line 7 "main.tt"
output += stash.get('genre_label');
}

output += '</h3>';
//line 9 "main.tt"
output += stash.get('clip');
output += '</div>\n</div>\n</div>\n';
//line 13 "main.tt"
if (stash.get('count') % 5 == 4 || stash.get('count') == stash.get(['pager', 0, 'entries_on_this_page', 0])) {
output += '</div>';
}

output += '\n';
//line 14 "main.tt"
stash.set('count', stash.get('count') + 1);
output += '\n';;
            retval = list.get_next();
            var value = retval[0];
            var done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

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

    return output;
}

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

    try {
//line 1 "subwindow.tt"
stash.set('count', 0);
//line 15 "subwindow.tt"

// FOREACH 
(function() {
    var list = stash.get('clips');
    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['clip'] = value;
//line 3 "subwindow.tt"
stash.set('c_class', stash.get(['clip', 0, 'match', [ 'class:[^ ]+' ]]));
output += '<div class="w1BG';
//line 4 "subwindow.tt"
output += stash.get(['c_class', 0, 0, 0, 'replace', [ 'class:', '' ]]);
output += '">\n<div class="wTOP">\n<div class="wBOTTOM">\n<h3 class="clipTITLE">';
//line 7 "subwindow.tt"
if (stash.get(['genre', 0, stash.get('count'), 0])) {
//line 7 "subwindow.tt"
stash.set('genre_label', stash.get(['genre', 0, stash.get('count'), 0, 0, 0]));
}
else {
//line 7 "subwindow.tt"
stash.set('genre_label', '湘南人');
}

//line 7 "subwindow.tt"
if (!((! stash.get(['genre', 0, stash.get('count'), 0, 1, 0]) || stash.get(['genre', 0, stash.get('count'), 0, 1, 0]) == '0'))) {
//line 7 "subwindow.tt"

// FILTER
output += (function() {
    var output = '';

output += stash.get('genre_label')  + ':'  + stash.get(['genre', 0, stash.get('count'), 0, 1, 0, 'join', [ '・' ]]);

    return context.filter(output, 'truncate', [ 10 ]);
})();

}
else {
//line 7 "subwindow.tt"
output += stash.get('genre_label');
}

output += '</h3>';
//line 9 "subwindow.tt"
output += stash.get('clip');
output += '</div>\n</div>\n</div>';
//line 14 "subwindow.tt"
stash.set('count', stash.get('count') + 1);;
            retval = list.get_next();
            var value = retval[0];
            var done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

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

    return output;
}

