// JavaScript Document
function getResultCode(result){
	var p = result.indexOf(' ');
	var ret = null;
	if(p > -1){
		try{ret = parseInt(result.substr(0, p));}catch(e){ret = null;}
	}
	return ret;
}
var agent = navigator.userAgent;
String.prototype.trim = function()
	{
		return this.replace(/(^[\s]*)|([\s]*$)/g, "");
	};

String.prototype.inc = function(k1, k2)
	{
		return k2 == null ? this.indexOf(k1) > -1 ? true : false : (k2 + this + k2) .indexOf(k2 + k1 + k2) > -1 ? true : false;
	};

String.prototype.toArray=function(key)
	{
		var l = this, v;
		if(key == null) key = "|";
		v = key;
		if(key == "n")
		{
			l = l.replace(/\r/g,"");
			v = "\n";
		}
		l = l.replace(new RegExp("(\\"+key+")+","g"), v).replace(new RegExp("^[\\" + key + "]*|[\\" + key + "]+$","g"), "");
		return l == "" ? new Array() : l.split(v);		
	};

Array.prototype.add = function(key)
{
	this[this.length] = key;
};
var is_Opr = agent.inc("Opera");
var is_IE = agent.inc("IE") && !is_Opr;
var is_IE4 = agent.inc("IE 4");
var is_IE5 = agent.inc("IE 5") || agent.inc("IE 4");
var is_IE5_5 = agent.inc("IE 5.5");
var is_IE6 = is_IE && !is_IE5;
var is_Moz = agent.inc("Mozilla") && !is_Opr && !is_IE;
function oo(obj){
	return typeof(obj) != "string" ? obj : (is_IE5 ? document.all(obj) : document.getElementById(obj));
}