function unserialize(str)
{
  // Taras Ozarko

	function readVar()
	{
		var r, t, tmp, k, v, l = 0;
		
		switch(read(2))
		{
			case "N;":
				r = null;
				break;
			case "b:":
				if(t = read(";").match(/^(\d);$/)) r = parseInt(t[1]) == 1;
				break;
			case "i:":
				if(t = read(";").match(/^(\-?\d+);$/)) r = parseInt(t[1]);
				break;
			case "d:":
				if(t = read(";").match(/^(\-?\d+\.\d+);$/)) r = parseFloat(t[1]);
				break;
			case "s:":
				if(t = read('"').match(/^(\d+):"$/))
				{
					l = parseInt(t[1]);
					if((t = read(l+2)) && t.substr(l) == '";') r = t.substr(0, l);
				}
				break;
			case "a:":
				if(t = read("{").match(/^(\d+):\{$/))
				{
					tmp = new Array();
					while(l < t[1])
					{
						k = readVar();
						v = readVar();
						if(((typeof k != "number" || k != parseInt(k)) && typeof k != "string") || typeof v == "undefined") break;
						tmp[k] = v;
						l++;
					}
					if(l == t[1] && read(1) == "}") r = tmp;
				}
				break;
			case "O:":
				if((t = read("{").match(/^(\d+):"([A-Za-z\d_]+)":(\d+):\{$/)) && t[1] == t[2].length)
				{
					tmp = new Object();
					while(l < t[3])
					{
						k = readVar();
						v = readVar();
						if(typeof k != "string" || typeof v == "undefined") break;
						eval("tmp."+k+" = v;");
						l++;
					}
					if(l == t[3] && read(1) == "}") r = tmp;
				}
				break;
		}
		return r;
	}//readVar
	
	var position = 0;
	function read(l)
	{
		var c = "";
		if(typeof l == "number")
		{
			c = position + l <= str.length ? str.substr(position, l) : "";
			position += l;
		}
		else
		{
			while(c.substring(c.length-1) != l) c += read(1);
		}
		return c;
	}//read
	
	return readVar();
}//unserialize

function print_r(o,m){// Taras Ozarko
var c="";function p(o,l){var c="";if(!l)l=0;if(o&&(o.constructor==Array||o.constructor==Object))
{c+=(o.constructor==Array?"Array":"Object")+"\n"+w(l*2)+"(\n";
for(var i in o)if(typeof o[i]!="function")c+=w(l*2+1)+"["+i+"] => "+p(o[i],l+1);c+=w(l*2)+")\n\n";}
else c+=o+"\n";return c;}function w(n){var c="";for(var i=0;i<n*4;i++)c+=" ";return c;}
c=p(o);if(!m)c=document.write(c);return c;}

function _test(v){alert(print_r(v,1));}

function stripslashes(s){return String(s).replace(/\\\\/g,'\\').replace(/\\\'/g,'\'').replace(/\\\"/g,'"');}
