/*
   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-2008 - Ingy döt Net - All rights reserved.
*/

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

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

    try {

output += '\n';
//line 42 "bizcode_custom.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "bizcode_custom.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "bizcode_custom.tt2"
if (stash.get(['code', 0, 'code', 0])) {
//line 14 "bizcode_custom.tt2"
output += stash.get(['code', 0, 'code', 0]);
}
else {
output += 'New Custom Code';
}

output += '</div>\n		<div style="float:right;">';
//line 15 "bizcode_custom.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += '<a href="javascript:closePopup()">';
}
else {
output += '<a href="javascript:cancelPopup()">';
}

output += '[X]</a></div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n	<div id="code_container">\n	<table>\n	<tr>\n		<td class="cardlbl">Code:</td>\n		<td class="cardfld">\n			<input id="bizcode" type="text" value="';
//line 26 "bizcode_custom.tt2"

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

output += stash.get(['code', 0, 'code', 0]);

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

output += '" size="30" maxlength="100" name="code_code_';
//line 26 "bizcode_custom.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardcodefld" style="width:280px;" />\n			<input type="submit" onclick="bizcode_custom(); return false;" style="margin:-1px 0 2px auto; float: right;" class="button_link WhiteOnGreen" value="';
//line 27 "bizcode_custom.tt2"
if (stash.get(['code', 0, 'code', 0])) {
output += 'CHANGE';
}
else {
output += 'CUSTOM';
}

output += '" id="customsubmit"><br />\n			<div id="result_custom" style="clear: both; margin: 4px 0 8px 0;" class="green">';
//line 28 "bizcode_custom.tt2"
output += stash.get('codemessage');
output += '&nbsp;</div>\n		</td>\n	</tr>\n	';
//line 31 "bizcode_custom.tt2"
output += context.include('bizcode_common.tt2');
output += '\n	</table>\n			<input id="customsubmit" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="closePopup(); return false;" />\n			';
//line 38 "bizcode_custom.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += '\n			<input id="customsubmit" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="bizcode_delete(';
//line 35 "bizcode_custom.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '); return false;" />\n			';
}
else {
output += '\n			<input id="customsubmit" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="cancelPopup(); return false;" />			\n			';
}

output += '\n	</div>\n<div style="clear: both;height: 20px;"> </div>\n</div>\n';
}

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

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable">\n<thead>\n	<tr>\n		<th style="width: 26px;">Main</th>\n		<th style="width: 77px;">Label</th>\n		<th style="width:168px;">Address</th>\n	</tr>\n</thead>\n<tbody class="contactsCardTableBody" id="imList">\n';
//line 16 "contact_card_im.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'ims', 0]);
    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['im'] = value;
output += '\n<tr>\n	<td class="nobd"><input type="radio" name="im_pref_a" value="';
//line 12 "contact_card_im.tt2"
output += stash.get(['im', 0, 'id', 0]);
output += '" class="cardfld nobd hilite" ';
//line 12 "contact_card_im.tt2"
if (stash.get(['im', 0, 'pref', 0]) == 1) {
output += 'checked="checked" ';
}

output += '/></td>\n	<td class="nobd"><span id="im_label_';
//line 13 "contact_card_im.tt2"
output += stash.get(['im', 0, 'id', 0]);
output += '" class="lblpop cardfld">';
//line 13 "contact_card_im.tt2"

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

