
new function(){var $s=bbcjs.lib.string={uriEscape:function(s){return escape(s).replace(/\+/g,"%2b");},obj2string:function(o,pd,vd){var _opts=typeof(pd)=='object'?pd:{pd:pd||'&',vd:vd||'='};var opts=bbcjs.extend({pd:'&',vd:'=',repeatKeys:false},_opts);var pd=opts.pd,vd=opts.vd;var str="",i,t="",cnt=0,j;if(typeof(o)=="object"){for(i in o){cnt++;if(typeof(o[i])=="object"&&((o[i].constructor==Object)||(o[i].constructor==Array))){if(opts.repeatKeys){for(j=0;j<o[i].length;j++)t+=i+vd+o[i][j]+pd;}
else t+=i+vd+$s.uriEscape($s.obj2string(o[i],pd,vd))+pd;}
else if(typeof(o[i])!="object"&&(typeof(o[i])!="function")){t+=i+vd+$s.uriEscape(o[i])+pd;}}
str=t.substring(0,t.length-1);}
else bbcjs.trace("obj2string expected typeof object, not "+typeof(o),1);if(!cnt)str="_{}";if(pd!=";")str=str.replace(/;/g,"%3B");return str;},string2obj:function(str,pd,vd){if(pd==undefined)pd="&";if(vd==undefined)vd="=";var pairs=str.split(pd);var i,j,o={},pair=[],t;for(i=0;i<pairs.length;i++){pair=pairs[i].split(vd);if(i===0&&(parseInt(pair[0])===0))o=[];if(pair.length==2){t=unescape(pair[1]);if(t.indexOf(vd)!=-1){o[pair[0]]=$s.string2obj(t,pd,vd);}
else{if(!isNaN(parseInt(pair[0])))pair[0]=parseInt(pair[0]);if(unescape(pair[1])!="_{}")o[pair[0]]=unescape(pair[1].replace(/%3B/g,";"));else o[pair[0]]={};}}
else bbcjs.trace("WARNING: string2obj:: '"+pairs[i]+"' is not a proper name-val pair (using '"+pd+"' and '"+vd+"')",5);}
return o;},countWords:function(str){var matches=new Array();matches=str.match(/\w+/g);if(!matches)return 0;else return matches.length;},WordLimit:function(limit){this.limit=limit;this.type='WordLimit';}};$s.WordLimit.prototype.validate=function(str){return($s.countWords(str)<=this.limit);};}();function sprintf(){if(!arguments||arguments.length<1||!RegExp){return 0;}
var str=arguments[0];var re=/([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;var a=re.exec(str);var numSubstitutions=0;var numMatches=0;while(re.exec(str)){var leftpart=a[1],pPad=a[2],pJustify=a[3],pMinLength=a[4];var pPrecision=a[5],pType=a[6],rightPart=a[7];numMatches++;if(pType=='%'){subst='%';}
else{numSubstitutions++;if(numSubstitutions>=arguments.length){bbcjs.trace('sprintf : Not enough function arguments ('+(arguments.length-1)+', excluding the string)\n'+'for the number of substitution parameters in string ('+
numSubstitutions+' so far).',1);}
var param=arguments[numSubstitutions];var pad='';if(pPad&&pPad.substr(0,1)=="'")pad=leftpart.substr(1,1);else if(pPad)pad=pPad;var justifyRight=true;if(pJustify&&pJustify==="-")justifyRight=false;var minLength=-1;if(pMinLength)minLength=parseInt(pMinLength);var precision=-1;if(pPrecision&&pType=='f')
precision=parseInt(pPrecision.substring(1));var subst=param;switch(pType){case'b':subst=parseInt(param).toString(2);break;case'c':subst=String.fromCharCode(parseInt(param));break;case'd':subst=parseInt(param)?parseInt(param):0;break;case'u':subst=Math.abs(param);break;case'f':subst=(precision>-1)?Math.round(parseFloat(param)*Math.pow(10,precision))/Math.pow(10,precision):parseFloat(param);break;case'o':subst=parseInt(param).toString(8);break;case's':subst=param;break;case'x':subst=(''+parseInt(param).toString(16)).toLowerCase();break;case'X':subst=(''+parseInt(param).toString(16)).toUpperCase();break;}
var padLeft=minLength-subst.toString().length;var padding="";if(padLeft>0){var arrTmp=new Array(padLeft+1);padding=arrTmp.join(pad?pad:" ");}}
str=leftpart+padding+subst+rightPart;}
return str;}
var printf=sprintf;bbcjs.trace('<b style="color:Green">jst_querystring.js was included.</b>',2);new function(){var querystring=bbcjs.querystring={values:bbcjs.lib.string.string2obj(bbcjs.qs,/&|;/),querystring2form:function(f){if(bbcjs.forms){bbcjs.forms.object2form(f,bbcjs.cgiparam);}
else bbcjs.trace("querystring2form :: Could not find the forms module. Please include jst_forms",1);return true;}};bbcjs.cgiparam=querystring.values;}();