//	toSource extensions v1.0 by Bjørn Rosell
//	Find more scripts here: www.prototypeDHTML.net

Number.prototype.toSource=function() {
	return this+''
}
String.prototype.toSource=function() {
	var s=this
	s=s.replace(/\\/g, "\\\\")
	s=s.replace(/\"/g, "\\\"")
	s=s.replace(/\n/g, "\\n")
	s=s.replace(/\r/g, "")
	return '"'+s+'"'
}
Boolean.prototype.toSource=function() {
	return this+''
}
Function.prototype.toSource=function() {
	return this+''
}
Array.prototype.toSource=function() {
	var a=this
	var s1='['
	if (a.length>0) {
		for (var i=0;i<a.length;i++) {
			if ((a[i]+'')=='undefined') {
				s1+=', '
				continue;
			}
			s1+=a[i].toSource()+(i<a.length-1?',':'')
		}
	}
	s1+=']'
	return s1
}
Object.prototype.toSource=function() {
	var o=this
	if (o==null) return 'null'
	var s1=''
	for (var item in o) {
		if (item=="toSource") continue;
		if (o[item]==null) {
//			s1+=item+':null, '
			continue;
		}
		s1+=item+':'+o[item].toSource()+','
	}
	s1=s1.substr(0,s1.length-1)
	s1='{'+s1+'}'
	return s1
}
