
var undefined;function isUndefined(property){return(typeof property=='undefined');}
function bytelen(str){return unescape(encodeURIComponent(str)).length;}
if(!Array.prototype.indexOf)
{Array.prototype.indexOf=function(elt)
{var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)
from+=len;for(;from<len;from++)
{if(from in this&&this[from]===elt)
return from;}
return-1;};}
if(isUndefined(Array.prototype.concat)){Array.prototype.concat=function(secondArray){var firstArray=this.copy();for(var i=0;i<secondArray.length;i++){firstArray[firstArray.length]=secondArray[i];}
return firstArray;};}
if(isUndefined(Array.prototype.copy)){Array.prototype.copy=function(){var copy=new Array();for(var i=0;i<this.length;i++){copy[i]=this[i];}
return copy;};}
if(isUndefined(Array.prototype.remove)){Array.prototype.remove=function(item){var moving=false;for(var i=0;i<this.length;i++){if(this[i]==item)moving=true;if(moving)this[i-1]=this[i];}
this.length--;};}
Array.prototype.serialize=function(){var output="";var vtype="";var item="";for(var i=0;i<this.length;i++){item=this[i];if(typeof(item)=='string'){vtype='s';}else if(typeof(item)=='number'){vtype='i';item=item.toString();}else if(typeof(this[i])=='boolean'){vtype='b';item=item?"1":"0";}else if(typeof(this[i])=='object'){vtype='a';if(item==null){vtype='s';item='';}else if(item&&item.serialize){item=item.serialize();}else{alert('cannot serialize: '+this[i]);continue;}}else{vtype='s';item=item+'';}
var itemlength=(vtype=='s')?bytelen(item):item.length;output+=vtype+itemlength+'|'+item;}
return output;}
function array_copy(src){var copy=new Array();for(var i=0;i<src.length;i++){copy[i]=src[i];}
return copy;}