var NECTAR=NECTAR||{version:"0.1.1",config:{},require:function(e,a){var c=function(d,f){$.ajax({url:NECTAR.config.jsReqPath+d+".js",async:false,cache:false,dataType:"script",complete:f,error:function(){$.ajax({url:d,dataType:"script",complete:f,error:function(){console.log("script not available")}})}})};switch(typeof e){case "object":script=e.shift();if(e.length==1)e=e[0];c(script,NECTAR.require(e,a));break;case "string":c(e,a)}},run:function(e,a){var c={js:function(d){$.getScript(d)},html:function(d){alert(d)},
css:function(d){alert(d)}};fileSwitcher=function(d){switch(typeof d){case "function":d.call();break;case "string":sArr=d.split(".");fileType=sArr.pop();c[fileType](d)}};if(a){if(e){tArr=e.split(",");for(elm in tArr)if(NECTAR.config.template==tArr[elm]){fileSwitcher(a);break}}}else fileSwitcher(e)},inherit:function(e,a){function c(){}var d;c.prototype=e;d=new c;d.uber=e;for(var f in a)d[f]=a[f];return d},stripSelector:function(e){if(!e)return false;if(e.indexOf(".")==0)return e.replace(/./i,"");if(e.indexOf("#")==
0)return e.replace(/#/i,"")},parseQuery:function(e){if(self.location.search=="")return false;if(!NECTAR.config.query){NECTAR.config.query={};$(decodeURIComponent(self.location.search).substring(1).split("&")).each(function(){var c=this.split("=");NECTAR.config.query[c[0]]=c[1]})}switch(typeof e){case "undefined":return NECTAR.config.query;case "string":return NECTAR.config.query[e];case "object":var a={};$.map(e,function(c){$(NECTAR.config.query).each(function(){if(this[c])a[c]=this[c]})});return a}},
parseMetaJSON:function(e){json=$("meta[name='"+e+"']").attr("content");return $.parseJSON(json)},init:function(e){NECTAR.config=e;NECTAR.client.set();NECTAR.config.server=NECTAR.server.set(e.server);NECTAR.config.template=$(e.template).attr("id")||$("body").attr("id");NECTAR.config.styleDir=e.styleDir||"/media/styles/";NECTAR.config.jsReqPath=e.jsReqPath||"/media/scripts/"}};
NECTAR.client=function(){return{set:function(){NECTAR.config.browser="noIE";for(b in this.IE)if($("html").hasClass(this.IE[b]))NECTAR.config.browser=this.IE[b]}}}();NECTAR.server=function(){var e=["dev","stage","prod"];return{set:function(a){if(typeof a=="undefined")return e.pop();for(var c in a){a[c].match(/http/)||(a[c]="http://"+a[c]);return a[c]=="http://"+window.location.hostname?e.pop():e.shift()}}}}();
NECTAR.features=function(){var e=[];return{log:function(a){e[a]="running"},list:function(){return e},has:function(a){if(!Modernizr)return false;return typeof a=="undefined"?Modernizr:$("html").hasClass(a)}}}();NECTAR.modal=function(){return{init:function(){$("<div/>",{id:"nectar-modal",css:{display:"none"}}).appendTo("body");return true}}}();
NECTAR.analytics=function(e){if(NECTAR.config.server==="prod"||e.force==1)$.getScript("http://www.google-analytics.com/ga.js",function(){try{_gat._getTracker(e.profile)._trackPageview();NECTAR.features.log("analytics")}catch(a){console.log("there was an error: "+a)}})};
NECTAR.mustache=function(){var e=function(){};e.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(a,c,d,f){if(!f){this.context=c;this.buffer=[]}if(!this.includes("",a))if(f)return a;else{this.send(a);return}a=this.render_pragmas(a);a=this.render_section(a,c,d);if(f)return this.render_tags(a,c,d,f);this.render_tags(a,c,d,f)},send:function(a){a!=""&&this.buffer.push(a)},render_pragmas:function(a){if(!this.includes("%",a))return a;
var c=this;return a.replace(RegExp(this.otag+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+this.ctag),function(d,f,g){if(!c.pragmas_implemented[f])throw{message:"This implementation of mustache doesn't understand the '"+f+"' pragma"};c.pragmas[f]={};if(g){d=g.split("=");c.pragmas[f][d[0]]=d[1]}return""})},render_partial:function(a,c,d){a=this.trim(a);if(!d||d[a]===undefined)throw{message:"unknown_partial '"+a+"'"};if(typeof c[a]!="object")return this.render(d[a],c,d,true);return this.render(d[a],c[a],d,true)},render_section:function(a,
c,d){if(!this.includes("#",a)&&!this.includes("^",a))return a;var f=this;return a.replace(RegExp(this.otag+"(\\^|\\#)\\s*(.+)\\s*"+this.ctag+"\n*([\\s\\S]+?)"+this.otag+"\\/\\s*\\2\\s*"+this.ctag+"\\s*","mg"),function(g,j,k,i){g=f.find(k,c);if(j=="^")return!g||f.is_array(g)&&g.length===0?f.render(i,c,d,true):"";else if(j=="#")return f.is_array(g)?f.map(g,function(h){return f.render(i,f.create_context(h),d,true)}).join(""):f.is_object(g)?f.render(i,f.create_context(g),d,true):typeof g==="function"?
g.call(c,i,function(h){return f.render(h,c,d,true)}):g?f.render(i,c,d,true):""})},render_tags:function(a,c,d,f){var g=this,j=function(){return RegExp(g.otag+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+g.ctag+"+","g")},k=j(),i=function(n,m,l){switch(m){case "!":return"";case "=":g.set_delimiters(l);k=j();return"";case ">":return g.render_partial(l,c,d);case "{":return g.find(l,c);default:return g.escape(g.find(l,c))}};a=a.split("\n");for(var h=0;h<a.length;h++){a[h]=a[h].replace(k,i,this);f||this.send(a[h])}if(f)return a.join("\n")},
set_delimiters:function(a){a=a.split(" ");this.otag=this.escape_regex(a[0]);this.ctag=this.escape_regex(a[1])},escape_regex:function(a){if(!arguments.callee.sRE)arguments.callee.sRE=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","g");return a.replace(arguments.callee.sRE,"\\$1")},find:function(a,c){a=this.trim(a);var d;if(c[a]===false||c[a]===0||c[a])d=c[a];else if(this.context[a]===false||this.context[a]===0||this.context[a])d=this.context[a];if(typeof d==="function")return d.apply(c);
if(d!==undefined)return d;return""},includes:function(a,c){return c.indexOf(this.otag+a)!=-1},escape:function(a){a=String(a===null?"":a);return a.replace(/&(?!\w+;)|["'<>\\]/g,function(c){switch(c){case "&":return"&amp;";case "\\":return"\\\\";case '"':return"&quot;";case "'":return"&#39;";case "<":return"&lt;";case ">":return"&gt;";default:return c}})},create_context:function(a){if(this.is_object(a))return a;else{var c=".";if(this.pragmas["IMPLICIT-ITERATOR"])c=this.pragmas["IMPLICIT-ITERATOR"].iterator;
var d={};d[c]=a;return d}},is_object:function(a){return a&&typeof a=="object"},is_array:function(a){return Object.prototype.toString.call(a)==="[object Array]"},trim:function(a){return a.replace(/^\s*|\s*$/g,"")},map:function(a,c){if(typeof a.map=="function")return a.map(c);else{for(var d=[],f=a.length,g=0;g<f;g++)d.push(c(a[g]));return d}}};return{name:"mustache.js - nectar module",version:"0.3.1-dev",to_html:function(a,c,d,f){var g=new e;if(f)g.send=f;g.render(a,c,d);if(!f)return g.buffer.join("\n")}}}();
NECTAR.util={controls:function(e){for(var a in e)NECTAR.util["_"+a]||(NECTAR.util["_"+a]=e[a]);NECTAR.util._printCtrl&&NECTAR.util._printInit();if(NECTAR.util._sizeCtrl){if(!NECTAR.util._regularCSS)NECTAR.util._regularCSS="text-reg";NECTAR.util._resizeInit()}},_printInit:function(){$(NECTAR.util._printCtrl).click(function(e){e.preventDefault();print()})},_resizeInit:function(){$(NECTAR.util._sizeCtrl).each(function(){$(this).click(function(e){e.preventDefault();NECTAR.util._styleSwitch($(e.target).attr("class"))})})},
_styleSwitch:function(e){$("#NECTAR-resizeCSS").remove();$("head").append('<link rel="stylesheet" id="NECTAR-resizeCSS" href="'+NECTAR.environment.config.styleDir+e+'.css" type="text/css" media="screen, projection" />')}};NECTAR.readCookie=function(e){e=e+"=";for(var a=document.cookie.split(";"),c=0;c<a.length;c++){for(var d=a[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(e)==0)return d.substring(e.length,d.length)}return null};
NECTAR.createCookie=function(e,a,c){if(c){var d=new Date;d.setTime(d.getTime()+c*24*60*60*1E3);c="; expires="+d.toGMTString()}else c="";document.cookie=e+"="+a+c+"; path=/"};NECTAR.eraseCookie=function(e){NECTAR.createCookie(e,"",-1)};