output += stash.get(['im', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobd"><input type="text" value="';
//line 14 "contact_card_im.tt2"

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

output += stash.get(['im', 0, 'im', 0]);

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

output += '" size="25" name="im_im_';
//line 14 "contact_card_im.tt2"
output += stash.get(['im', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
//line 24 "userlist.tt2"
if (stash.get(['users', 0, 'size', 0])) {
output += '\n<table class="list" id="userlist">\n<tr>\n	<th> </th>\n	<th>Id</th>\n	<th>User name</th>\n	<th>Contact name</th>\n	<th>Company</th>\n	<th>Biz?</th>\n	<th>Balance</th>\n</tr>\n';
//line 22 "userlist.tt2"

// FOREACH 
(function() {
    var list = stash.get('users');
    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['user'] = value;
output += '\n<tr>\n	<td><input type="radio" name="uname" value="';
//line 14 "userlist.tt2"
output += stash.get(['user', 0, 'username', 0]);
output += '" /></td>\n	<td>';
//line 15 "userlist.tt2"
output += stash.get(['user', 0, 'id', 0]);
output += '</td>\n	<td>';
//line 16 "userlist.tt2"
output += stash.get(['user', 0, 'username', 0]);
output += '</td>\n	<td>';
//line 17 "userlist.tt2"
output += stash.get(['user', 0, 'contact', 0, 'given', 0]);
output += ' ';
//line 17 "userlist.tt2"
output += stash.get(['user', 0, 'contact', 0, 'family', 0]);
output += ' </td>\n	<td>';
//line 18 "userlist.tt2"
output += stash.get(['user', 0, 'contact', 0, 'company', 0]);
output += '</td>\n	<td>';
//line 19 "userlist.tt2"
output += stash.get(['user', 0, 'business', 0]);
output += '</td>\n	<td>';
//line 20 "userlist.tt2"
output += stash.get(['user', 0, 'balance', 0]);
output += '</td>\n</tr>\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</table>\n';
}

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

    return output;
}

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

    try {
//line 6 "code_random.tt2"
if (stash.get('error_msg')) {
output += ' \n<span class="error">';
//line 2 "code_random.tt2"

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

output += stash.get('error_msg');

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

output += '</span>\n';
}
else {
output += ' \n<b>SUCCESS! Your personal O-CODE is: <span id="randomocode">';
//line 4 "code_random.tt2"
output += stash.get('code');
output += '</span></b><br />\n';
//line 5 "code_random.tt2"
if (stash.get('confirmed') == 0) {
output += '<a href="" onclick="code_confirm(\'random\'); return false;">Click here</a> to confirm this as your new o-code.';
}

output += '\n';
}

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

    return output;
}

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

    try {
output += '			<div class="indent20">\n				';
//line 18 "concierge_im_msgs.tt2"

// FOREACH 
(function() {
    var list = stash.get('rows');
    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['row'] = value;
output += '\n				<div class="jsdate" style="float:right;">';
//line 3 "concierge_im_msgs.tt2"
output += stash.get(['row', 0, 'updated', 0]);
output += '</div>\n				';
//line 13 "concierge_im_msgs.tt2"
if (stash.get(['row', 0, 'type', 0]) == 0) {
output += '\n				<div class="red">\n				<div style="width:275px;">From ';
//line 6 "concierge_im_msgs.tt2"
output += stash.get(['row', 0, 'phone', 0]);
output += ':\n				';
}
else if (stash.get(['row', 0, 'type', 0]) == 1) {
output += '\n				<div>\n				<div style="width:275px;">Reply:\n				';
}
else {
output += '\n				<div class="blue">\n				<div style="width:275px;">Internal note:\n				';
}

output += '\n				</div>\n				<p>';
//line 15 "concierge_im_msgs.tt2"

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

output += stash.get(['row', 0, 'message', 0]);

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

output += '</p>\n				</div>\n				<hr />\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			</div>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable">\n<thead>\n	<tr>\n		<th>Main</th>\n		<th style="width: 77px;">Label</th>\n		<th style="width:177px;">Number</th>\n	</tr>\n</thead>\n<tbody id="phoneList" class="contactsCardTableBody">\n';
//line 16 "contact_card_phone.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'phones', 0]);
    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['phone'] = value;
output += '\n<tr>\n	<td class="nobd"><input type="radio" name="phone_pref_a" value="';
//line 12 "contact_card_phone.tt2"
output += stash.get(['phone', 0, 'id', 0]);
output += '" class="cardfld nobd hilite" ';
//line 12 "contact_card_phone.tt2"
if (stash.get(['phone', 0, 'pref', 0]) == 1) {
output += 'checked="checked" ';
}

output += '/></td>\n	<td class="nobd"><span id="phone_label_';
//line 13 "contact_card_phone.tt2"
output += stash.get(['phone', 0, 'id', 0]);
output += '" class="lblpop cardfld hilite">';
//line 13 "contact_card_phone.tt2"

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

output += stash.get(['phone', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobd"><input type="text" value="';
//line 14 "contact_card_phone.tt2"

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

output += stash.get(['phone', 0, 'phone', 0]);

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

output += '" size="20" name="phone_phone_';
//line 14 "contact_card_phone.tt2"
output += stash.get(['phone', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 30 "bizcode_random.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "bizcode_random.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "bizcode_random.tt2"

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

output += stash.get(['code', 0, 'code', 0]);

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

output += '</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n	<div id="code_container">\n	<table>\n	';
//line 23 "bizcode_random.tt2"
output += context.include('bizcode_common.tt2');
output += '\n	</table>\n			<input id="customsubmit" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="closePopup(); return false;" />\n			<input id="customsubmit" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="';
//line 26 "bizcode_random.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += 'bizcode_delete(';
//line 26 "bizcode_random.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += ')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n	</div>\n<div style="clear: both;height: 20px;"> </div>\n</div>\n';
}

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

    return output;
}

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

    try {
output += '<div id="codeLayer">\n<form name="uploadForm" action="/offers/import" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="if (this.submitted) return true; else return false;" >\n	<div class="bigbar h2fontsize" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 4 "phonegroup_import.tt2"
if (stash.get(['phonegroup', 0, 'name', 0])) {
output += 'Edit group: ';
//line 4 "phonegroup_import.tt2"
output += stash.get(['phonegroup', 0, 'name', 0]);
}
else {
output += 'Import numbers into new group';
}

output += '</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n	<div id="code_container">\n	<table>\n	<tr>\n		<td class="cardlbl">Group name:</td>\n		<td class="cardfld">\n			<input type="text" value="';
//line 17 "phonegroup_import.tt2"
output += stash.get(['phonegroup', 0, 'name', 0]);
output += '" size="50" maxlength="100" id="pgname" name="pgname" class="cardfld" style="width:367px;" />\n		</td>\n	</tr>\n	<tr>\n		<td class="cardlbl" style="vertical-align:middle;"><p>Description:</p>\n		</td>\n		<td class="cardfld">\n			<textarea id="pgdesc" name="pgdesc" rows="6" cols="50" class="cardfld" style="width:367px;">';
//line 24 "phonegroup_import.tt2"
output += stash.get(['phonegroup', 0, 'description', 0]);
output += '</textarea>\n		</td>\n	</tr>\n	';
//line 51 "phonegroup_import.tt2"
if (! stash.get(['phonegroup', 0, 'name', 0])) {
output += '\n	<tr>\n		<td class="cardlbl">Country:</td>\n		<td class="cardfld"><select id="country" name="country" style="width:100px;">\n			<option value="1">United States</option>\n			<option value="44">United Kingdom</option>\n			<option value="61">Australia</option>\n			</select>\n		</td>\n	</tr>\n	<tr>\n		<td class="cardlbl">File:</td>\n		<td class="cardfld">\n			<!--<div id="fileload">-->\n			<input type="file" size="40" name="pgfile" id="pgfile" class="fb_file" style="width:367px;" />\n			<p id="codemaxsize" style="width:367px; margin:2px 0px 2px 0px;">Maximum file size: ';
//line 42 "phonegroup_import.tt2"
output += stash.get('maxfilesize');
output += '</p>\n			<p id="codefilename" style="width:367px; margin:2px 0px 2px 0px;">&nbsp;</p>\n			<!--</div>-->\n		</td>\n	</tr>\n	</table>\n	';
}
else {
output += '\n	</table>\n	<div style="height:50px;width:367px;"> </div>\n	';
}

output += '\n	';
//line 59 "phonegroup_import.tt2"
if (stash.get(['phonegroup', 0, 'name', 0])) {
output += '\n	<input name="pgid" value="';
//line 53 "phonegroup_import.tt2"
output += stash.get(['phonegroup', 0, 'id', 0]);
output += '" type="hidden" />\n	<input name="country" value="1" type="hidden" />\n	<input name="pgupdate" value="1" type="hidden" />\n	<input id="pgsubmit" value="SAVE" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="formCheck([pgname], [\'name\'], document.uploadForm);" />\n	';
}
else {
output += '\n	<input id="pgsubmit" value="IMPORT" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="formCheck([pgname, pgfile], [\'name\', \'file\'], document.uploadForm);" />\n	';
}

output += '\n	</div>\n\n<iframe id="upload_target" name="upload_target" style="width:0;height:0;border:0px solid #fff;"></iframe>\n</form>\n<div style="clear: both;height: 20px;"> </div>\n</div>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 113 "sms_offer.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "sms_offer.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n';
//line 12 "sms_offer.tt2"
stash.set('hour', '');
//line 12 "sms_offer.tt2"
stash.set('min', '');
//line 12 "sms_offer.tt2"
stash.set('am', 1);
output += '\n';
//line 13 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0]) != '') {
//line 13 "sms_offer.tt2"
stash.set('bits', stash.get(['smsoffer', 0, 'sendat', 0, 'split', [ '[ :]' ]]));
//line 13 "sms_offer.tt2"
stash.set('hour', stash.get(['bits', 0, 1, 0]));
//line 13 "sms_offer.tt2"
stash.set('min', stash.get(['bits', 0, 2, 0]));
//line 13 "sms_offer.tt2"
stash.set('am', stash.get('hour') < 12 ? 1 : 0);
}

output += '\n';
//line 14 "sms_offer.tt2"
if (stash.get('hour') > 12) {
//line 14 "sms_offer.tt2"
stash.set('hour', stash.get('hour') - 12);
}

output += '\n';
//line 15 "sms_offer.tt2"
if (stash.get('hour') != '' && stash.get('hour') == 0) {
//line 15 "sms_offer.tt2"
stash.set('hour', 12);
}

output += '\n';
//line 16 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'phonegroup', 0]) == 1) {
//line 16 "sms_offer.tt2"
stash.set('offerOrAlert', 'alert');
}
else {
//line 16 "sms_offer.tt2"
stash.set('offerOrAlert', 'offer');
}

output += '\n\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">SMS ';
//line 20 "sms_offer.tt2"

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

output += stash.get('offerOrAlert');

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

output += '</div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n<div style="position: relative; margin-top: 20px;">\n<table>\n<tr>\n	<td class="cardlbl" style="padding: 0 0 10px 0;">';
//line 29 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'phonegroup', 0]) == 0) {
output += 'O-CODE:';
}
else {
output += 'Phone group:';
}

output += '</td>\n	<td class="cardfld">';
//line 30 "sms_offer.tt2"

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

output += stash.get(['smsoffer', 0, 'codename', 0]);

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

output += '</td>\n</tr>\n<tr>\n	<td class="cardlbl">';
//line 33 "sms_offer.tt2"

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

output += stash.get('offerOrAlert');

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

output += ' Title:</td>\n	<td class="cardfld"><input type="text" value="';
//line 34 "sms_offer.tt2"

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

output += stash.get(['smsoffer', 0, 'title', 0]);

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

output += '" size="50" maxlength="255" name="smsoffer_title_';
//line 34 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" /></td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>SMS:</p>\n		<span id="custommessageCount" style="color: green;">0/160</span>\n	</td>\n	<td class="cardfld">\n		<textarea id="custommessage" name="smsoffer_message_';
//line 41 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" rows="4" cols="50" class="cardfld" style="width:367px;">';
//line 41 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'message', 0]);
output += '</textarea>\n	</td>\n</tr>\n';
//line 53 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'headers', 0])) {
output += '\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>Variable text:\n	</td>\n	<td class="cardfld">\n		<div id="customvariables" style="min-height:60px;width:367px;" class="likeinput">';
//line 49 "sms_offer.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '<span class="varclick link" rel="custommessage">%';
//line 49 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%</span> &nbsp; ';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n		<div id="customvariablelengths" style="display:none;">';
//line 50 "sms_offer.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '%';
//line 50 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%:';
//line 50 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 1, 0]);
output += ',';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n	</td>\n</tr>\n';
}

output += '\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input type="text" id="customurl" value="';
//line 57 "sms_offer.tt2"

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

output += stash.get(['smsoffer', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="smsoffer_url_';
//line 57 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld" style="width:367px;border:none;color:grey;" readonly="readonly">';
//line 64 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'url', 0])) {
//line 63 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += ' \n';
}

//line 64 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 65 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 66 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding: 12px 0;">Recipients:</td>\n	<td class="cardfld"><span class="green bold">';
//line 71 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'recipientcount', 0]);
output += '</span><div style="width:60px;display:inline-block;">&nbsp;</div>';
//line 71 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'gateway_id', 0])) {
output += 'Send via: <span class="green bold">';
//line 71 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'gatewaynumber', 0]);
output += '</span>';
}

output += '<div style="width:60px;display:inline-block;">&nbsp;</div>Cost: <span class="green bold">$';
//line 71 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'cost', 0]);
output += '</span></td>\n</tr>\n<tr>\n	<td class="cardlbl" colspan="2">\n	<input type="radio" id="sendAtRadio0" value="null" name="smsoffer_sendat_';
//line 75 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" checked="checked" class="cardfld selectadjust nobd" /> Send Now\n	<div style="width:30px;display:inline-block;">&nbsp;</div>\n	<input type="radio" id="sendAtRadio1" value="1" name="smsoffer_sendat_';
//line 77 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" ';
//line 77 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0])) {
output += 'checked="checked"';
}

output += ' class="cardspecial selectadjust nobd" onclick="document.getElementById(\'sendatDate\').focus();" /> \n		';
//line 91 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n	Send Later: <input type="text" id="sendatDate" value="';
//line 79 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 79 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:90px;" />\n\n	@ <input type="text" id="sendatHour" value="';
//line 81 "sms_offer.tt2"
output += stash.get('hour');
output += '" size="50" name="smsoffer_sendat_';
//line 81 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" /> :\n	<input type="text" id="sendatMin" value="';
//line 82 "sms_offer.tt2"
output += stash.get('min');
output += '" size="50" name="smsoffer_sendat_';
//line 82 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" />\n	<select id="sendatAm" class="cardspecial" id="selectAm" name="selectAm" onchange="updateSendat();">\n		<option value="am" ';
//line 84 "sms_offer.tt2"
if (stash.get('am') == 1) {
output += 'selected="selected"';
}

output += '>am</option>		\n		<option value="pm" ';
//line 85 "sms_offer.tt2"
if (stash.get('am') == 0) {
output += 'selected="selected"';
}

output += '>pm</option>		\n	</select>\n\n	<span id="alerttz"></span>\n		';
}
else {
output += '\n	Sent at: <input type="text" id="sendatDate" value="';
//line 90 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 90 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:180px;" />\n		';
}

output += '\n</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding:18px 0;" colspan="2">\n		';
//line 106 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n		';
//line 101 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'is_new', 0])) {
output += '\n		<input id="offerdelete" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 98 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 98 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'cancel\', \'';
//line 98 "sms_offer.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 100 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 100 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'';
//line 100 "sms_offer.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}

output += '\n		<input id="offersave" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="smsofferSave(';
//line 102 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'sendAtRadio0\', \'custommessage\', \'';
//line 102 "sms_offer.tt2"
output += stash.get('offerOrAlert');
output += '\'); return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 104 "sms_offer.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 104 "sms_offer.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'';
//line 104 "sms_offer.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		<input id="offersave" value="CLOSE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="closePopup(); return false;" />\n		';
}

output += '\n	</td>\n</tr>\n</table>\n</div>\n\n</div>\n';
}

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

    return output;
}

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

    try {
output += '<div id="codeLayer">\n	<div class="bigbar h2fontsize" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:right;"><span class="link" onclick="conciergeCancel($j(\'#custommessage\').val());">[X]</span></div>\n		<div id="cardName">';
//line 4 "concierge_im.tt2"
output += stash.get('phone');
output += ' ';
//line 4 "concierge_im.tt2"
if (stash.get('phone') != stash.get('username')) {
output += '(';
//line 4 "concierge_im.tt2"
output += stash.get('username');
output += ')';
}

output += '</div>\n	</div>\n	\n	<div class="indent20">\n	\n		<div id="refreshicon" style="float:right;"> </div>\n		';
output += '\n		<div style="width:10px;height:24px;display:inline-block;">&nbsp;</div>\n		<p />\n		\n		<div id="msglist" class="borderbox" style="width:475px;height:300px;margin-bottom:10px;" >\n			';
//line 19 "concierge_im.tt2"
output += context.include('concierge_im_msgs.tt2');
output += '\n		</div>\n				\n		<textarea id="custommessage" name="code_message_';
//line 22 "concierge_im.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" rows="6" cols="50" style="width:471px;"></textarea>\n		<div id="custommessageCount" style="color: green;">0/160</div>\n		\n		<!--\n		<input id="custommessageend" type="text" size="50" style="width:471px;" class="cardfld" disabled="disabled" ';
//line 26 "concierge_im.tt2"
if (stash.get(['code', 0, 'url', 0])) {
output += 'value="';
//line 26 "concierge_im.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += '"';
}

output += ' />\n		<input id="custommessageshorturl" type="hidden" value="';
//line 27 "concierge_im.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += '" />\n\n		<table>\n		<tr>\n			<td class="cardlbl">URL:</td>\n			<td class="cardfld">\n				<input id="customurl" type="text" value="';
//line 33 "concierge_im.tt2"

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

output += stash.get(['code', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="code_url_';
//line 33 "concierge_im.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl">File:</td>\n			<td class="cardfld">\n				<form name="uploadForm" action="/business/fileupload" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="if (this.submitted) return true; else return false;" >\n				<input type="hidden" name="codeid" value="';
//line 40 "concierge_im.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" />\n				<input type="file" size="40" name="codefile" id="codefile" class="fb_file" onchange="startUpload(document.uploadForm, \'codefile\', \'codefilename\', \'customsubmit\');" style="width:367px;" />\n				<iframe id="upload_target" name="upload_target" style="width:0;height:0;border:0px solid #fff;"></iframe>\n				</form>\n				<p id="codemaxsize" style="width:367px; margin:2px 0px 2px 0px;">Maximum file size: ';
//line 44 "concierge_im.tt2"
output += stash.get('maxfilesize');
output += '</p>\n				<p id="codefilename" style="width:367px; margin:2px 0px 2px 0px;">';
//line 45 "concierge_im.tt2"
if (stash.get(['code', 0, 'filename', 0])) {
//line 45 "concierge_im.tt2"

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

output += stash.get(['code', 0, 'filename', 0]);

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

output += ' - <span class="link" onclick="codeRemoveFile(';
//line 45 "concierge_im.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += ');">remove file</span>';
}

output += '&nbsp;</p>\n			</td>\n		</tr>\n		</table>\n		-->\n		\n		<input id="sendsms" value="Send SMS" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;float:right;" onclick="conciergeSendSMS(';
//line 51 "concierge_im.tt2"
output += stash.get('gateway_id');
output += ', ';
//line 51 "concierge_im.tt2"
output += stash.get('phone');
output += ', $j(\'#custommessage\').val()); return false;" />\n		<!--\n		<input id="addnote" value="Add Note" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="conciergeAddNote(';
//line 53 "concierge_im.tt2"
output += stash.get('gateway_id');
output += ', ';
//line 53 "concierge_im.tt2"
output += stash.get('phone');
output += ', $j(\'#custommessage\').val()); return false;" />\n		-->\n	</div>\n\n	<div style="clear: both;height: 20px;"> </div>\n</div>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 128 "sms_offer_single.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "sms_offer_single.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n';
//line 12 "sms_offer_single.tt2"
stash.set('phone', '');
//line 12 "sms_offer_single.tt2"
stash.set('country', '');
//line 12 "sms_offer_single.tt2"
stash.set('hour', '');
//line 12 "sms_offer_single.tt2"
stash.set('min', '');
//line 12 "sms_offer_single.tt2"
stash.set('am', 1);
output += '\n';
//line 13 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'phone', 0, 'length', 0]) == 11 && stash.get(['smsoffer', 0, 'phone', 0, 'match', [ '^1' ]])) {
//line 13 "sms_offer_single.tt2"
stash.set('country', 1);
//line 13 "sms_offer_single.tt2"
stash.set('phone', stash.get(['smsoffer', 0, 'phone', 0, 'replace', [ '^1', '' ]]));
}

output += '\n';
//line 14 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'phone', 0, 'length', 0]) == 12 && stash.get(['smsoffer', 0, 'phone', 0, 'match', [ '^44' ]])) {
//line 14 "sms_offer_single.tt2"
stash.set('country', 44);
//line 14 "sms_offer_single.tt2"
stash.set('phone', stash.get(['smsoffer', 0, 'phone', 0, 'replace', [ '^44', '' ]]));
}

output += '\n\n';
//line 16 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0]) != '') {
//line 16 "sms_offer_single.tt2"
stash.set('bits', stash.get(['smsoffer', 0, 'sendat', 0, 'split', [ '[ :]' ]]));
//line 16 "sms_offer_single.tt2"
stash.set('hour', stash.get(['bits', 0, 1, 0]));
//line 16 "sms_offer_single.tt2"
stash.set('min', stash.get(['bits', 0, 2, 0]));
//line 16 "sms_offer_single.tt2"
stash.set('am', stash.get('hour') < 12 ? 1 : 0);
}

output += '\n';
//line 17 "sms_offer_single.tt2"
if (stash.get('hour') > 12) {
//line 17 "sms_offer_single.tt2"
stash.set('hour', stash.get('hour') - 12);
}

output += '\n';
//line 18 "sms_offer_single.tt2"
if (stash.get('hour') != '' && stash.get('hour') == 0) {
//line 18 "sms_offer_single.tt2"
stash.set('hour', 12);
}

output += '\n\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">SMS Single Alert</div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n<div style="position: relative; margin-top: 20px;">\n<table>\n<tr>\n	<td class="cardlbl">Mobile #:</td>\n	<td class="cardfld">\n			<select id="country" name="country" style="width:100px;" onchange="phoneEdited();">\n			<option value="1" ';
//line 34 "sms_offer_single.tt2"
if (stash.get('country') == 1) {
output += 'selected="selected"';
}

output += '>United States</option>\n			<option value="44"';
//line 35 "sms_offer_single.tt2"
if (stash.get('country') == 44) {
output += 'selected="selected"';
}

output += '>United Kingdom</option>\n			</select> <input type="text" value="';
//line 36 "sms_offer_single.tt2"

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

output += stash.get('phone');

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

output += '" size="50" maxlength="255" id="mobile" style="width:167px;" onkeyup="phoneEdited();" onchange="phoneEdited();" class="cardcodefld" /><div id="mobileok" class="okbox"></div>\n			<input id="fullmobile" name="phonelist_phone_';
//line 37 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'recipientlist', 0]);
output += '" class="cardfld" type="hidden" value="" />\n			<input id="fullmobile2" name="smsoffer_title_';
//line 38 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" type="hidden" value="" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>SMS:</p>\n		<span id="custommessageCount" style="color: green;">0/160</span>\n	</td>\n	<td class="cardfld">\n		<textarea id="custommessage" name="smsoffer_message_';
//line 46 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" rows="4" cols="50" class="cardfld" style="width:367px;">';
//line 46 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'message', 0]);
output += '</textarea>\n	</td>\n</tr>\n';
//line 58 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'headers', 0])) {
output += '\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>Variable text:\n	</td>\n	<td class="cardfld">\n		<div id="customvariables" style="min-height:60px;width:367px;" class="likeinput">';
//line 54 "sms_offer_single.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '<span class="varclick link" rel="custommessage">%';
//line 54 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%</span> &nbsp; ';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n		<div id="customvariablelengths" style="display:none;">';
//line 55 "sms_offer_single.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '%';
//line 55 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%:';
//line 55 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 1, 0]);
output += ',';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n	</td>\n</tr>\n';
}

output += '\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input type="text" id="customurl" value="';
//line 62 "sms_offer_single.tt2"

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

output += stash.get(['smsoffer', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="smsoffer_url_';
//line 62 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld" style="width:367px;border:none;color:grey;" readonly="readonly">';
//line 69 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'url', 0])) {
//line 68 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += ' \n';
}

//line 69 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 70 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 71 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding-bottom:12px;">Send Now:</td>\n	<td>\n	<input type="radio" id="sendAtRadio0" value="null" name="smsoffer_sendat_';
//line 77 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" checked="checked" class="cardfld selectadjust nobd" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">Send at:</td>\n	<td>\n	<input type="radio" id="sendAtRadio1" value="1" name="smsoffer_sendat_';
//line 83 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" ';
//line 83 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0])) {
output += 'checked="checked"';
}

output += ' class="cardspecial selectadjust nobd" onclick="document.getElementById(\'sendatDate\').focus();" /> \n		';
//line 100 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n	 <input type="text" id="sendatDate" value="';
//line 85 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 85 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:90px;" />\n	@ <input type="text" id="sendatHour" value="';
//line 86 "sms_offer_single.tt2"
output += stash.get('hour');
output += '" size="50" name="smsoffer_sendat_';
//line 86 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" /> :\n	<input type="text" id="sendatMin" value="';
//line 87 "sms_offer_single.tt2"
output += stash.get('min');
output += '" size="50" name="smsoffer_sendat_';
//line 87 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" />\n	<select id="sendatAm" class="cardspecial" id="selectAm" name="selectAm" onchange="updateSendat();">\n		<option value="am" ';
//line 89 "sms_offer_single.tt2"
if (stash.get('am') == 1) {
output += 'selected="selected"';
}

output += '>am</option>		\n		<option value="pm" ';
//line 90 "sms_offer_single.tt2"
if (stash.get('am') == 0) {
output += 'selected="selected"';
}

output += '>pm</option>		\n	</select>\n	<span id="alerttz"></span>\n	<select id="sendatTZ" class="cardspecial" id="selectTZ" name="selectTZ" onchange="updateSendat();" style="display:none;">\n		';
//line 96 "sms_offer_single.tt2"

// FOREACH 
(function() {
    var list = [ 'CST' ];
    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['timezone'] = value;
output += '\n  			<option value="';
//line 95 "sms_offer_single.tt2"
output += stash.get('timezone');
output += '" ';
//line 95 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'sendathour', 0]) == stash.get('hour')) {
output += 'selected="selected"';
}

output += '>';
//line 95 "sms_offer_single.tt2"
output += stash.get('timezone');
output += '</option>		\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	</select>\n		';
}
else {
output += '\n	<input type="text" id="sendatDate" value="';
//line 99 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 99 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:180px;" />\n		';
}

output += '\n</td>\n</tr>\n<!--\n<tr>\n	<td class="cardlbl" style="padding: 12px 0;">Recipients:</td>\n	<td class="cardfld"><span class="green bold">';
//line 106 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'recipientcount', 0]);
output += '</span><div style="width:60px;display:inline-block;">&nbsp;</div>';
//line 106 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'gateway_id', 0])) {
output += 'Send via: <span class="green bold">';
//line 106 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'gatewaynumber', 0]);
output += '</span>';
}

