//* Core Methods *//
String.prototype.ucFirst=function(){return(this.charAt(0).toUpperCase()+this.substr(1,this.length));}
String.prototype.stripSlashes=function(){return(this.replace(new RegExp("/+","g"),"/"));}
String.prototype.ltrim=function(){return this.replace(/^\\s+/,'');}
String.prototype.rtrim=function(){return this.replace(/\\s+$/,'');}
String.prototype.trim=function(){return this.replace(/^\\s+|\\s+$/g,'');}
String.prototype.chop=function(n){if(isNaN(n)){n=this.length-1;}return(this.substring(0,n));}
String.prototype.stripPrecedingSlashes=function(){try{return this.replace(new RegExp("/+","g"),"/").substring(1);}catch(e){}}
Math.getRnd=function(a_numA,a_numB){if(!MTVi.util.isDefined(a_numA)||isNaN(a_numA)||parseInt(a_numA)<0){a_numA=1;}if(!MTVi.util.isDefined(a_numB)||isNaN(a_numB)||parseInt(a_numB)<0){a_numB=0;}if(a_numA<a_numB){var tempNum=a_numA;a_numA=a_numB;a_numB=tempNum;}return(parseInt(Math.random()*(a_numA-a_numB+1)+a_numB));}
//* DOM Methods *//
if(typeof document.getElementsByClassName=="undefined"){
	document.getElementsByClassName=function(s){
		var nodes=[];
		var name=new RegExp('\\b'+s+'\\b');
		var elems=this.getElementsByTagName('*');
		for(var i=0;i<elems.length;i++){if(name.test(elems[i].className)){nodes.push(elems[i])};}
		return nodes;
	};
}
// retrieve text of an XML document element, including elements using namespaces
if(typeof document.getElementTextNS=="undefined"){
	document.getElementTextNS=function(prefix,local,parentElem,index){
		var result="";
		var isIE=(document.all)?true:false;
		if(prefix&&isIE){
			// IE/Windows way of handling namespaces
			result=parentElem.getElementsByTagName(prefix+":"+local)[index];
		}else{
			// the namespace versions of this method (getElementsByTagNameNS()) operate
			// differently in Safari and Mozilla, but both return value with just local name, provided 
			// there aren't conflicts with non-namespace element names
			result=parentElem.getElementsByTagName(local)[index];
		}
		if(result){
			// get text, accounting for possible whitespace (carriage return) text nodes 
			try{
				if(result.childNodes.length>1){
					return result.childNodes[1].nodeValue;
				}else{
					return result.firstChild.nodeValue;    		
				}
			}catch(e){}
		}else{
			return "n/a";
		}
	};
}
//* From JSON.org: var a_string=JSON.stringify(ob); *//
var JSON=function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={'boolean':function(x){return String(x);},number:function(x){return isFinite(x)?String(x):'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}c=b.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);});}return'"'+x+'"';},object:function(x){if(x){var a=[],b,f,i,l,v;if(x instanceof Array){a[0]='[';l=x.length;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}a[a.length]=v;b=true;}}}a[a.length]=']';}else if(x instanceof Object){a[0]='{';for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}a.push(s.string(i),':',v);b=true;}}}a[a.length]='}';}else{return;}return a.join('');}return'null';}};return{copyright:'(c)2005 JSON.org',license:'http://www.JSON.org/license.html',stringify:function(v){var f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){return v;}}return null;},parse:function(text){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+text+')');}catch(e){return false;}}};}();
