text: /* jQuery.csvIn - Set of functions to process csv data in jquery
  https://github.com/Mango-information-systems/jquery.csvIn/blob/master/README.md
  version 0.2 - 31st July 2011
  Copyright (c) 2011 Mango Information Systems SPRL, http://www.mango-is.com
  This plugin will either be released under dual license (MIT + LGPL) or under Apache license version 2.0. Precision will be added soon right here.
  csvIn code is based on [jquery.csv] plugin, licensed under Apache license version 2.0
  [jquery.csv]: http://code.google.com/p/js-tables/
  */
  (function(b){if("a,,b".split(",").length<3){var e=e||String.prototype.split;String.prototype.split=function(p,k){if(!(p instanceof RegExp)){return e.apply(this,arguments)}if(k===undefined||+k<0){k=false}else{k=Math.floor(+k);if(!k){return[]}}var h=(p.global?"g":"")+(p.ignoreCase?"i":"")+(p.multiline?"m":""),n=new RegExp("^"+p.source+"$",h),g=[],f=0,l=0,m;if(!p.global){p=new RegExp(p.source,"g"+h)}while((!k||l++<=k)&&(m=p.exec(this))){var o=!m[0].length;if(o&&p.lastIndex>m.index){p.lastIndex=m.index}if(p.lastIndex>f){if(m.length>1){m[0].replace(n,function(){for(var q=1;q<arguments.length-2;q++){if(arguments[q]===undefined){m[q]=undefined}}})}g=g.concat(this.slice(f,m.index),(m.index===this.length?[]:m.slice(1)));f=p.lastIndex}if(o){p.lastIndex++}}return(f===this.length)?(p.test("")?g:g.concat("")):(k?g:g.concat(this.slice(f)))}}function d(f){return function(g){return g.split(f)}}function c(k,h,f,g){return function(o){var m=o.split(h);for(var r=[],w,t=0,n=m.length;t<n;t++){if(w=m[t].match(f)){w=w[0];for(var p=t;p<n;p++){if(m[p].charAt(m[p].length-1)==w){break}}var u=m.slice(t,p+1).join(k);u=u.replace(g[w],w);r.push(u.substr(1,u.length-2));t=p}else{r.push(m[t])}}return r}}function a(k,g,p){var m="undefined";var o=g?g.split(""):[],f=new RegExp("["+k+"]"),l=new RegExp("^["+g+"]");for(var n=0,r={},h;h=o[n];n++){r[h]=new RegExp(h+h,"g")}return[new RegExp("["+p+"]*$"),new RegExp("["+p+"]["+p+"]*"),g?c(k,f,l,r):d(f)]}b.csvIn={};b.csvIn.toArray=function(k,n){n=b.extend({},b.csvIn.defaults,n);var f=a(n.delim,n.quote,n.lined),l=f[0],m=f[1],h=f[2];var p=[];var o=k.replace(l,"").split(m);if(n.endLine==-1){n.endLine=o.length-1}else{n.endLine=o.length>n.endLine?n.endLine:o.length-1}if(n.excludedColumns.length==0){for(var g=n.startLine;g<=n.endLine;g++){p.push(h(o[g]))}}else{for(var g=n.startLine;g<=n.endLine;g++){split=h(o[g]);for(j in n.excludedColumns){split.splice(n.excludedColumns[j],1)}p.push(split)}}return p};b.csvIn.toJSON=function(l,r){r=b.extend({},b.csvIn.defaults,r);var f=a(r.delim,r.quote,r.lined),n=f[0],o=f[1],k=f[2];var s=l.replace(n,"").split(o);if(r.endLine==-1){r.endLine=s.length-1}else{r.endLine=s.length>r.endLine?r.endLine:s.length-1}var m=r.customHeaders.length==0?k(s[0]):r.customHeaders;if(r.startLine==0&&r.customHeaders.length==0){r.startLine=1}nfields=m.length;out=[];if(r.excludedColumns.length==0){for(var h=r.startLine;h<=r.endLine;h++){var q=k(s[h]);for(var g=0,p={};g<nfields;g++){p[m[g]]=q[g]}out.push(p)}return out}else{for(var h=r.startLine;h<=r.endLine;h++){q=k(s[h]);p={};for(var g=0;g<nfields;g++){if(b.inArray(g,r.excludedColumns)==-1){p[m[g]]=q[g]}}out.push(p)}return out}};b.csvIn.isHeader=function(g){var f=[];for(i in g){if(g[i]==""){return false}if(parseInt(g[i])){return false}if(b.inArray(g[i],f)!=-1){return false}f.push(g[i])}return true};b.csvIn.detectDelimitor=function(l,p){var m=[";",",","\t","-",":"," "];p=b.extend({},b.csvIn.defaults,p);var g=a(p.delim,p.quote,p.lined),n=g[0],o=g[1],k=g[2];var q=l.replace(n,"").split(o);lastRow=Math.min(7,q.length);for(i in m){var f=0;var h=true;for(j=0;j<lastRow;j++){if(q[j].length<2){break}p.delim=m[i];g=a(p.delim,p.quote,p.lined);n=g[0];o=g[1];k=g[2];currentCount=k(q[j]).length;if(currentCount<=1||(currentCount!=f)&&f!=0){h=false;break}f=currentCount}if(h){return m[i]}}return""};b.csvIn.defaults={delim:",",quote:'"',lined:"\r\n",startLine:0,endLine:-1,excludedColumns:[],customHeaders:[]}})(jQuery);