output += '<div style="width:60px;display:inline-block;">&nbsp;</div>Cost: <span class="green bold">$';
//line 106 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'cost', 0]);
output += '</span></td>\n</tr>\n-->\n<tr>\n	<td class="cardlbl" style="padding:18px 0;" colspan="2">\n		';
//line 121 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n		';
//line 116 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'is_new', 0])) {
output += '\n		<input id="offerdelete" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 113 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 113 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'cancel\', \'alert\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 115 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 115 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'alert\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}

output += '\n		<input id="offersave" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="if (mobileOK()) smsofferSave(';
//line 117 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'sendAtRadio0\', \'custommessage\', \'alert\'); return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 119 "sms_offer_single.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 119 "sms_offer_single.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'alert\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		<input id="offersave" value="CLOSE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="closePopup(); return false;" />\n		';
}

output += '\n	</td>\n</tr>\n</table>\n</div>\n\n</div>\n';
}

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

    return output;
}

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

    try {

output += '\n';
//line 20 "contact_card.tt2"
if (stash.get('error')) {
output += '\n<div id="contactLayer">\n	<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:close_contact()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "contact_card.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="contactLayer">\n	<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "contact_card.tt2"

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

output += stash.get(['contact', 0, 'name', 0]);

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

output += '</div>\n		<div style="float:right;"><a href="javascript:close_contact()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 18 "contact_card.tt2"
output += context.include('contact_card_main.tt2');
output += '\n</div>\n';
}

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

    return output;
}

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

    try {

output += '\n';
//line 106 "view_contact.tt2"
if (stash.get('error')) {
output += '\n<div id="contactLayer">\n<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n<div style="float:left;">An error occurred</div>\n<div style="float:right;"><a href="javascript:close_contact()">[X]</a></div>\n&nbsp;\n</div>\n';
//line 9 "view_contact.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="contactLayer">\n<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n<div style="float:left;">';
//line 14 "view_contact.tt2"

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

output += stash.get(['contact', 0, 'name', 0]);

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

output += '</div>\n<div style="float:right;"><a href="';
//line 1 "view_contact.tt2"

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

output += stash.get(['c', 0, 'uri_for', [ '/contact/view/' + stash.get(['contact', 0, 'id', 0]) ]]);

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

output += '" \n	onclick="edit_contact(';
//line 16 "view_contact.tt2"

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

output += stash.get(['contact', 0, 'id', 0]);

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

output += '); return false;">[ edit ]</a>\n	<a href="javascript:close_contact()">[X]</a>\n</div>\n&nbsp;\n</div>\n\n<div id="tab_container">\n	<div id="tab_1" class="tabbed_pane_tab selected_tab" style="width: 100px;" onclick="do_select(\'1\');">Name &amp; Phones</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_2" class="tabbed_pane_tab" onclick="do_select(\'2\');">Email &amp; IM</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_3" class="tabbed_pane_tab" onclick="do_select(\'3\');">Addresses</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_4" class="tabbed_pane_tab" onclick="do_select(\'4\');">Dates</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_5" class="tabbed_pane_tab" onclick="do_select(\'5\');">Other</div>\n</div>\n\n<div id="card_box_container">\n	<div id="box_1" class="card_box">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n			';
//line 46 "view_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'phones', 0]);
    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['phone'] = value;
output += '\n			<tr>\n				<td>';
//line 43 "view_contact.tt2"

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

output += stash.get(['phone', 0, 'label', 0]);

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

output += '</td>\n				<td>';
//line 44 "view_contact.tt2"

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

output += stash.get(['phone', 0, 'phone', 0]);

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

output += '</td>\n			</tr>\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		</table>\n	</div>\n	\n	<div id="box_2" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n			';
//line 61 "view_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'emails', 0]);
    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['email'] = value;
output += '\n			<tr>\n				<td>';
//line 58 "view_contact.tt2"

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

output += stash.get(['email', 0, 'label', 0]);

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

output += '</td>\n				<td>';
//line 59 "view_contact.tt2"

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

output += stash.get(['email', 0, 'email', 0]);

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

output += '</td>\n			</tr>\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		</table>\n	</div>\n	<div id="box_3" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n			';
//line 84 "view_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'addresses', 0]);
    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['address'] = value;
output += '\n			<tr>\n				<td>';
//line 72 "view_contact.tt2"

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

output += stash.get(['address', 0, 'label', 0]);

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

output += '</td>\n				<td>\n				<address>\n				';
//line 75 "view_contact.tt2"
if (stash.get(['address', 0, 'pobox', 0])) {
//line 75 "view_contact.tt2"

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

output += stash.get(['address', 0, 'pobox', 0]);

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

output += '<br/>';
}

output += '\n					';
//line 76 "view_contact.tt2"
if (stash.get(['address', 0, 'street', 0])) {
//line 76 "view_contact.tt2"

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

output += stash.get(['address', 0, 'street', 0]);

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

output += '<br/>';
}

output += '\n					';
//line 77 "view_contact.tt2"
if (stash.get(['address', 0, 'city', 0])) {
//line 77 "view_contact.tt2"

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

output += stash.get(['address', 0, 'city', 0]);

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

output += '<br/>';
}

output += '\n					';
//line 78 "view_contact.tt2"
if (stash.get(['address', 0, 'region', 0])) {
//line 78 "view_contact.tt2"

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

output += stash.get(['address', 0, 'region', 0]);

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

output += '<br/>';
}

output += '\n					';
//line 79 "view_contact.tt2"
if (stash.get(['address', 0, 'postalcode', 0])) {
//line 79 "view_contact.tt2"

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

output += stash.get(['address', 0, 'postalcode', 0]);

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

output += '<br/>';
}

output += '\n					';
//line 80 "view_contact.tt2"
if (stash.get(['address', 0, 'country', 0])) {
//line 80 "view_contact.tt2"

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

output += stash.get(['address', 0, 'country', 0]);

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

}

output += '\n				</address>\n				</td>\n			</tr>\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		</table>\n	</div>\n	<div id="box_4" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n		</table>\n	</div>\n	<div id="box_5" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n		</table>\n	</div>\n</div><!-- end card_box_container -->\n\n</div>\n';
}

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

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable Tall" >\n<thead>\n	<tr>\n		<th style="width: 92px;">Label</th>\n		<th style="width:194px;"></th>\n	</tr>\n</thead>\n<tbody id="otherList" class="contactsCardTableBody Tall">\n<tr>\n	<td class="nobd"><span class="cardfld hilite">Company</span></td>\n	<td class="nobd"><input type="text" value="';
//line 11 "contact_card_other.tt2"

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

output += stash.get(['contact', 0, 'company', 0]);

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

output += '" size="28" name="contact_company_';
//line 11 "contact_card_other.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\n<tr>\n	<td class="nobd"><span class="cardfld hilite">Department</span></td>\n	<td class="nobd"><input type="text" value="';
//line 15 "contact_card_other.tt2"

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

output += stash.get(['contact', 0, 'department', 0]);

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

output += '" size="28" name="contact_department_';
//line 15 "contact_card_other.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\n<tr>\n	<td class="nobd"><span class="cardfld hilite">Title</span></td>\n	<td class="nobd"><input type="text" value="';
//line 19 "contact_card_other.tt2"

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

output += stash.get(['contact', 0, 'title', 0]);

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

output += '" size="28" name="contact_title_';
//line 19 "contact_card_other.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\n<tr>\n	<td class="nobd"><span class="cardfld hilite">Nickname</span></td>\n	<td class="nobd"><input type="text" value="';
//line 23 "contact_card_other.tt2"

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

output += stash.get(['contact', 0, 'nickname', 0]);

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

output += '" size="28" name="contact_nickname_';
//line 23 "contact_card_other.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\n';
//line 30 "contact_card_other.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'others', 0]);
    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['other'] = value;
output += '\n<tr>\n	<td class="nobd"><span id="other_label_';
//line 27 "contact_card_other.tt2"
output += stash.get(['other', 0, 'id', 0]);
output += '" class="lblpop cardfld">';
//line 27 "contact_card_other.tt2"

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

output += stash.get(['other', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobd"><input type="text" value="';
//line 28 "contact_card_other.tt2"

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

output += stash.get(['other', 0, 'other', 0]);

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

output += '" size="28" name="other_other_';
//line 28 "contact_card_other.tt2"
output += stash.get(['other', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += 'Your O-CODE is:<br />\n<span id="userocode" style="font-size: ';
//line 2 "code_info.tt2"
output += (250 / (stash.get(['code', 0, 'length', 0]) + 2)) - 3;
output += 'px;">';
//line 2 "code_info.tt2"
output += stash.get('code');
output += '</span>\n\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable Tall">\n<thead>\n	<tr>\n		<th style="width:114px;">Label</th>\n		<th style="width:172px;">Date</th>\n	</tr>\n</thead>\n<tbody id="mydateList" class="contactsCardTableBody Tall">\n<tr>\n	<td class="nobd"><span class="cardfld hilite">Birthday</span></td>\n	<td class="nobd"><input type="text" value="';
//line 11 "contact_card_mydate.tt2"
if (stash.get(['contact', 0, 'birthday', 0])) {
//line 11 "contact_card_mydate.tt2"

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

output += stash.get(['contact', 0, 'birthday', 0]);

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

}

output += '" size="24" name="contact_birthday_';
//line 11 "contact_card_mydate.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld carddate hilite" style="border: none;" /></td>\n</tr>\n';
//line 18 "contact_card_mydate.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'mydates', 0]);
    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['mydate'] = value;
output += '\n<tr>\n	<td class="nobd"><span id="mydate_label_';
//line 15 "contact_card_mydate.tt2"
output += stash.get(['mydate', 0, 'id', 0]);
output += '" class="lblpop cardfld">';
//line 15 "contact_card_mydate.tt2"

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

output += stash.get(['mydate', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobd"><input type="text" value="';
//line 16 "contact_card_mydate.tt2"

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

output += stash.get(['mydate', 0, 'mydate', 0]);

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

output += '" size="24" name="mydate_mydate_';
//line 16 "contact_card_mydate.tt2"
output += stash.get(['mydate', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld carddate hilite" style="border: none;" /></td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<tr>\n	<td class="cardlbl">Title:</td>\n	<td class="cardfld">\n		<input type="text" value="';
//line 4 "bizcode_common.tt2"

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

output += stash.get(['code', 0, 'title', 0]);

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

output += '" size="50" maxlength="100" name="code_title_';
//line 4 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>SMS:</p>\n			<span id="custommessageCount" style="color: green;">0/160</span>\n	</td>\n	<td class="cardfld">\n		<textarea id="custommessage" name="code_message_';
//line 12 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" rows="6" cols="50" class="cardfld" style="width:367px;">';
//line 12 "bizcode_common.tt2"
output += stash.get(['code', 0, 'message', 0]);
output += '</textarea>\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">		\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld" style="width:367px;border:none;color:grey;" readonly="readonly">';
//line 19 "bizcode_common.tt2"
if (stash.get(['code', 0, 'url', 0])) {
//line 18 "bizcode_common.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += ' \n';
}

//line 19 "bizcode_common.tt2"
output += stash.get(['code', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 20 "bizcode_common.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 21 "bizcode_common.tt2"
output += stash.get(['code', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input id="customurl" type="text" value="';
//line 27 "bizcode_common.tt2"

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

output += stash.get(['code', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="code_url_';
//line 27 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">File:</td>\n	<td class="cardfld">\n		<!--<div id="fileload">-->\n        <form name="uploadForm" action="/business/fileupload" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="if (this.submitted) return true; else return false;" >\n        <input type="hidden" name="codeid" value="';
//line 35 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" />\n		<!--<input id="customsubmit" value="GET FILE" type="submit" class="button_link WhiteOnOrange" style="margin-bottom:2px;" onclick="startUpload(document.uploadForm, \'codefile\', \'codefilename\'); return false;" />-->\n		<input type="file" size="40" name="codefile" id="codefile" class="fb_file" onchange="startUpload(document.uploadForm, \'codefile\', \'codefilename\', \'customsubmit\');" style="width:367px;" />\n		<iframe id="upload_target" name="upload_target" style="width:0;height:0;border:0px solid #fff;"></iframe>\n		</form>\n		<p id="codemaxsize" style="width:367px; margin:2px 0px 2px 0px;">Maximum file size: ';
//line 40 "bizcode_common.tt2"
output += stash.get('maxfilesize');
output += '</p>\n		<p id="codefilename" style="width:367px; margin:2px 0px 2px 0px;">';
//line 41 "bizcode_common.tt2"
if (stash.get(['code', 0, 'filename', 0])) {
//line 41 "bizcode_common.tt2"

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

output += stash.get(['code', 0, 'filename', 0]);

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

output += ' - <span class="link" onclick="codeRemoveFile(';
//line 41 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += ');">remove file</span>';
}

output += '&nbsp;</p>\n		<!--</div>-->\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">Private:</td>\n	<td class="cardfld">\n		<input type="checkbox" name="code_private_';
//line 48 "bizcode_common.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" ';
//line 48 "bizcode_common.tt2"
if (stash.get(['code', 0, 'private', 0]) == 1) {
output += 'checked="checked"';
}

output += ' class="cardfld nobd" /> &nbsp;(Won\'t appear in "What\'s Hot" section on the home page)<br />&nbsp;\n	</td>\n</tr>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<hr />\n<form onsubmit="return false;">\n<table class="list" id="userinfo">\n<tr>\n	<th>Id</th>\n	<th>User name</th>\n	<th>Contact name</th>\n	<th>Company</th>\n	<th>Biz?</th>\n	<th>Balance</th>\n</tr>\n<tr>\n	<td id="usermanageid">';
//line 13 "usermanage.tt2"
output += stash.get(['user', 0, 'id', 0]);
output += '</td>\n	<td id="username">';
//line 14 "usermanage.tt2"
output += stash.get(['user', 0, 'username', 0]);
output += '</td>\n	<td>';
//line 15 "usermanage.tt2"
output += stash.get(['user', 0, 'contact', 0, 'given', 0]);
output += ' ';
//line 15 "usermanage.tt2"
output += stash.get(['user', 0, 'contact', 0, 'family', 0]);
output += ' </td>\n	<td>';
//line 16 "usermanage.tt2"
output += stash.get(['user', 0, 'contact', 0, 'company', 0]);
output += '</td>\n	<td>';
//line 17 "usermanage.tt2"
output += stash.get(['user', 0, 'business', 0]);
output += '</td>\n	<td id="balance">';
//line 18 "usermanage.tt2"
output += stash.get(['user', 0, 'balance', 0]);
output += '</td>\n</tr>\n</table>\n\n<input type="checkbox" value="business" name="user_businessflags" ';
//line 22 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'business', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Business account<br />\n<input type="checkbox" value="offers" name="user_businessflags" ';
//line 23 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'offers', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Offers enabled<br />\n<input type="checkbox" value="alerts" name="user_businessflags" ';
//line 24 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'alerts', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Alerts enabled<br />\n<input type="checkbox" value="poll" name="user_businessflags" ';
//line 25 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'poll', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Poll enabled<br />\n<input type="checkbox" value="concierge" name="user_businessflags" ';
//line 26 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'concierge', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Concierge enabled<br />\n<input type="checkbox" value="unique" name="user_businessflags" ';
//line 27 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'unique', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />Twilio number with unique codes<br />\n<input type="checkbox" value="vouchers" name="user_businessflags" ';
//line 28 "usermanage.tt2"
if (stash.get(['user', 0, 'businessflags', 0, 'vouchers', 0]) > 0) {
output += 'checked="checked"';
}

output += ' class="inputadjust nobd user_businessflags" />User creates codes with vouchers<br />\n<input type="submit" onclick="updateBusinessUser();return false;" value="Save changes" class="button_link WhiteOnOrange" /> \n\n<p />\n<input type="submit" onclick="editMobileColName(';
//line 32 "usermanage.tt2"
output += stash.get(['user', 0, 'id', 0]);
output += ');return false;" value="Set mobile column name for imports:" class="button_link WhiteOnOrange" /> \n<input type="text" id="mobilecolname" size="20" style="display:none;"/>\n<input type="submit" id="setmobilecolname" onclick="setMobileColName(';
//line 34 "usermanage.tt2"
output += stash.get(['user', 0, 'id', 0]);
output += ', mobilecolname.value);return false;" value="Save" class="button_link WhiteOnOrange" style="display:none;" /> \n\n</form>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n<div id="tab_container">\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_1" class="tabbed_pane_tab selected_tab" style="width: 100px;" onclick="do_select(\'1\');">Name &amp; Phones</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_2" class="tabbed_pane_tab" onclick="do_select(\'2\');">Email &amp; IM</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_3" class="tabbed_pane_tab" onclick="do_select(\'3\');">Addresses</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_4" class="tabbed_pane_tab" onclick="do_select(\'4\');">Dates</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_5" class="tabbed_pane_tab" onclick="do_select(\'5\');">Other</div>\n	<div class="tabbed_pane_tab tab_spacer" style="width:90px;" ></div>\n</div>\n\n<form name="editContact" method="post" action="" onsubmit="return false;">\n<input type="hidden" name="theUrl" value="" />\n<input type="hidden" name="theScroll" value="" />\n<div id="card_box_container">\n	<div id="box_1" class="card_box">\n		<table class="card_table">\n		<tr>\n			<td class="cardlbl">\n				First Name:\n			</td>\n			<td class="cardfld">\n				<input type="text" value="';
//line 27 "contact_card_main.tt2"

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

output += stash.get(['contact', 0, 'given', 0]);

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

output += '" size="30" maxlength="100" name="contact_given_';
//line 27 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" class="cardfld" style="width:200px;" />\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl">\n				Last Name:\n			</td>\n			<td class="cardfld">\n				<input type="text" value="';
//line 35 "contact_card_main.tt2"

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

output += stash.get(['contact', 0, 'family', 0]);

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

output += '" size="30" maxlength="100" name="contact_family_';
//line 35 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" class="cardfld" style="width:200px;" />\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl">\n				Middle Name(s):\n			</td>\n			<td class="cardfld">\n				<input type="text" value="';
//line 43 "contact_card_main.tt2"

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

output += stash.get(['contact', 0, 'middle', 0]);

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

output += '" size="30" maxlength="100" name="contact_middle_';
//line 43 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" class="cardfld" style="width:200px;" />\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl">\n				Title (Mr/Mrs):\n			</td>\n			<td class="cardfld">\n				<input type="text" value="';
//line 51 "contact_card_main.tt2"

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

output += stash.get(['contact', 0, 'prefixes', 0]);

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

output += '" size="10" maxlength="100" name="contact_prefixes_';
//line 51 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" class="cardfld" style="width:60px;" />\n				<span style="width:67px;display:inline-block;text-align:right;" >Suffix:</span>\n				<input type="text" value="';
//line 53 "contact_card_main.tt2"

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

output += stash.get(['contact', 0, 'suffixes', 0]);

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

output += '" size="10" maxlength="100" name="contact_suffixes_';
//line 53 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" class="cardfld" style="width:60px;" />\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl">&nbsp;\n			</td>\n			<td class="cardfld">\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl topalign">\n				Phone Numbers:\n			</td>\n			<td class="cardfld">\n				<div id="phoneListDiv" class="contactsCardTable"> <!-- this makes the scrollbars work in safari -->\n				';
//line 68 "contact_card_main.tt2"
output += context.include('contact_card_phone.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'phone\', ';
//line 72 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" >Add</div>\n				<div class="remove link" onclick="delItem(\'phone\'); return false;" >Remove</div>\n			</td>\n		</tr>\n		</table>\n	</div>\n\n	<div id="box_2" class="card_box hidden">\n		<table class="card_table">\n		<tr>\n			<td class="cardlbl topalign">\n				Email Addresses:\n			</td>\n			<td class="cardfld">\n				<div id="emailListDiv" class="contactsCardTable"> <!-- this makes the scrollbars work in safari -->\n				';
//line 87 "contact_card_main.tt2"
output += context.include('contact_card_email.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'email\', ';
//line 91 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" style="margin-top:10px;" >Add</div>\n				<div class="remove link" onclick="delItem(\'email\'); return false;">Remove</div>\n			</td>\n		</tr>\n		<tr>\n			<td class="cardlbl topalign">\n				IM Identities:\n			</td>\n			<td class="cardfld">\n				<div id="imListDiv" class="contactsCardTable"> <!-- this makes the scrollbars work in safari -->\n				';
//line 101 "contact_card_main.tt2"
output += context.include('contact_card_im.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'im\', ';
//line 105 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" style="margin-top:10px;" >Add</div>\n				<div class="remove link" onclick="delItem(\'im\'); return false;">Remove</div>\n			</td>\n		</tr>\n		</table>\n	</div>\n	<div id="box_3" class="card_box hidden">\n		<table class="card_table">\n		<tr>\n			<td class="cardlbl topalign">\n				Addresses:\n			</td>\n			<td class="cardfld">\n				<div id="addressListDiv" class="contactsCardTable Tall"> <!-- this makes the scrollbars work in safari -->\n				';
//line 119 "contact_card_main.tt2"
output += context.include('contact_card_address.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'address\', ';
//line 123 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" style="margin-top:10px;" >Add</div>\n				<div class="remove link" onclick="delItem(\'address\'); return false;">Remove</div>\n			</td>\n		</tr>\n		</table>		\n	</div>\n	<div id="box_4" class="card_box hidden">\n		<table class="card_table">\n		<tr>\n			<td class="cardlbl topalign">\n				Dates:\n			</td>\n			<td class="cardfld">\n				<div id="mydateListDiv" class="contactsCardTable Tall"> <!-- this makes the scrollbars work in safari -->\n				';
//line 137 "contact_card_main.tt2"
output += context.include('contact_card_mydate.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'mydate\', ';
//line 141 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" style="margin-top:10px;" >Add</div>\n				<div class="remove link" onclick="delItem(\'mydate\'); return false;">Remove</div>\n			</td>\n		</tr>\n		</table>\n	</div>\n	<div id="box_5" class="card_box hidden">\n		<table class="card_table">\n		<tr>\n			<td class="cardlbl topalign">\n				Other info:\n			</td>\n			<td class="cardfld">\n				<div id="otherListDiv" class="contactsCardTable Tall"> <!-- this makes the scrollbars work in safari -->\n				';
//line 155 "contact_card_main.tt2"
output += context.include('contact_card_other.tt2');
output += '\n				</div>\n			</td>\n			<td>\n				<div class="add link" onclick="addItem(\'other\', ';
//line 159 "contact_card_main.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += ');" style="margin-top:10px;" >Add</div>\n				<div class="remove link" onclick="delItem(\'other\'); return false;">Remove</div>\n			</td>\n		</tr>\n		</table>\n	</div>\n</div><!-- end card_box_container -->\n</form>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 108 "sms_poll.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "sms_poll.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "sms_poll.tt2"

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

output += stash.get(['smspoll', 0, 'smspolltype', 0]);

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

output += ' Poll</div>\n		&nbsp;\n	</div>\n	\n	<div style="height:20px;"><div id="autosave" style="text-align:right;display: none;"> Auto-saving...</div></div>\n\n<div style="position: relative; width: 500px; display: inline-block; vertical-align: top;">\n<table>\n<tr>\n	<td class="cardlbl">Poll Title:</td>\n	<td class="cardfld"><input type="text" value="';
//line 24 "sms_poll.tt2"

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

output += stash.get(['smspoll', 0, 'title', 0]);

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

output += '" size="50" maxlength="255" id="smspoll_title" name="smspoll_title_';
//line 24 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" class="cardfld pollmsgfield" pre="" suf=":%br%" style="width:367px;" /></td>\n</tr>\n<tr>\n	<td class="cardlbl">Question:</td>\n	<td class="cardfld"><input type="text" value="';
//line 28 "sms_poll.tt2"

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

output += stash.get(['smspoll', 0, 'question', 0]);

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

output += '" size="50" maxlength="255" id="smspoll_question" name="smspoll_question_';
//line 28 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" class="cardfld pollmsgfield" pre="" suf="" style="width:367px;" /></td>\n</tr>\n';
//line 35 "sms_poll.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smspoll', 0, 'answers', 0]);
    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['answer'] = value;
output += '\n<tr>\n	<td class="cardlbl">';
//line 32 "sms_poll.tt2"
if (stash.get(['loop', 0, 'first', 0])) {
output += 'Answers:';
}

output += '</td>\n	<td class="cardfld" style="text-align:right;">';
//line 33 "sms_poll.tt2"
output += stash.get(['answer', 0, 'answerletter', 0]);
output += ') <input type="text" value="';
//line 33 "sms_poll.tt2"

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

output += stash.get(['answer', 0, 'answertext', 0]);

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

output += '" size="50" maxlength="255" name="smspollanswer_answertext_';
//line 33 "sms_poll.tt2"
output += stash.get(['answer', 0, 'id', 0]);
output += '" class="cardfld pollmsgfield" pre="';
//line 33 "sms_poll.tt2"
if (stash.get(['loop', 0, 'first', 0])) {
output += '%br%Reply: ';
}

//line 33 "sms_poll.tt2"
output += stash.get(['answer', 0, 'answerletter', 0]);
output += ') " suf=" " style="width:350px;" /></td>\n</tr>\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';
//line 45 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'headers', 0])) {
output += '\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>Variable text:\n	</td>\n	<td class="cardfld">\n		<div id="customvariables" style="min-height:60px;width:367px;" class="likeinput">';
//line 41 "sms_poll.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smspoll', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '<span class="varclick link" rel="custommessage">%';
//line 41 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%</span> &nbsp; ';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n		<div id="customvariablelengths" style="display:none;">';
//line 42 "sms_poll.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smspoll', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '%';
//line 42 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%:';
//line 42 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'headers', 0, stash.get('id'), 0, 1, 0]);
output += ',';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n	</td>\n</tr>\n';
}

output += '\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input type="text" id="customurl" value="';
//line 49 "sms_poll.tt2"

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

output += stash.get(['smspoll', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="smspoll_url_';
//line 49 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld pollmsgfield" style="width:367px;border:none;color:grey;" pre="%br%" suf="" readonly="readonly">';
//line 56 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'url', 0])) {
//line 55 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'shorturl', 0]);
output += ' \n';
}

//line 56 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 57 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 58 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding: 12px 0;">Recipients:</td>\n	<td class="cardfld"><span class="green bold">';
//line 63 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'recipientcount', 0]);
output += '</span><div style="width:60px;display:inline-block;">&nbsp;</div>';
//line 63 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'gateway_id', 0])) {
output += 'Send via: <span class="green bold">';
//line 63 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'gatewaynumber', 0]);
output += '</span>';
}

output += '<div style="width:60px;display:inline-block;">&nbsp;</div>Cost: <span class="green bold">$';
//line 63 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'cost', 0]);
output += '</span></td>\n</tr>\n<tr>\n	<td class="cardlbl" colspan="2">\n	<input type="radio" id="sendAtRadio0" value="null" name="smspoll_sendat_';
//line 67 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" checked="checked" class="cardfld selectadjust nobd" /> Send Now\n	<div style="width:30px;display:inline-block;">&nbsp;</div>\n	<input type="radio" id="sendAtRadio1" value="1" name="smspoll_sendat_';
//line 69 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" ';
//line 69 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'sendat', 0])) {
output += 'checked="checked"';
}

output += ' class="cardspecial selectadjust nobd" onclick="document.getElementById(\'sendatDate\').focus();" /> \n		';
//line 83 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'is_editable', 0])) {
output += '\n	Send Later: <input type="text" id="sendatDate" value="';
//line 71 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'sendat', 0]);
output += '" size="50" name="smspoll_sendat_';
//line 71 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:90px;" />\n	<select id="sendatTime" class="cardspecial" id="selectreport" name="selectreport" onchange="updateSendat();">\n		';
//line 75 "sms_poll.tt2"

// FOREACH 
(function() {
    var list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];
    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['hour'] = value;
output += '\n  			<option value="';
//line 74 "sms_poll.tt2"
output += stash.get('hour');
output += ':00:00" ';
//line 74 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'sendathour', 0]) == stash.get('hour')) {
output += 'selected="selected"';
}

output += '>';
//line 74 "sms_poll.tt2"
output += stash.get('hour');
output += ':00 am</option>		\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  			<option value="12:00:00" ';
//line 76 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'sendathour', 0]) == 12) {
output += 'selected="selected"';
}

output += '>12:00 pm</option>		\n		';
//line 79 "sms_poll.tt2"

// FOREACH 
(function() {
    var list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];
    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['hour'] = value;
output += '\n  			<option value="';
//line 78 "sms_poll.tt2"
output += stash.get('hour') + 12;
output += ':00:00" ';
//line 78 "sms_poll.tt2"
if ((stash.get(['smspoll', 0, 'sendathour', 0]) - 12) == stash.get('hour')) {
output += 'selected="selected"';
}

output += '>';
//line 78 "sms_poll.tt2"
output += stash.get('hour');
output += ':00 pm</option>		\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	</select>\n		';
}
else {
output += '\n	Sent at: <input type="text" id="sendatDate" value="';
//line 82 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'sendat', 0]);
output += '" size="50" name="smspoll_sendat_';
//line 82 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:180px;" />\n		';
}

output += '\n</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding:18px 0;" colspan="2">\n		';
//line 97 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'is_editable', 0])) {
output += '\n		';
//line 93 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'is_new', 0])) {
output += '\n		<input id="offerdelete" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 90 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'id', 0])) {
output += 'smspollDelete(';
//line 90 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += ', \'cancel\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 92 "sms_poll.tt2"
if (stash.get(['smspoll', 0, 'id', 0])) {
output += 'smspollDelete(';
//line 92 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += ', \'delete\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}

output += '\n		<input id="offersave" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="smspollSave(';
//line 94 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'id', 0]);
output += ', \'sendAtRadio0\', \'custommessage\'); return false;" />\n		';
}
else {
output += '\n		<input id="offersave" value="CLOSE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="closePopup(); return false;" />\n		';
}

output += '\n	</td>\n</tr>\n</table>\n</div>\n\n<div style="position: relative; width: 280px; display: inline-block; vertical-align: top;">\nPreview: <span id="custommessageCount" style="color: green;">0/160</span>\n<textarea id="custommessage" rows="10" cols="50" class="" style="width:267px;color:grey;" readonly="readonly">';
//line 105 "sms_poll.tt2"
output += stash.get(['smspoll', 0, 'message', 0]);
output += '</textarea></div>\n\n</div>\n';
}

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

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable Tall">\n<thead>\n	<tr>\n		<th>Label</th>\n		<th></th>\n		<th style="width:198px;">Address</th>\n	</tr>\n</thead>\n<tbody id="addressList" class="contactsCardTableAddress Tall">\n';
//line 42 "contact_card_address.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'addresses', 0]);
    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['address'] = value;
output += '\n<tr id="address_street_';
//line 11 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n	<td class="nobdb"><span id="address_label_';
//line 12 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" class="lblpop cardfld">';
//line 12 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobdb grey">Street</td>\n	<td class="nobdb"><input type="textarea" value="';
//line 14 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'street', 0]);

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

output += '" size="30" name="address_street_';
//line 14 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" />\n	';
//line 15 "contact_card_address.tt2"
if (stash.get(['address', 0, 'pobox', 0])) {
//line 15 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'pobox', 0]);

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

output += '<br></br>';
}

output += '\n	</td>\n</tr>\n<tr id="address_city_';
//line 18 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n	<td class="nobdb"></td>\n	<td class="nobdb grey">City</td>\n	<td class="nobdb"><input type="text" value="';
//line 21 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'city', 0]);

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

output += '" size="30" name="address_city_';
//line 21 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" />\n	</td>\n</tr>\n<tr id="address_region_';
//line 24 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n	<td class="nobdb"></td>\n	<td class="nobdb grey">State/County</td>\n	<td class="nobdb"><input type="text" value="';
//line 27 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'region', 0]);

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

output += '" size="30" name="address_region_';
//line 27 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" />\n	</td>\n</tr>\n<tr id="address_postalcode_';
//line 30 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n	<td class="nobdb"></td>\n	<td class="nobdb grey">Zip/Post code</td>\n	<td class="nobdb"><input type="text" value="';
//line 33 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'postalcode', 0]);

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

output += '" size="30" name="address_postalcode_';
//line 33 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" />\n	</td>\n</tr>\n<tr id="address_country_';
//line 36 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n	<td class="nobd"></td>\n	<td class="nobd grey">Country</td>\n	<td class="nobd"><input type="text" value="';
//line 39 "contact_card_address.tt2"

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

output += stash.get(['address', 0, 'country', 0]);

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

output += '" size="30" name="address_country_';
//line 39 "contact_card_address.tt2"
output += stash.get(['address', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" />\n	</td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 117 "sms_alert.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "sms_alert.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n';
//line 12 "sms_alert.tt2"
stash.set('hour', '');
//line 12 "sms_alert.tt2"
stash.set('min', '');
//line 12 "sms_alert.tt2"
stash.set('am', 1);
output += '\n';
//line 13 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0]) != '') {
//line 13 "sms_alert.tt2"
stash.set('bits', stash.get(['smsoffer', 0, 'sendat', 0, 'split', [ '[ :]' ]]));
//line 13 "sms_alert.tt2"
stash.set('hour', stash.get(['bits', 0, 1, 0]));
//line 13 "sms_alert.tt2"
stash.set('min', stash.get(['bits', 0, 2, 0]));
//line 13 "sms_alert.tt2"
stash.set('am', stash.get('hour') < 12 ? 1 : 0);
}

output += '\n';
//line 14 "sms_alert.tt2"
if (stash.get('hour') > 12) {
//line 14 "sms_alert.tt2"
stash.set('hour', stash.get('hour') - 12);
}

output += '\n';
//line 15 "sms_alert.tt2"
if (stash.get('hour') != '' && stash.get('hour') == 0) {
//line 15 "sms_alert.tt2"
stash.set('hour', 12);
}

output += '\n';
//line 16 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'phonegroup', 0]) == 1) {
//line 16 "sms_alert.tt2"
stash.set('offerOrAlert', 'alert');
}
else {
//line 16 "sms_alert.tt2"
stash.set('offerOrAlert', 'offer');
}

output += '\n\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">SMS ';
//line 20 "sms_alert.tt2"

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

output += stash.get('offerOrAlert');

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

output += '</div>\n		&nbsp;\n	</div>\n	\n	<div style="height:20px;"><div id="autosave" style="text-align:right;display: none;"> Auto-saving...</div></div>\n\n<div style="position: relative; width: 500px; display: inline-block; vertical-align: top;">\n<table>\n<tr>\n	<td class="cardlbl">';
//line 29 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'phonegroup', 0]) == 0) {
output += 'O-CODE:';
}
else {
output += 'Phone group:';
}

output += '</td>\n	<td class="cardfld">';
//line 30 "sms_alert.tt2"

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

output += stash.get(['smsoffer', 0, 'codename', 0]);

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

output += '</td>\n</tr>\n<tr>\n	<td class="cardlbl">';
//line 33 "sms_alert.tt2"

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

output += stash.get('offerOrAlert');

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

output += ' Title:</td>\n	<td class="cardfld"><input type="text" value="';
//line 34 "sms_alert.tt2"

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

output += stash.get(['smsoffer', 0, 'title', 0]);

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

output += '" size="50" maxlength="255" name="smsoffer_title_';
//line 34 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" /></td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>SMS:</p>\n		<span id="custommessageCount" style="color: green;">0/160</span>\n	</td>\n	<td class="cardfld">\n		<textarea id="custommessage" name="smsoffer_message_';
//line 41 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" rows="4" cols="50" class="cardfld" style="width:367px;">';
//line 41 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'message', 0]);
output += '</textarea>\n	</td>\n</tr>\n';
//line 53 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'headers', 0])) {
output += '\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>Variable text:\n	</td>\n	<td class="cardfld">\n		<div id="customvariables" style="min-height:60px;width:367px;" class="likeinput">';
//line 49 "sms_alert.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '<span class="varclick link" rel="custommessage">%';
//line 49 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%</span> &nbsp; ';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n		<div id="customvariablelengths" style="display:none;">';
//line 50 "sms_alert.tt2"

// FOREACH 
(function() {
    var list = stash.get(['smsoffer', 0, 'headers', 0, 'keys', 0, 'sort', 0]);
    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['id'] = value;
output += '%';
//line 50 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 0, 0]);
output += '%:';
//line 50 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'headers', 0, stash.get('id'), 0, 1, 0]);
output += ',';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '</div>\n	</td>\n</tr>\n';
}

output += '\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input type="text" id="customurl" value="';
//line 57 "sms_alert.tt2"

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

output += stash.get(['smsoffer', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="smsoffer_url_';
//line 57 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld" style="width:367px;border:none;color:grey;" readonly="readonly">';
//line 64 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'url', 0])) {
//line 63 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += ' \n';
}

//line 64 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 65 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 66 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding: 12px 0;">Recipients:</td>\n	<td class="cardfld"><span class="green bold">';
//line 71 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'recipientcount', 0]);
output += '</span><div style="width:60px;display:inline-block;">&nbsp;</div>';
//line 71 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'gateway_id', 0])) {
output += 'Send via: <span class="green bold">';
//line 71 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'gatewaynumber', 0]);
output += '</span>';
}

output += '<div style="width:60px;display:inline-block;">&nbsp;</div>Cost: <span class="green bold">$';
//line 71 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'cost', 0]);
output += '</span></td>\n</tr>\n<tr>\n	<td class="cardlbl" colspan="2">\n	<input type="radio" id="sendAtRadio0" value="null" name="smsoffer_sendat_';
//line 75 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" checked="checked" class="cardfld selectadjust nobd" /> Send Now\n	<div style="width:30px;display:inline-block;">&nbsp;</div>\n	<input type="radio" id="sendAtRadio1" value="1" name="smsoffer_sendat_';
//line 77 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" ';
//line 77 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'sendat', 0])) {
output += 'checked="checked"';
}

output += ' class="cardspecial selectadjust nobd" onclick="document.getElementById(\'sendatDate\').focus();" /> \n		';
//line 91 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n	Send Later: <input type="text" id="sendatDate" value="';
//line 79 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 79 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:90px;" />\n\n	@ <input type="text" id="sendatHour" value="';
//line 81 "sms_alert.tt2"
output += stash.get('hour');
output += '" size="50" name="smsoffer_sendat_';
//line 81 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" /> :\n	<input type="text" id="sendatMin" value="';
//line 82 "sms_alert.tt2"
output += stash.get('min');
output += '" size="50" name="smsoffer_sendat_';
//line 82 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:20px;" />\n	<select id="sendatAm" class="cardspecial" id="selectAm" name="selectAm" onchange="updateSendat();">\n		<option value="am" ';
//line 84 "sms_alert.tt2"
if (stash.get('am') == 1) {
output += 'selected="selected"';
}

output += '>am</option>		\n		<option value="pm" ';
//line 85 "sms_alert.tt2"
if (stash.get('am') == 0) {
output += 'selected="selected"';
}

output += '>pm</option>		\n	</select>\n\n	<span id="alerttz"></span>\n		';
}
else {
output += '\n	Sent at: <input type="text" id="sendatDate" value="';
//line 90 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'sendat', 0]);
output += '" size="50" name="smsoffer_sendat_';
//line 90 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += '" class="cardspecial" onfocus="document.getElementById(\'sendAtRadio1\').checked = true;" onchange="updateSendat();" style="width:180px;" />\n		';
}

output += '\n</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="padding:18px 0;" colspan="2">\n		';
//line 106 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'is_editable', 0])) {
output += '\n		';
//line 101 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'is_new', 0])) {
output += '\n		<input id="offerdelete" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 98 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 98 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'cancel\', \'';
//line 98 "sms_alert.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 100 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 100 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'';
//line 100 "sms_alert.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		';
}

output += '\n		<input id="offersave" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="smsofferSave(';
//line 102 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'sendAtRadio0\', \'custommessage\', \'';
//line 102 "sms_alert.tt2"
output += stash.get('offerOrAlert');
output += '\'); return false;" />\n		';
}
else {
output += '\n		<input id="offerdelete" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;" onclick="';
//line 104 "sms_alert.tt2"
if (stash.get(['smsoffer', 0, 'id', 0])) {
output += 'smsofferDelete(';
//line 104 "sms_alert.tt2"
output += stash.get(['smsoffer', 0, 'id', 0]);
output += ', \'delete\', \'';
//line 104 "sms_alert.tt2"
output += stash.get('offerOrAlert');
output += '\')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n		<input id="offersave" value="CLOSE" type="submit" class="button_link WhiteOnGreen" style="margin:0 0 2px 0;" onclick="closePopup(); return false;" />\n		';
}

output += '\n	</td>\n</tr>\n</table>\n</div>\n\n<div style="position: relative; width: 280px; display: inline-block; vertical-align: top;">\nPreview: <span id="custommessageCount" style="color: green;">0/160</span>\n<textarea id="custommessage" rows="10" cols="50" class="" style="width:267px;color:grey;" readonly="readonly">';
//line 114 "sms_alert.tt2"
output += stash.get(['smspoll', 0, 'message', 0]);
output += '</textarea></div>\n\n</div>\n';
}

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

    return output;
}

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

    try {
//line 3 "edit_address.tt2"
if (stash.get('error')) {
output += '\n <p class="error">';
//line 2 "edit_address.tt2"
output += stash.get('error');
output += '</p>\n';
}

output += '\n';
//line 70 "edit_address.tt2"
if (stash.get('view_only')) {
output += '\n<b>';
//line 5 "edit_address.tt2"

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

output += stash.get(['address', 0, 'location', 0]);

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

output += '</b>\n<a href="';
//line 1 "edit_address.tt2"
output += stash.get(['c', 0, 'uri_for', [ '/address/edit/' + stash.get(['address', 0, 'id', 0]) ]]);
output += '"\n   onclick="show_address_edit_form(';
//line 7 "edit_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '); return false;">Edit</a>\n<a href="';
//line 1 "edit_address.tt2"
output += stash.get(['c', 0, 'uri_for', [ '/address/delete/' + stash.get(['address', 0, 'id', 0]) ]]);
output += '">Delete</a>\n<br />\n<div class="address" id="address_';
//line 10 "edit_address.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n  <address>\n	';
//line 12 "edit_address.tt2"

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

output += stash.get(['address', 0, 'label', 0]);

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

output += '\n	';
//line 13 "edit_address.tt2"
if (stash.get(['address', 0, 'pobox', 0])) {
//line 13 "edit_address.tt2"

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

output += stash.get(['address', 0, 'pobox', 0]);

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

output += '<br />';
}

output += '\n		';
//line 14 "edit_address.tt2"
if (stash.get(['address', 0, 'street', 0])) {
//line 14 "edit_address.tt2"

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

output += stash.get(['address', 0, 'street', 0]);

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

output += '<br />';
}

output += '\n		';
//line 15 "edit_address.tt2"
if (stash.get(['address', 0, 'city', 0])) {
//line 15 "edit_address.tt2"

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

output += stash.get(['address', 0, 'city', 0]);

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

output += '<br />';
}

output += '\n		';
//line 16 "edit_address.tt2"
if (stash.get(['address', 0, 'region', 0])) {
//line 16 "edit_address.tt2"

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

output += stash.get(['address', 0, 'region', 0]);

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

output += '<br />';
}

output += '\n		';
//line 17 "edit_address.tt2"
if (stash.get(['address', 0, 'postalcode', 0])) {
//line 17 "edit_address.tt2"

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

output += stash.get(['address', 0, 'postalcode', 0]);

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

output += '<br />';
}

output += '\n		';
//line 18 "edit_address.tt2"
if (stash.get(['address', 0, 'country', 0])) {
//line 18 "edit_address.tt2"

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

output += stash.get(['address', 0, 'country', 0]);

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

}

output += '</address>\n</div>\n';
}
else {
output += '\n\n<!-- Generated by CGI::FormBuilder v3.0501 available from www.formbuilder.org -->\n<form action="';
//line 23 "edit_address.tt2"
output += stash.get(['address', 0, 'uri_for', 0]);
output += '" id="address_edit" method="post" name="address_edit" onsubmit="return validate_address_edit(this);">\n<div id="address_edit_state"><input id="_submitted_address_edit" name="_submitted_address_edit" type="hidden" value="1" /></div>\n<table id="address_edit_body">\n<tr id="address_edit_label_row" valign="top">\n  <td id="address_edit_label_label"><b>Label</b></td>\n  <td id="address_edit_label_field"><select id="label" name="label" onchange="if (this.selectedIndex + 1 == this.options.length) { fb_other_on(\'_other_label\') } else { fb_other_off(\'_other_label\') }">\n  <option value="">-select-</option>\n  <option selected="selected" value="Home">Home</option>\n  <option value="Work">Work</option>\n\n  <option value="Mobile">Mobile</option>\n  <option value="_other_label">Other:</option>\n  </select> <input disabled="disabled" id="_other_label" name="_other_label" type="text" /></td>\n</tr>\n<tr id="address_edit_pobox_row" valign="top">\n  <td id="address_edit_pobox_label">PO Box</td>\n  <td id="address_edit_pobox_field"><input id="pobox" name="pobox" size="20" type="text" /></td>\n</tr>\n\n<tr id="address_edit_street_row" valign="top">\n  <td id="address_edit_street_label">Street</td>\n  <td id="address_edit_street_field"><textarea cols="60" id="street" name="street" rows="3">';
//line 44 "edit_address.tt2"

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

output += stash.get(['address', 0, 'street', 0]);

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

output += '</textarea></td>\n</tr>\n<tr id="address_edit_city_row" valign="top">\n  <td id="address_edit_city_label">City</td>\n  <td id="address_edit_city_field"><input id="city" name="city" size="50" type="text" value="';
//line 48 "edit_address.tt2"

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

output += stash.get(['address', 0, 'city', 0]);

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

output += '" /></td>\n</tr>\n<tr id="address_edit_region_row" valign="top">\n  <td id="address_edit_region_label">State/County</td>\n\n  <td id="address_edit_region_field"><input id="region" name="region" size="50" type="text" value="" /></td>\n</tr>\n<tr id="address_edit_postalcode_row" valign="top">\n  <td id="address_edit_postalcode_label">Zip/Postal Code</td>\n  <td id="address_edit_postalcode_field"><input id="postalcode" name="postalcode" size="10" type="text" value="';
//line 57 "edit_address.tt2"

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

output += stash.get(['address', 0, 'postalcode', 0]);

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

output += '" /></td>\n</tr>\n<tr id="address_edit_country_row" valign="top">\n  <td id="address_edit_country_label">Country</td>\n  <td id="address_edit_country_field"><input id="country" name="country" size="8" type="text" value="';
//line 61 "edit_address.tt2"

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

output += stash.get(['address', 0, 'country', 0]);

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

output += '" /></td>\n</tr>\n\n<tr id="address_edit_submit_row" valign="top">\n  <td align="center" colspan="2" id="address_edit_submit_field"><input id="address_edit_submit" name="_submit" type="submit" value="Submit" /></td>\n</tr>\n</table>\n</form>\n\n';
}

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

    return output;
}

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

    try {
output += '<table class="contact contactsCardTable">\n<thead>\n	<tr>\n		<th style="width: 26px;">Main</th>\n		<th style="width: 77px;">Label</th>\n		<th style="width:168px;">Address</th>\n	</tr>\n</thead>\n<tbody id="emailList" class="contactsCardTableBody">\n';
//line 16 "contact_card_email.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'emails', 0]);
    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['email'] = value;
output += '\n<tr>\n	<td class="nobd"><input type="radio" name="email_pref_a" value="';
//line 12 "contact_card_email.tt2"
output += stash.get(['email', 0, 'id', 0]);
output += '" class="cardfld nobd hilite" ';
//line 12 "contact_card_email.tt2"
if (stash.get(['email', 0, 'pref', 0]) == 1) {
output += 'checked="checked" ';
}

output += '/></td>\n	<td class="nobd"><span id="email_label_';
//line 13 "contact_card_email.tt2"
output += stash.get(['email', 0, 'id', 0]);
output += '" class="lblpop cardfld">';
//line 13 "contact_card_email.tt2"

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

output += stash.get(['email', 0, 'label', 0]);

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

output += '</span></td>\n	<td class="nobd"><input type="text" value="';
//line 14 "contact_card_email.tt2"

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

output += stash.get(['email', 0, 'email', 0]);

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

output += '" size="25" name="email_email_';
//line 14 "contact_card_email.tt2"
output += stash.get(['email', 0, 'id', 0]);
output += '" maxlength="100" class="cardfld hilite" style="border: none;" /></td>\n</tr>\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<tr style="height:auto;border-bottom:none;">\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n	<td class="nobd" style="height:auto;border-bottom:none;"></td>\n</tr>\n</tbody>\n</table>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
//line 25 "pager.tt2"
if (stash.get('pager')) {
output += '\n<div class="pager largeText">\n	Page ';
//line 3 "pager.tt2"
output += stash.get(['pager', 0, 'current_page', 0]);
output += ' of ';
//line 3 "pager.tt2"
output += stash.get(['pager', 0, 'last_page', 0]);
output += '\n	<div style="width:20px;display:inline-block;">&nbsp;</div>\n   ';
//line 8 "pager.tt2"
if (stash.get(['pager', 0, 'previous_page', 0])) {
output += '\n	   <span class="link" onclick="';
//line 6 "pager.tt2"
output += stash.get('funcname');
output += '(';
//line 6 "pager.tt2"
if (stash.get('funcparams')) {
//line 6 "pager.tt2"
output += stash.get('funcparams');
output += ', ';
}

//line 6 "pager.tt2"
output += stash.get(['pager', 0, 'first_page', 0]);
output += '); return false;">|&lt;&nbsp;</span>\n	   <span class="link" onclick="';
//line 7 "pager.tt2"
output += stash.get('funcname');
output += '(';
//line 7 "pager.tt2"
if (stash.get('funcparams')) {
//line 7 "pager.tt2"
output += stash.get('funcparams');
output += ', ';
}

//line 7 "pager.tt2"
output += stash.get(['pager', 0, 'previous_page', 0]);
output += '); return false;">&lt;&nbsp;</span>\n   ';
}

output += '\n\n   ';
//line 18 "pager.tt2"

// FOREACH 
(function() {
    var list = stash.get(['pager', 0, 'page_list', 0]);
    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['page'] = value;
output += '\n	   ';
//line 11 "pager.tt2"
if (stash.get(['pager', 0, 'last_page', 0]) == 1) {
break;
}

output += '\n	   ';
//line 12 "pager.tt2"
if (stash.get(['loop', 0, 'count', 0]) > 7) {
break;
}

output += '\n	   ';
//line 17 "pager.tt2"
if (stash.get(['pager', 0, 'current_page', 0]) == stash.get('page')) {
output += '\n		   <span class="current"> ';
//line 14 "pager.tt2"
output += stash.get('page');
output += ' </span>\n	   ';
}
else {
output += '\n		   <span class="link" onclick="';
//line 16 "pager.tt2"
output += stash.get('funcname');
output += '(';
//line 16 "pager.tt2"
if (stash.get('funcparams')) {
//line 16 "pager.tt2"
output += stash.get('funcparams');
output += ', ';
}

//line 16 "pager.tt2"
output += stash.get('page');
output += '); return false;">';
//line 16 "pager.tt2"
output += stash.get('page');
output += '</span>\n	   ';
}

output += '\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\n   ';
//line 23 "pager.tt2"
if (stash.get(['pager', 0, 'next_page', 0])) {
output += '\n	   <span class="link" onclick="';
//line 21 "pager.tt2"
output += stash.get('funcname');
output += '(';
//line 21 "pager.tt2"
if (stash.get('funcparams')) {
//line 21 "pager.tt2"
output += stash.get('funcparams');
output += ', ';
}

//line 21 "pager.tt2"
output += stash.get(['pager', 0, 'next_page', 0]);
output += '); return false;">&nbsp;&gt;</span>\n	   <span class="link" onclick="';
//line 22 "pager.tt2"
output += stash.get('funcname');
output += '(';
//line 22 "pager.tt2"
if (stash.get('funcparams')) {
//line 22 "pager.tt2"
output += stash.get('funcparams');
output += ', ';
}

//line 22 "pager.tt2"
output += stash.get(['pager', 0, 'last_page', 0]);
output += '); return false;">&nbsp;&gt;|</span>\n   ';
}

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

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

    return output;
}

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

    try {

output += '\n';
//line 112 "edit_contact.tt2"
if (stash.get('error')) {
output += '\n<div id="contactLayer">\n<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n<div style="float:left;">An error occurred</div>\n<div style="float:right;"><a href="javascript:close_contact()">[X]</a></div>\n&nbsp;\n</div>\n';
//line 9 "edit_contact.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="contactLayer">\n<div class="bar" onmousedown="dragStart(event, \'contactShadow\')">\n<div style="float:left;">';
//line 14 "edit_contact.tt2"

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

output += stash.get(['contact', 0, 'name', 0]);

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

output += '</div>\n<div style="float:right;">\n<a href="';
//line 16 "edit_contact.tt2"
output += stash.get(['contact', 0, 'baseUrl', 0]);
output += 'contact/view/';
//line 16 "edit_contact.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" onclick="view_contact(';
//line 16 "edit_contact.tt2"

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

output += stash.get(['contact', 0, 'id', 0]);

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

output += '); return false;">[ cancel ]</a>\n<a href="';
//line 17 "edit_contact.tt2"
output += stash.get(['contact', 0, 'baseUrl', 0]);
output += 'contact/view/';
//line 17 "edit_contact.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '" onclick="save_contact(';
//line 17 "edit_contact.tt2"

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

output += stash.get(['contact', 0, 'id', 0]);

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

output += '); return false;">[ save ]</a>\n</div>\n&nbsp;\n</div>\n\n<div id="tab_container">\n	<div id="tab_1" class="tabbed_pane_tab selected_tab" style="width: 100px;" onclick="do_select(\'1\');">Name &amp; Phones</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_2" class="tabbed_pane_tab" onclick="do_select(\'2\');">Email &amp; IM</div>\n	<div class="tabbed_pane_tab tab_spacer"></div>\n	<div id="tab_3" class="tabbed_pane_tab" onclick="do_select(\'3\');">Addresses</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_4" class="tabbed_pane_tab" onclick="do_select(\'4\');">Dates</div>\n	<div class="tabbed_pane_tab tab_spacer">&nbsp;</div>\n	<div id="tab_5" class="tabbed_pane_tab" onclick="do_select(\'5\');">Other</div>\n</div>\n\n<form name="editContact" method="post" action="';
//line 34 "edit_contact.tt2"
output += stash.get(['contact', 0, 'baseUrl', 0]);
output += 'contact/save/';
//line 34 "edit_contact.tt2"
output += stash.get(['contact', 0, 'id', 0]);
output += '">\n<input type="hidden" name="theUrl" value="" />\n<input type="hidden" name="theScroll" value="" />\n<div id="card_box_container">\n	<div id="box_1" class="card_box">\n		<table border="0" cellspacing="5" id="contactTable">\n		<tr>\n			<th></th>\n			<th>\n				<input type="text" value="';
//line 43 "edit_contact.tt2"

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

output += stash.get(['contact', 0, 'given', 0]);

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

output += '" size="30" name="given" maxlength="100" id="given" />\n				<input type="text" value="';
//line 44 "edit_contact.tt2"

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

output += stash.get(['contact', 0, 'family', 0]);

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

output += '" size="30" name="family" maxlength="100" id="family" />\n			</th>\n		</tr>\n		';
//line 53 "edit_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'phones', 0]);
    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['phone'] = value;
output += '\n		<tr>\n			<td>';
//line 49 "edit_contact.tt2"

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

output += stash.get(['phone', 0, 'label', 0]);

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

output += '</td>\n			<td><input type="text" value="';
//line 50 "edit_contact.tt2"

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

output += stash.get(['phone', 0, 'phone', 0]);

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

output += '" size="30" name="phone_';
//line 50 "edit_contact.tt2"

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

output += stash.get(['phone', 0, 'id', 0]);

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

output += '" maxlength="100" /></td>\n			<td class="link" onclick="Dom.remove(parentNode); return false;">delete</td>\n		</tr>\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		<tr>\n			<td></td>\n			<td></td>\n			<td class="link" onclick="addElement(\'contactTable\');">add phone</td>\n		</tr>\n		</table>\n	</div>\n\n	<div id="box_2" class="card_box hidden">\n		<table border="0" cellspacing="5">\n		';
//line 70 "edit_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'emails', 0]);
    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['email'] = value;
output += '\n		<tr>\n			<td>';
//line 66 "edit_contact.tt2"

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

output += stash.get(['email', 0, 'label', 0]);

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

output += '</td>\n			<td><input type="text" value="';
//line 67 "edit_contact.tt2"

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

output += stash.get(['email', 0, 'email', 0]);

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

output += '" size="30" name="email_';
//line 67 "edit_contact.tt2"
output += stash.get(['email', 0, 'id', 0]);
output += '" maxlength="100" /></td>\n			<td class="link" onclick="Dom.remove(parentNode); return false;">delete</td>\n		</tr>\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		<tr>\n			<td></td>\n			<td></td>\n			<td class="link" onclick="addElement(\'contactTable\');">add email</td>\n		</tr>\n		</table>\n	</div>\n	<div id="box_3" class="card_box hidden">\n		';
//line 91 "edit_contact.tt2"

// FOREACH 
(function() {
    var list = stash.get(['contact', 0, 'addresses', 0]);
    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['address'] = value;
output += '\n		<div class="address" id="address_';
//line 80 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'id', 0]);

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

output += '">\n		  <address>\n			';
//line 82 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'label', 0]);

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

output += '\n			';
//line 83 "edit_contact.tt2"
if (stash.get(['address', 0, 'pobox', 0])) {
//line 83 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'pobox', 0]);

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

output += '<br></br>';
}

output += '\n				';
//line 84 "edit_contact.tt2"
if (stash.get(['address', 0, 'street', 0])) {
//line 84 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'street', 0]);

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

output += '<br />';
}

output += '\n				';
//line 85 "edit_contact.tt2"
if (stash.get(['address', 0, 'city', 0])) {
//line 85 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'city', 0]);

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

output += '<br />';
}

output += '\n				';
//line 86 "edit_contact.tt2"
if (stash.get(['address', 0, 'region', 0])) {
//line 86 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'region', 0]);

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

output += '<br />';
}

output += '\n				';
//line 87 "edit_contact.tt2"
if (stash.get(['address', 0, 'postalcode', 0])) {
//line 87 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'postalcode', 0]);

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

output += '<br />';
}

output += '\n				';
//line 88 "edit_contact.tt2"
if (stash.get(['address', 0, 'country', 0])) {
//line 88 "edit_contact.tt2"

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

output += stash.get(['address', 0, 'country', 0]);

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

}

output += '\n		  </address>\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	</div>\n	<div id="box_4" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n		</table>\n	</div>\n	<div id="box_5" class="card_box hidden">\n		<table border="0" cellspacing="5">\n			<tr>\n				<th></th>\n				<th></th>\n			</tr>\n		</table>\n	</div>\n</div><!-- end card_box_container -->\n</form>\n</div>\n';
}

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

    return output;
}

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

    try {
//line 29 "code_custom.tt2"
if (stash.get('error_msg')) {
output += ' \n<span class="error">';
//line 2 "code_custom.tt2"
output += stash.get('error_msg');
output += '</span>\n';
}
else {
output += '\n';
//line 28 "code_custom.tt2"
if (stash.get('confirmed') == 1) {
output += '\n<b>SUCCESS! Your new O-CODE is: "';
//line 5 "code_custom.tt2"
output += stash.get('code');
output += '".</b><br />\n';
}
else {
output += '\n<b>SUCCESS! The O-CODE "';
//line 7 "code_custom.tt2"
output += stash.get('code');
output += '" is available.</b><br />\n';
//line 27 "code_custom.tt2"
if (stash.get('paid') == 1) {
output += '\n	<a href="" onclick="code_confirm(\'custom\'); return false;">Click here</a> to confirm this as your new o-code.\n';
}
else {
output += '\n	<form action="';
//line 11 "code_custom.tt2"
output += stash.get('paypal_url');
output += '" method="post">\n	<input type="hidden" name="business" value="';
//line 12 "code_custom.tt2"
output += stash.get('business');
output += '" />\n\n	<p style="margin-top:0px;margin-bottom:8px;">\n	<a href="codehelp"><img src="';
//line 15 "code_custom.tt2"
output += stash.get(['c', 0, 'uri_for', [ '/' ]]);
output += 'static/images/info.png" style="margin-left:-24px;margin-bottom:-4px;" alt="Help?" /></a>\n\n	';
//line 19 "code_custom.tt2"

// FOREACH 
(function() {
    var list = stash.get(['button_OC1', 0, 'keys', 0]);
    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['key'] = value;
output += '\n	<input type="hidden" name="';
//line 18 "code_custom.tt2"
output += stash.get('key');
output += '" value="';
//line 18 "code_custom.tt2"
output += stash.get(['button_OC1', 0, stash.get('key'), 0]);
output += '" />\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	\n	<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - buy now" \n		style="border:0px;margin:4px 2px -8px -4px;padding:0px;" />\n	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">\n	Custom code price: <b>US $';
//line 24 "code_custom.tt2"
output += stash.get(['button_OC1', 0, 'amount', 0]);
output += '</b>\n	</p>\n	</form>\n';
}

output += '\n';
}

output += '\n';
}

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

    return output;
}

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

    try {
//line 1 "concierge_table.tt2"
output += context.process('pager.tt2');
output += '\n\n<div id="contacts">\n<table id="contactsTable" class="contact">\n<thead>\n<tr>\n<th style="width:80px;height: 22px;">Phone</th>\n<th style="width:90px;">Name</th>\n<th style="width:150px;">Last message time</th>\n<th class="bt">Last message</th>\n<th class="bt">Notes</th>\n<th class="nobd" style="width:30px;">Texts</th>\n</tr>\n</thead>\n<tbody id="contactsTableBody">\n';

//line 27 "concierge_table.tt2"

// FOREACH 
(function() {
    var list = stash.get('rows');
    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['row'] = value;
//line 18 "concierge_table.tt2"
if (stash.get(['anchors', 0, stash.get(['row', 0, 'id', 0]), 0]) != '') {
output += '<tr><td>';
//line 18 "concierge_table.tt2"
output += stash.get(['anchors', 0, stash.get(['row', 0, 'id', 0]), 0]);
output += '</td><td /><td /><td /><td /><td class="nobd" /></tr>';
}

output += '<tr>\n	<td><span onclick="conciergeIM(';
//line 20 "concierge_table.tt2"
output += stash.get(['row', 0, 'gateway_id', 0]);
output += ', ';
//line 20 "concierge_table.tt2"
output += stash.get(['row', 0, 'phone', 0]);
output += ', 0); return false;" class="link">';
//line 20 "concierge_table.tt2"

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

output += stash.get(['row', 0, 'phone', 0]);

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

output += '</span></td>\n	<td>';
//line 21 "concierge_table.tt2"
output += stash.get(['row', 0, 'contact', 0, 'given', 0]);
output += ' ';
//line 21 "concierge_table.tt2"
output += stash.get(['row', 0, 'contact', 0, 'family', 0]);
output += '</td>\n	<td class="jsdate">';
//line 22 "concierge_table.tt2"
output += stash.get(['row', 0, 'updated', 0]);
output += '</td>\n	<td class="bt ';
//line 23 "concierge_table.tt2"
if (stash.get(['row', 0, 'responded', 0]) == 1) {
output += 'green';
}
else {
output += 'red';
}

output += '" >';
//line 23 "concierge_table.tt2"

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

output += stash.get(['row', 0, 'lastmessage', 0]);

    return context.filter(output, 'replace', [ 'null', '' ]);
})();

output += '</td>\n	<td class="bt">';
//line 24 "concierge_table.tt2"

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

output += stash.get(['row', 0, 'lastnote', 0]);

    return context.filter(output, 'replace', [ 'null', '' ]);
})();

output += '</td>\n	<td class="nobd">';
//line 25 "concierge_table.tt2"
output += stash.get(['row', 0, 'texts', 0]);
output += '</td>\n </tr>\n';;
            retval = list.get_next();
            value = retval[0];
            done = retval[1];
        }
    }
    catch(e) {
        throw(context.set_error(e, output));
    }
    stash.set('loop', oldloop);
})();

output += '<tr style="height:auto;border-bottom:none;" class="alwaysDisplay">\n	<td style="height:auto;border-bottom:none;">';
//line 29 "concierge_table.tt2"
output += stash.get('finalanchors');
output += '</td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td class="nobd" style="height:auto;border-bottom:none;"> </td>\n</tr>\n</tbody>\n</table>\n</div>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {
output += '<div id="codeLayer">\n	<div class="bigbar h2fontsize" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:right;"><a href="javascript:close_report_code()">[X]</a></div>\n		<div id="cardName">Code Details for <span class="bodycolor">';
//line 4 "codereport.tt2"
output += stash.get('code');
output += '</span></div>\n	</div>\n\n<div class="largeText" style="float:right;margin-right:10px;"><a href="/business/codereport/';
//line 7 "codereport.tt2"
output += stash.get('funcparams');
output += '?csv=1">Download report as .csv</a></div>\n';
//line 8 "codereport.tt2"
output += context.process('pager.tt2');
output += '\n\n<p />\n<div class="borderbox">\n<table class="report">\n<thead>\n<tr>\n<th style="height: 22px;width:80px;">Mobile #</th>\n<th style="width:120px;">Date/time</th>\n<th style="width:80px;">Location</th>\n<th style="width:86px;">Carrier</th>\n<th style="width:60px;">Share</th>\n<th class="nobd">Comment</th>\n</tr>\n</thead>\n<tbody id="contactsTableBody">';
//line 37 "codereport.tt2"

// FOREACH 
(function() {
    var list = stash.get('shares');
    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['share'] = value;
output += '<tr>\n	<td>';
//line 26 "codereport.tt2"
output += stash.get(['share', 0, 'userphone', 0, 'phone', 0]);
output += '</td>\n	<td class="jsdate2">';
//line 27 "codereport.tt2"
output += stash.get(['share', 0, 'shared', 0]);
output += '</td>\n	<td>';
//line 28 "codereport.tt2"

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

output += stash.get(['share', 0, 'userphone', 0, 'location', 0]);

    return context.filter(output, 'replace', [ 'null', '' ]);
})();

output += '</td>\n	<td>';
//line 29 "codereport.tt2"

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

output += stash.get(['share', 0, 'userphone', 0, 'carrier', 0]);

    return context.filter(output, 'replace', [ 'null', '' ]);
})();

output += '</td>\n	<td>\n		';
//line 31 "codereport.tt2"
if (stash.get(['share', 0, 'thirdpartysite_id', 0]) == 1 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 3 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 5 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 7) {
output += '<img src="/static/images/FacebookShare16.png" alt="Facebook" height="16" width="16" />';
}

output += '\n		';
//line 32 "codereport.tt2"
if (stash.get(['share', 0, 'thirdpartysite_id', 0]) == 2 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 3 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 6 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 7) {
output += '<img src="/static/images/EvernoteShare16.jpg" alt="Evernote" height="16" width="16" />';
}

output += '\n		';
//line 33 "codereport.tt2"
if (stash.get(['share', 0, 'thirdpartysite_id', 0, 'binary_and', 0]) == 4 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 5 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 6 || stash.get(['share', 0, 'thirdpartysite_id', 0]) == 7) {
output += '<img src="/static/images/TwitterShare16.png" alt="Twitter" height="16" width="16" />';
}

output += '\n	</td>\n	<td class="nobd">';
//line 35 "codereport.tt2"

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

output += stash.get(['share', 0, 'comment', 0]);

    return context.filter(output, 'replace', [ 'null', '' ]);
})();

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

output += '<tr style="height:auto;border-bottom:none;" class="alwaysDisplay">\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td style="height:auto;border-bottom:none;"> </td>\n	<td class="nobd" style="height:auto;border-bottom:none;"> </td>\n</tr>\n</tbody>\n</table>\n</div>\n\n</div>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 30 "bizcode_voucherrandom.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "bizcode_voucherrandom.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "bizcode_voucherrandom.tt2"

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

output += stash.get(['code', 0, 'code', 0]);

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

output += '</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n	<div id="code_container">\n	<table>\n	';
//line 23 "bizcode_voucherrandom.tt2"
output += context.include('bizcode_vouchercommon.tt2');
output += '\n	</table>\n			<input id="customsubmit" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="closePopup(); return false;" />\n			<input id="customsubmit" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="';
//line 26 "bizcode_voucherrandom.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += 'bizcode_delete(';
//line 26 "bizcode_voucherrandom.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += ')';
}
else {
output += 'closePopup()';
}

output += '; return false;" />\n	</div>\n<div style="clear: both;height: 20px;"> </div>\n</div>\n';
}

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

    return output;
}

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

    try {
//line 11 "bizcode.tt2"
if (stash.get(['code', 0, 'type', 0]) == 3) {
output += '\n	';
//line 2 "bizcode.tt2"
output += context.process('bizcode_random.tt2');
output += '\n';
}
else if (stash.get(['code', 0, 'type', 0]) == 4) {
output += '\n	';
//line 4 "bizcode.tt2"
output += context.process('bizcode_custom.tt2');
output += '\n';
}
else if (stash.get(['code', 0, 'type', 0]) == 11) {
output += '\n	';
//line 6 "bizcode.tt2"
output += context.process('bizcode_voucherrandom.tt2');
output += '\n';
}
else if (stash.get(['code', 0, 'type', 0]) == 12) {
output += '\n	';
//line 8 "bizcode.tt2"
output += context.process('bizcode_vouchercustom.tt2');
output += '\n';
}
else {
output += '\n	\n';
}

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

    return output;
}

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

    try {
output += '<tr>\n	<td class="cardlbl">Title:</td>\n	<td class="cardfld">\n		<input type="text" value="';
//line 4 "bizcode_vouchercommon.tt2"

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

output += stash.get(['code', 0, 'title', 0]);

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

output += '" size="50" maxlength="100" name="code_title_';
//line 4 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;"><p>SMS:</p>\n			<span id="custommessageCount" style="color: green;">0/160</span>\n	</td>\n	<td class="cardfld">\n		<textarea id="custommessage" name="code_message_';
//line 12 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" rows="6" cols="50" class="cardfld" style="width:367px;">';
//line 12 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'message', 0]);
output += '</textarea>\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:top;">SMS end:</td>\n	<td class="cardfld">		\n		<textarea id="custommessageend" rows="1" cols="50" class="cardfld" style="width:367px;border:none;color:grey;" readonly="readonly">';
//line 19 "bizcode_vouchercommon.tt2"
if (stash.get(['code', 0, 'url', 0])) {
//line 18 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += ' \n';
}

//line 19 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'msgend', 0]);
output += '</textarea>\n		<input id="custommessageshorturl" type="hidden" value="';
//line 20 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'shorturl', 0]);
output += '" />\n		<input id="custommessageenddefault" type="hidden" value="';
//line 21 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'msgend', 0]);
output += '" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">URL:</td>\n	<td class="cardfld">\n		<input id="customurl" type="text" value="';
//line 27 "bizcode_vouchercommon.tt2"

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

output += stash.get(['code', 0, 'url', 0]);

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

output += '" size="50" maxlength="255" name="code_url_';
//line 27 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardfld" style="width:367px;" />\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">File:</td>\n	<td class="cardfld">\n		<!--<div id="fileload">-->\n        <form name="uploadForm" action="/business/fileupload" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="if (this.submitted) return true; else return false;" >\n        <input type="hidden" name="codeid" value="';
//line 35 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" />\n		<!--<input id="customsubmit" value="GET FILE" type="submit" class="button_link WhiteOnOrange" style="margin-bottom:2px;" onclick="startUpload(document.uploadForm, \'codefile\', \'codefilename\'); return false;" />-->\n		<input type="file" size="40" name="codefile" id="codefile" class="fb_file" onchange="startUpload(document.uploadForm, \'codefile\', \'codefilename\', \'customsubmit\');" style="width:367px;" />\n		<iframe id="upload_target" name="upload_target" style="width:0;height:0;border:0px solid #fff;"></iframe>\n		</form>\n		<p id="codemaxsize" style="width:367px; margin:2px 0px 2px 0px;">Maximum file size: ';
//line 40 "bizcode_vouchercommon.tt2"
output += stash.get('maxfilesize');
output += '</p>\n		<p id="codefilename" style="width:367px; margin:2px 0px 2px 0px;">';
//line 41 "bizcode_vouchercommon.tt2"
if (stash.get(['code', 0, 'filename', 0])) {
//line 41 "bizcode_vouchercommon.tt2"

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

output += stash.get(['code', 0, 'filename', 0]);

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

output += ' - <span class="link" onclick="codeRemoveFile(';
//line 41 "bizcode_vouchercommon.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += ');">remove file</span>';
}

output += '&nbsp;</p>\n		<!--</div>-->\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;">Variable text:\n	</td>\n	<td class="cardfld">\n		<div id="customvariables" style="min-height:60px;width:367px;" class="likeinput"><span class="varclick link" rel="custommessage">';
//line 49 "bizcode_vouchercommon.tt2"
output += stash.get('vouchersubstitution');
output += '</span> &nbsp; </div>\n		<div id="customvariablelengths" style="display:none;">';
//line 50 "bizcode_vouchercommon.tt2"
output += stash.get('vouchersubstitution');
output += ':';
//line 50 "bizcode_vouchercommon.tt2"
output += stash.get(['maxvoucher', 0, 'length', 0]);
output += ':';
//line 50 "bizcode_vouchercommon.tt2"
output += stash.get('maxvoucher');
output += '</div>\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl" style="vertical-align:middle;">Preview:\n	</td>\n	<td class="cardfld">\n		<div id="theTextPreview" style="min-height:60px;width:367px;" class="likeinput">&nbsp; </div>\n	</td>\n</tr>\n<tr>\n	<td class="cardlbl">&nbsp;</td>\n	<td class="cardfld">&nbsp;</td>\n</tr>\n';
    }
    catch(e) {
        var error = context.set_error(e, output);
        throw(error);
    }

    return output;
}

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

    try {

output += '\n';
//line 42 "bizcode_vouchercustom.tt2"
if (stash.get('error')) {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;">An error occurred</div>\n		<div style="float:right;"><a href="javascript:closePopup()">[X]</a></div>\n		&nbsp;\n	</div>\n	';
//line 9 "bizcode_vouchercustom.tt2"
output += stash.get('error');
output += '\n</div>\n';
}
else {
output += '\n<div id="codeLayer">\n	<div class="bar" onmousedown="dragStart(event, \'codeShadow\')">\n		<div style="float:left;" id="cardName">';
//line 14 "bizcode_vouchercustom.tt2"
if (stash.get(['code', 0, 'code', 0])) {
//line 14 "bizcode_vouchercustom.tt2"
output += stash.get(['code', 0, 'code', 0]);
}
else {
output += 'New Custom Code';
}

output += '</div>\n		<div style="float:right;">';
//line 15 "bizcode_vouchercustom.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += '<a href="javascript:closePopup()">';
}
else {
output += '<a href="javascript:cancelPopup()">';
}

output += '[X]</a></div>\n		&nbsp;\n	</div>\n	\n	<div id="autosave" style="float:right;display: none;"> Auto-saving...</div>\n\n	<div id="code_container">\n	<table>\n	<tr>\n		<td class="cardlbl">Code:</td>\n		<td class="cardfld">\n			<input id="bizcode" type="text" value="';
//line 26 "bizcode_vouchercustom.tt2"

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

output += stash.get(['code', 0, 'code', 0]);

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

output += '" size="30" maxlength="100" name="code_code_';
//line 26 "bizcode_vouchercustom.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '" class="cardcodefld" style="width:280px;" />\n			<input type="submit" onclick="bizcode_custom(); return false;" style="margin:-1px 0 2px auto; float: right;" class="button_link WhiteOnGreen" value="';
//line 27 "bizcode_vouchercustom.tt2"
if (stash.get(['code', 0, 'code', 0])) {
output += 'CHANGE';
}
else {
output += 'CUSTOM';
}

output += '" id="customsubmit"><br />\n			<div id="result_custom" style="clear: both; margin: 4px 0 8px 0;" class="green">';
//line 28 "bizcode_vouchercustom.tt2"
output += stash.get('codemessage');
output += '&nbsp;</div>\n		</td>\n	</tr>\n	';
//line 31 "bizcode_vouchercustom.tt2"
output += context.include('bizcode_vouchercommon.tt2');
output += '\n	</table>\n			<input id="customsubmit" value="DONE" type="submit" class="button_link WhiteOnGreen" style="margin:0 10px 2px 0;float:right;" onclick="closePopup(); return false;" />\n			';
//line 38 "bizcode_vouchercustom.tt2"
if (stash.get(['code', 0, 'id', 0])) {
output += '\n			<input id="customsubmit" value="DELETE" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="bizcode_delete(';
//line 35 "bizcode_vouchercustom.tt2"
output += stash.get(['code', 0, 'id', 0]);
output += '); return false;" />\n			';
}
else {
output += '\n			<input id="customsubmit" value="CANCEL" type="submit" class="button_link WhiteOnOrange" style="margin:0 10px 2px 0;float:right;" onclick="cancelPopup(); return false;" />			\n			';
}

output += '\n	</div>\n<div style="clear: both;height: 20px;"> </div>\n</div>\n';
}

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

    return output;
}


