/*
 * jQuery Templates Plugin Library v1.1.0
 * http://www.ivorycity.com/blog/jquery-template-plugin/
 *
 * Copyright (c) 2009 Michael Collins
 * Dual licensed under the MIT and GPL licenses.
 * See MIT-LICENSE.txt and GPL-LICENSE.txt
 *
 */
jQuery.fn.extend({render:function(a,b){var f={};var d=null;var e=new RegExp("['\"](.+)['\"]","mg");b=b||[];a=$.makeArray(a);this.each(function(g){var h=function(r,o,l){var n=$("<div></div>").append(o.clone());$.each(r,function(u,t){u=""+u;if(u.indexOf("$(")==0||u.indexOf("@(")==0){var s=e.exec(u);if(s[1]){n.find(s[1]).render(t,{clone:u.indexOf("@")==0?true:false})}return}});var m="";var i=n.html().replace(/%7B/ig,"{").replace(/%7D/ig,"}");var q=function(t,s){replacement=m+t;if(!f[replacement]){if(s!=null&&typeof s=="object"||typeof s=="array"){var u=m;m=replacement+".";$.each(s,q);m=u;return}f[replacement]=new RegExp("{"+replacement+"}","gm")}var w=f[replacement];i=i.replace(w,s)};$.each(r,q);var p=$(i);if(l.beforeUpdate){l.beforeUpdate(p)}if(l.clone){o.after(p)}else{o.replaceWith(p)}if(l.afterUpdate){l.afterUpdate(p)}return p};var j=$(this);if(b.preserve_template){b.clone=true}if(b.clone){a=$.makeArray(a);$(a.reverse()).each(function(){var i=h(this,j,b);if(!d){d=$(i)}else{d.push(i[0])}});if(!b.preserve_template){$(this).remove()}}else{var k=(a[g]||a[a.length-1]);h(k,j,b)}});if(d){var c=jQuery(d);c.insertBefore(this.selector)}else{return this}}});