
(function(){if(typeof include!='undefined'&&typeof include.end!='undefined'){return include.end();}else if(typeof include!='undefined'&&typeof include.end=='undefined')
throw("Include is defined as function or an element's id!");MVC=typeof MVC=='undefined'?{}:MVC;MVC.Object={extend:function(d,s){for(var p in s)d[p]=s[p];return d;}}
MVC.Object.extend(MVC,{Test:{},_no_conflict:false,no_conflict:function(){MVC._no_conflict=true},runner:function(f){if(!MVC.Browser.Rhino)f();},Ajax:{},IO:{},_env:"development",env:function(arg){MVC._env=arg||MVC._env;return MVC._env;},Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),Rhino:!!window._rhino},mvc_root:null,include_path:null,root:null,page_dir:null,Object:{extend:function(d,s){for(var p in s)d[p]=s[p];return d;}},$E:function(id){return typeof id=='string'?document.getElementById(id):id},app_name:'app',get_random:function(length){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var randomstring='';for(var i=0;i<length;i++){var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1);}
return randomstring;},K:function(){}});MVC.random=MVC.get_random(6);MVC.Ajax.factory=function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();};MVC.File=function(path){this.path=path;};var File=MVC.File;MVC.File.prototype={clean:function(){return this.path.match(/([^\?#]*)/)[1];},dir:function(){var last=this.clean().lastIndexOf('/');return last!=-1?this.clean().substring(0,last):'';},domain:function(){if(this.path.indexOf('file:')==0)return null;var http=this.path.match(/^(?:https?:\/\/)([^\/]*)/);return http?http[1]:null;},join:function(url){return new File(url).join_from(this.path);},join_from:function(url,expand){if(this.is_domain_absolute()){var u=new File(url);if(this.domain()&&this.domain()==u.domain())
return this.after_domain();else if(this.domain()==u.domain()){return this.to_reference_from_same_domain(url);}else
return this.path;}else if(url==MVC.page_dir&&!expand){return this.path;}else{if(url=='')return this.path.replace(/\/$/,'');var urls=url.split('/'),paths=this.path.split('/'),path=paths[0];if(url.match(/\/$/))urls.pop();while(path=='..'&&paths.length>0){paths.shift();urls.pop();path=paths[0];}
return urls.concat(paths).join('/');}},join_current:function(){return this.join_from(include.get_path());},relative:function(){return this.path.match(/^(https?:|file:|\/)/)==null;},after_domain:function(){return this.path.match(/(?:https?:\/\/[^\/]*)(.*)/)[1];},to_reference_from_same_domain:function(url){var parts=this.path.split('/'),other_parts=url.split('/'),result='';while(parts.length>0&&other_parts.length>0&&parts[0]==other_parts[0]){parts.shift();other_parts.shift();}
for(var i=0;i<other_parts.length;i++)result+='../';return result+parts.join('/');},is_cross_domain:function(){if(this.is_local_absolute())return false;return this.domain()!=new File(location.href).domain();},is_local_absolute:function(){return this.path.indexOf('/')===0},is_domain_absolute:function(){return this.path.match(/^(https?:|file:)/)!=null},normalize:function(){var current_path=include.get_path();var path=this.path;if(new File(include.get_absolute_path()).is_cross_domain()&&!this.is_domain_absolute()){if(this.is_local_absolute()){var domain_part=current_path.split('/').slice(0,3).join('/');path=domain_part+path;}else{path=this.join_from(current_path);}}else if(current_path!=''&&this.relative()){path=this.join_from(current_path+(current_path.lastIndexOf('/')===current_path.length-1?'':'/'));}
return path;}};MVC.page_dir=new File(window.location.href).dir();var scripts=document.getElementsByTagName("script");for(var i=0;i<scripts.length;i++){var src=scripts[i].src;if(src.match(/include\.js/)){MVC.include_path=src;MVC.mvc_root=new File(new File(src).join_from(MVC.page_dir)).dir();var loc=MVC.mvc_root.match(/\.\.$/)?MVC.mvc_root+'/..':MVC.mvc_root.replace(/jmvc$/,'');if(loc.match(/.+\/$/))loc=loc.replace(/\/$/,'');MVC.root=new File(loc);if(src.indexOf('?')!=-1)MVC.script_options=src.split('?')[1].split(',');}}
MVC.Options={load_production:true,env:'development',production:'/javascripts/production.js',encoding:"utf-8",cache_include:true}
var first=true,first_wave_done=false,included_paths=[],cwd='',includes=[],current_includes=[],total=[];include=function(){if(include.get_env().match(/development|compress|test/)){for(var i=0;i<arguments.length;i++)
include.add(include.add_defaults(arguments[i]));}else{if(!first_wave_done)return;for(var i=0;i<arguments.length;i++){include.add(include.add_defaults(arguments[i]));}
return;}
if(first&&!MVC.Browser.Opera){first=false;insert();}};MVC.Object.extend(include,{add_defaults:function(inc){if(typeof inc=='string')
inc={path:inc.indexOf('.js')==-1?inc+'.js':inc};if(typeof inc!='function'){inc.original_path=inc.path;inc=MVC.Object.extend({},inc);}
return inc;},setup:function(o){MVC.Object.extend(MVC.Options,o||{});MVC.Options.production=MVC.Options.production+(MVC.Options.production.indexOf('.js')==-1?'.js':'');if(MVC.Options.env=='test')include.plugins('test');if(MVC.Options.env=='production'&&!MVC.Browser.Opera&&MVC.Options.load_production)
return document.write('<script type="text/javascript" src="'+include.get_production_name()+'"></script>');},get_env:function(){return MVC.Options.env;},get_production_name:function(){return MVC.Options.production;},set_path:function(p){cwd=p;},get_path:function(){return cwd;},get_absolute_path:function(){var fwd=new File(cwd);return fwd.relative()?fwd.join_from(MVC.root.path,true):cwd;},add:function(newInclude){if(typeof newInclude=='function'){var path=include.get_path();var adjusted=function(){include.set_path(path);newInclude();}
include.functions.push(adjusted);current_includes.unshift(adjusted);return;}
if(first_wave_done)
return include.insert_head(newInclude.path);var pf=new File(newInclude.path);newInclude.path=pf.normalize();newInclude.absolute=pf.relative()?pf.join_from(include.get_absolute_path(),true):newInclude.path;newInclude.start=new MVC.File(newInclude.path).dir();if(include.should_add(newInclude.absolute)){for(var i=0;i<includes.length;i++){if(includes[i].absolute==newInclude.absolute){includes.splice(i,1);break;}}
current_includes.unshift(newInclude);}else{}},should_add:function(path){for(var i=0;i<total.length;i++)if(total[i].absolute==path)return false;for(var i=0;i<current_includes.length;i++)if(current_includes[i].absolute==path)return false;return true;},force:function(){for(var i=0;i<arguments.length;i++){include.insert_head(MVC.root.join(arguments[i]));}},close_time:function(){setTimeout(function(){document.close();},10)},close:function(){if(include.get_env()=='production')include.close_time();else include._close=true;},end:function(src){includes=includes.concat(current_includes);var latest=includes.pop();if(!latest){first_wave_done=true;if(include.get_env()=='compress')setTimeout(include.compress,10);if(typeof MVCOptions!='undefined'&&MVCOptions.done_loading)MVCOptions.done_loading();if(include._close){this.close_time();}
return;};total.push(latest);current_includes=[];if(typeof latest=='function'){latest();insert();}else{include.set_path(latest.start);include.current=latest.path;if(include.get_env()=='compress'){var parts=latest.path.split("/")
if(parts.length>4)parts=parts.slice(parts.length-4);print("   "+parts.join("/"));latest.text=include.request(MVC.root.join(latest.path));}
latest.ignore?insert():insert(latest.path);}},end_of_production:function(){first_wave_done=true;},compress:function(){MVCOptions.compress_callback(total)},opera:function(){include.opera_called=true;if(MVC.Browser.Opera){MVC.Options.env=='production'?document.write('<script type="text/javascript" src="'+include.get_production_name()+'"></script>'):include.end();}},opera_called:false,plugin:function(plugin_name){var current_path=include.get_path();include.set_path("");include('jmvc/plugins/'+plugin_name+'/setup');include.set_path(current_path);},plugins:function(){for(var i=0;i<arguments.length;i++)include.plugin(arguments[i]);},app:function(f){return function(){for(var i=0;i<arguments.length;i++){arguments[i]=f(arguments[i]);}
include.apply(null,arguments);}},functions:[],next_function:function(){var func=include.functions.pop();if(func)func();},css:function(){var arg;for(var i=0;i<arguments.length;i++){arg=arguments[i];var current=new MVC.File("../stylesheets/"+arg+".css").join_current();include.create_link(MVC.root.join(current));}},create_link:function(location){var link=document.createElement('link');link.rel="stylesheet";link.href=location;link.type='text/css';head().appendChild(link);},check_exists:function(path){var xhr=MVC.Ajax.factory();try{xhr.open("HEAD",path,false);xhr.send(null);}catch(e){return false;}
if(xhr.status>505||xhr.status==404||xhr.status==2||xhr.status==3||(xhr.status==0&&xhr.responseText==''))
return false;return true;},request:function(path,content_type){var contentType=content_type||"application/x-www-form-urlencoded; charset="+MVC.Options.encoding
var request=MVC.Ajax.factory();request.open("GET",path,false);request.setRequestHeader('Content-type',contentType)
if(request.overrideMimeType)request.overrideMimeType(contentType);try{request.send(null);}
catch(e){return null;}
if(request.status==500||request.status==404||request.status==2||(request.status==0&&request.responseText==''))return null;return request.responseText;},insert_head:function(src,encode){encode=encode||"UTF-8";var script=script_tag();script.src=src;script.charset=encode;head().appendChild(script);},write:function(src,encode){encode=encode||"UTF-8";document.write('<script type="text/javascript" src="'+src+'" encode="+encode+"></script>');}});include.controllers=include.app(function(i){return'../controllers/'+i+'_controller'});include.models=include.app(function(i){return'../models/'+i});include.resources=include.app(function(i){return'../resources/'+i});include.engines=include.app(function(i){return'../engines/'+i+"/apps/"+i+".js"});var script_tag=function(){var start=document.createElement('script');start.type='text/javascript';return start;};var insert=function(src){if(src){var src_file=new MVC.File(src);if(!src_file.is_local_absolute()&&!src_file.is_domain_absolute())
src=MVC.root.join(src);}
if(!document.write){if(src){load(new MVC.File(src).clean());}
load(new MVC.File(MVC.include_path).clean())}else if(MVC.Browser.Opera||MVC.Browser.Webkit){if(src){var script=script_tag();script.src=src+'?'+MVC.random;document.body.appendChild(script);}
var start=script_tag();start.src=MVC.include_path+'?'+MVC.random;document.body.appendChild(start);}else{document.write((src?'<script type="text/javascript" src="'+src+(MVC.Options.cache_include?'':'?'+MVC.random)+'"></script>':'')+
call_end());}};var call_end=function(src){return MVC.Browser.Gecko?'<script type="text/javascript">include.end()</script>':'<script type="text/javascript" src="'+MVC.include_path+'?'+MVC.random+'"></script>'}
var head=function(){var d=document,de=d.documentElement;var heads=d.getElementsByTagName("head");if(heads.length>0)return heads[0];var head=d.createElement('head');de.insertBefore(head,de.firstChild);return head;};if(MVC.script_options){first=false;MVC.apps_root=MVC.root.join('apps')
MVC.app_name=MVC.script_options[0];if(MVC.Browser.Rhino)
MVC.script_options[1]=MVCOptions.env
if(MVC.script_options.length>1){if(!MVC.script_options[1].match(/^(?:production|development|test|compress)$/))
throw"env should be one of: production,development,test,compress";include.setup({env:MVC.script_options[1],production:MVC.apps_root+'/'+MVC.script_options[0]+'/production'});}
include('apps/'+MVC.app_name);if(MVC.script_options[1]=='test'){include.plugins('lang','dom/query')
var load_test=function(){include('apps/'+MVC.app_name+'/test');}
if(navigator.userAgent.match(/Firefox\/3/)){load_test();}else{if(include.check_exists(MVC.apps_root+'/'+MVC.app_name+'/test.js')){load_test();}else{setTimeout(function(){MVC.Console.log("There is no application test file at:\n    \"apps/"+MVC.app_name+"/test.js\"\nUse it to include your test files.\n\nTest includes:\n    include.unit_tests('product')\n    include.functional_tests('widget')")},1000)}}}
if(!MVC.Browser.Opera)insert();include.opera();}
if(MVC.Browser.Opera)
setTimeout(function(){if(!include.opera_called&&MVC.Options.load_production){alert("You forgot include.opera().")}},10000);})();