/*
	prototype utility
	2007-11-21 kevin han
*/

Prototype.Browser.IE6 = (navigator.userAgent.indexOf("MSIE 6.0") >=0);

function getPageSize() { // browser 1page의 width
	var dd = document.documentElement, db = document.body;
	var w = document.body.clientWidth; // IE Quirks
	var h = document.body.clientHeight;
	if( typeof( window.innerWidth ) == 'number' ) { // FF
		w = window.innerWidth;
		h = window.innerHeight;
	}
	else if (dd) { // IE6+ Strict
		if (dd.clinetWidth) {
			w = dd.clientWidth;
			h = dd.clientHeight;
		}
		else if (dd.offsetWidth) {
			w = dd.offsetWidth;
			h = dd.offsetHeight;
		}
	}

	return {w:w, h:h};
}


function setScrollPos(x, y) {
	// document.documentElement 는 IE strict 모드에서만 존재한다.
	// margin을 생각할때 clientLeft를 빼는것도 고려해야할 필요가 있다. 
	var dd = document.documentElement, db = document.body;
	if (dd && dd.scrollTop != undefined) {
		document.documentElement.scrollLeft = x;
		document.documentElement.scrollTop = y;
	} else if (db) {
		document.body.scrollLeft = x;
		document.body.scrollTop = y;
	}
}

Element.addMethods({
	move: function(element, x,y) {
		var element = $(element);
		element.setStyle({left:x+"px", top: y+"px"});
	},

	getObjectScreenRect: function (element) {
		var element = $(element);
		var org = element.cumulativeOffset();
		var rc = new Rect(org.left, org.top, org.left+element.offsetWidth, org.top+element.offsetHeight);
		
		return rc;
	},

	getObjectRect: function(element) {
		var element = $(element);
		var org = element.positionedOffset();
		var rc = new Rect(org.left, org.top, org.left+element.clientWidth, org.top+element.clientHeight);
		
		return rc;
	},

	setObjectRect: function(element, x,y, w, h) {		
		var element = $(element);
		w=w!=undefined?w:0;
		h=h!=undefined?h:0;

		if (x.getWidth) { // if rect
			var rc = x;
			x = rc.left;
			y = rc.top;
			w = rc.getWidth();
			h = rc.getHeight();
		}

		element.setStyle({width: w+"px", height: h+"px"});
	}
});

function _addPrototype (obj, arg) {
	var proto = obj.prototype;
	for (name in arg) {
		proto[name] = arg[name];
	}

	return obj;
}


function Rect(l,t,r,b) {
	if (arguments.length == 4)
		this.setRect(l,t,r,b);
}


_addPrototype( Rect, {

	left:0,top:0,right:0,bottom:0,
	
	setRect:function(l,t,r,b) {
		if (arguments.length == 1) {
			var rc = l;
			this.left = rc.left;
			this.top = rc.top;
			this.right = rc.right;
			this.bottom = rc.bottom;
		}
		else {
			this.left=l;this.right=r;
			this.top=t;this.bottom=b;
		}

		return this;
	},
	getWidth : function() {
		return this.right-this.left;
	},
	getHeight : function() {
		return this.bottom-this.top;
	},
	ptInRect:function(x,y) {
		if (x>=this.left && x<=this.right && y>=this.top && y<=this.bottom)
			return true;
		return false;
	},
	rectInRect: function(rc) {
		if (this.left <= rc.left && this.right >= rc.right && this.top <= rc.top && this.bottom >= rc.bottom)
			return true;
		return false;
	},

	offset:function(dx,dy) {
		this.left+=dx;
		this.right+=dx;
		this.top+=dy;
		this.bottom+=dy;

		return this;
	},

	adjust: function(l,t,r,b) {
		this.left+=l;
		this.right+=r;
		this.top+=t;
		this.bottom+=b;
		
		return this;
	},

	normalize: function() {
		var l = this.left, r = this.right;
		var t = this.top, b = this.bottom;
		this.left = Math.min(l,r);
		this.right = Math.max(l,r);
		this.top = Math.min(t,b);
		this.bottom = Math.max(t,b);

		return this;
	},

	clone: function() {
		return new Rect(this.left, this.top, this.right, this.bottom);
	},

	toArray: function() {
		return [this.left, this.top, this.right, this.bottom];
	}
});


/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }

/*
 * Perform a simple self-test to see if the VM is working
 */
function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}

/*
 * Calculate the MD5 of an array of little-endian words, and a bit length
 */
function core_md5(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;

  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);

}

/*
 * These functions implement the four basic operations the algorithm uses.
 */
function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}

/*
 * Calculate the HMAC-MD5, of a key and some data
 */
function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}

/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

/*
 * Bitwise rotate a 32-bit number to the left.
 */
function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

/*
 * Convert a string to an array of little-endian words
 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
 */
function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}

/*
 * Convert an array of little-endian words to a string
 */
function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}

/*
 * Convert an array of little-endian words to a hex string.
 */
function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

/*
 * Convert an array of little-endian words to a base-64 string
 */
function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 2005.12.20
// kevin han
// xml processing
// charset = UTF-8 (w/o BOM)


// Original source code is below copyright.
// jkl-parsexml.js ---- JavaScript Kantan Library for Parse XML
//  Copyright 2005-2006 Kawasaki Yusuke <u-suke@kawa.net>
//  http://www.kawa.net/works/js/jkl/parsexml.html

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// nus.xml


nus = {};

function _addPrototype (obj, arg) {
	var proto = obj.prototype;
	for (name in arg) {
		proto[name] = arg[name];
	}

	return obj;
}


nus.xml = {
	getValueFromXML:function(xmlNode, xmlTag) {
		var value = -9999;
		var oNode = xmlNode.selectSingleNode(xmlTag);
		if (oNode == null) return value;
		value = oNode.nodeTypedValue;
		oNode = null;
		return value;
	},
	getStringFromXML:function(xmlNode, xmlTag) {
		var str = "";
		var oNode = xmlNode.selectSingleNode(xmlTag);
		if (oNode == null) return str;
		str = oNode.nodeTypedValue;
		oNode = null;

		return str;
	},
	getAttributeFromXML:function(xmlNode, xmlTag, attrName) {
		var str = "";
		var oNode = xmlNode.selectSingleNode(xmlTag);
		if (oNode == null) return str;
		str = oNode.attributes.getNamedItem(attrName).nodeValue;
		oNode = null;

		return str;
	},
	createXMLDOM: function() {
		var xmlDoc = null;
		var progID = ["MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument.6.0"];
		for(var i=0, id; id=progID[i]; i++) {
			try
			{
				xmlDoc = new ActiveXObject(id);
			}
			catch (e)
			{
			}

			if (xmlDoc) break;
		}
		
		return xmlDoc;
	},
	load: function(path) {
		var xmlDoc = null;
		if (window.ActiveXObject) {
            var xmlDoc = this.createXMLDOM();
			if (!xmlDoc) return null;
            xmlDoc.async = false;
            xmlDoc.load(path);
		}
        else if(document.implementation && document.implementation.createDocument) {
            var objDOMParser = new DOMParser();
            xmlDoc = objDOMParser.load(path);
			delete objDOMParser;
        }

		return xmlDoc;
	},

	loadXML: function(text) {
		var xmlDoc = null;
		if (window.ActiveXObject) {
            var xmlDoc = this.createXMLDOM();
			if (!xmlDoc) return null;
            xmlDoc.async = false;
            xmlDoc.loadXML(text);
		}
        else if(document.implementation && document.implementation.createDocument) {
            var objDOMParser = new DOMParser();
			xmlDoc = objDOMParser.parseFromString(text, "text/xml");
			delete objDOMParser;
        }

		return xmlDoc;
	},

	toJson: function(xmlDoc) {
		var temp = new nus.xml.Xml2Json(xmlDoc);
		var json = temp.json;
		temp = null;
		delete temp;

		return json;
	}
};


nus.xml.Xml2Json = function(xml) {
	if (xml) {
		if (xml.constructor == String) {
			this.parseXML(xml);
		}
		else {
			this.parseDocument(xml);
		}
	}
}

_addPrototype(nus.xml.Xml2Json, {

	json:null,

	setOutputArrayAll:function () {
		this.setOutputArray( true );
	},
	
	//  a child into scalar, children into array
	setOutputArrayAuto:function () {
		this.setOutputArray( null );
	},
	
	//  every child/children into scalar (first sibiling only)
	setOutputArrayNever:function () {
		this.setOutputArray( false );
	},
	
	//  specified child/children into array, other child/children into scalar
	setOutputArrayElements:function ( list ) {
		this.setOutputArray( list );
	},
	
	//  specify how to treate child/children into scalar/array
	setOutputArray:function ( mode ) {
		if ( typeof(mode) == "string" ) {
			mode = [ mode ];                // string into array
		}
		if ( mode && typeof(mode) == "object" ) {
			if ( mode.length < 0 ) {
				mode = false;               // false when array == [] 
			} else {
				var hash = {};
				for( var i=0; i<mode.length; i++ ) {
					hash[mode[i]] = true;
				}
				mode = hash;                // array into hashed array
				if ( mode["*"] ) {
					mode = true;            // true when includes "*"
				}
			} 
		} 
		this.usearray = mode;
	},

	// ================================================================
	//  method: addNode( hash, key, count, value )
	
	addNode:function ( hash, key, cnts, val ) {
		if ( this.usearray == true ) {              // into array
			if ( cnts == 1 ) hash[key] = [];
			hash[key][hash[key].length] = val;      // push
		} else if ( this.usearray == false ) {      // into scalar
			if ( cnts == 1 ) hash[key] = val;       // only 1st sibling
		} else if ( this.usearray == null ) {
			if ( cnts == 1 ) {                      // 1st sibling
				hash[key] = val;
			} else if ( cnts == 2 ) {               // 2nd sibling
				hash[key] = [ hash[key], val ];
			} else {                                // 3rd sibling and more
				hash[key][hash[key].length] = val;
			}
		} else if ( this.usearray[key] ) {
			if ( cnts == 1 ) hash[key] = [];
			hash[key][hash[key].length] = val;      // push
		} else {
			if ( cnts == 1 ) hash[key] = val;       // only 1st sibling
		}
	},

	// ================================================================
	//  convert from DOM Element to JavaScript Object 
	//  method: parseElement( element )
	parseElement:function ( elem ) {
		// debug.print( "nodeType: "+JKL.ParseXML.MAP_NODETYPE[elem.nodeType]+" <"+elem.nodeName+">" );
	
		//  COMMENT_NODE
	
		if ( elem.nodeType == 7 ) {
			return;
		}
	
		//  TEXT_NODE CDATA_SECTION_NODE
	
		if ( elem.nodeType == 3 || elem.nodeType == 4 ) {
			// var bool = elem.nodeValue.match( /[^\u0000-\u0020]/ );
			var bool = elem.nodeValue.match( /[^\x00-\x20]/ ); // for Safari
			if ( bool == null ) return;     // ignore white spaces
			// debug.print( "TEXT_NODE: "+elem.nodeValue.length+ " "+bool );
			return elem.nodeValue;
		}
	
		var retval;
		var cnt = {};
	
		//  parse attributes
	
		if ( elem.attributes && elem.attributes.length ) {
			retval = {};
			for ( var i=0; i<elem.attributes.length; i++ ) {
				var key = elem.attributes[i].nodeName;
				if ( typeof(key) != "string" ) continue;
				var val = elem.attributes[i].nodeValue;
				if ( ! val ) continue;
				if ( typeof(cnt[key]) == "undefined" ) cnt[key] = 0;
				cnt[key] ++;
				this.addNode( retval, key, cnt[key], val );
			}
		}
	
		//  parse child nodes (recursive)
	
		if ( elem.childNodes && elem.childNodes.length ) {
			var textonly = true;
			if ( retval ) textonly = false;        // some attributes exists
			for ( var i=0; i<elem.childNodes.length && textonly; i++ ) {
				var ntype = elem.childNodes[i].nodeType;
				if ( ntype == 3 || ntype == 4 ) continue;
				textonly = false;
			}
			if ( textonly ) {
				if ( ! retval ) retval = "";
				for ( var i=0; i<elem.childNodes.length; i++ ) {
					retval += elem.childNodes[i].nodeValue;
				}
			} else {
				if ( ! retval ) retval = {};
				for ( var i=0; i<elem.childNodes.length; i++ ) {
					var key = elem.childNodes[i].nodeName;
					if ( typeof(key) != "string" ) continue;
					var val = this.parseElement( elem.childNodes[i] );
					if ( ! val ) continue;
					if ( typeof(cnt[key]) == "undefined" ) cnt[key] = 0;
					cnt[key] ++;
					this.addNode( retval, key, cnt[key], val );
				}
			}
		}
		return retval;
	},


	// ================================================================
	//  convert from DOM root node to JavaScript Object 
	//  method: parseElement( rootElement )
	
	parseDocument: function ( xml ) {
		this.json = {};

		var root = xml.documentElement;
		if ( ! root ) return;
	
		var ret = this.parseElement( root );            // parse root node
		// debug.print( "parsed: "+ret );
	
		if ( this.usearray == true ) {                  // always into array
			ret = [ ret ];
		} else if ( this.usearray == false ) {          // always into scalar
			//
		} else if ( this.usearray == null ) {           // automatic
			//
		} else if ( this.usearray[root.nodeName] ) {    // specified tag
			ret = [ ret ];
		}
	
		this.json[root.nodeName] = ret;                      // root nodeName
		
		return this.json;
	},

	parseXML: function( xmlText ) {
		var xmlDoc = null;
        if(document.implementation && document.implementation.createDocument) {
            var objDOMParser = new DOMParser();
            xmlDoc = objDOMParser.parseFromString(xmlText, "text/xml");
			delete objDOMParser;
        } else if (window.ActiveXObject) {
            var xmlDoc = nus.xml.createXMLDOM();
			if (!xmlDoc) return;

            xmlDoc.async = false;
            xmlDoc.loadXML(xmlText);
			//xmlDoc.load("pet_neko.xml");
        }
		
		this.parseDocument(xmlDoc);
		delete xmlDoc;

		return this.json;
	}

});

scriptTransport = Class.create();
//modeled after XmlHttpRequest http://en.wikipedia.org/wiki/XMLHttpRequest
//functions open, send (setRequestHeader) - variable readyState, status
//
//    * 0 = uninitialized - open() has not yet been called.
//    * 1 = open - send() has not yet been called.
//    * 2 = sent - send() has been called, headers and status are available.
//    * 3 = receiving - Downloading, responseText holds partial data.
//    * 4 = loaded - Finished.

//TODO:
//Removal of <script> nodes?

//
//------------------------------ initialize, open and send ------------------------------------------------------
//

scriptTransport.prototype.initialize = function() {
    this.readyState = 0;
}

scriptTransport.prototype.open = function(method, url, asynchronous) {
    if (method != 'GET')
    alert('Method should be set to GET when using cross site ajax');
    this.readyState = 1;
    this.onreadystatechange();
    this.url = url;
    this.userAgent = navigator.userAgent.toLowerCase();
    this.setBrowser();
    this.prepareGetScriptXS();
}

scriptTransport.prototype.send = function(body) {
    this.readyState = 2;
    this.onreadystatechange();
    this.getScriptXS(this.url);
}

//
//------------------------------ actually do the request: setBrowser, prepareGetScriptXS, callback, getScriptXS ----------
//

scriptTransport.prototype.setBrowser = function(body) {
    scriptTransport.prototype.browser = {
        version: (this.userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
        safari: /webkit/.test(this.userAgent),
        opera: /opera/.test(this.userAgent),
        msie: /msie/.test(this.userAgent) && !/opera/.test(this.userAgent),
        mozilla: /mozilla/.test(this.userAgent) && !/(compatible|webkit)/.test(this.userAgent),
        konqueror: this.userAgent.match(/konqueror/i)
        };
}

scriptTransport.prototype.prepareGetScriptXS = function() {
    if (this.browser.safari || this.browser.konqueror) {
        _xsajax$node = [];
        _xsajax$nodes = 0;
    }
}

scriptTransport.prototype.callback = function() {
    this.status = 200;//(_xsajax$transport_status != undefined) ? _xsajax$transport_status : 200;
    this.readyState = 4;
    this.onreadystatechange();
}

scriptTransport.prototype.getScriptXS = function() {

    /* determine arguments */
    var arg = {
        'url': null
    };
    arg.url = arguments[0];

    /* generate <script> node */
    this.node = document.createElement('SCRIPT');
    this.node.type = 'text/javascript';
    this.node.src = arg.url;

    /* optionally apply event handler to <script> node for
   garbage collecting <script> node after loading and/or
   calling a custom callback function */
    var node_helper = null;

    if (this.browser.msie) {

        function mybind(obj) {
            temp = function() {
                if (this.readyState == "complete" || this.readyState == "loaded") {
                    return obj.callback.call(obj);
                }
            };
            return temp;
        }
        /* MSIE doesn't support the "onload" event on
           <script> nodes, but it at least supports an
           "onreadystatechange" event instead. But notice:
           according to the MSDN documentation we would have
           to look for the state "complete", but in practice
           for <script> the state transitions from "loading"
           to "loaded". So, we check for both here... */
        this.node.onreadystatechange = mybind(this);

        } else if (this.browser.safari || this.browser.konqueror) {
        /* Safari/WebKit and Konqueror/KHTML do not emit
           _any_ events at all, but we can exploit the fact
           that dynamically generated <script> DOM nodes
           are executed in sequence (although the scripts
           theirself are still loaded in parallel) */
        _xsajax$nodes++;

        var helper = 'var ctx = _xsajax$node[' + _xsajax$nodes + '];' + 'ctx.callback.call(ctx.node);' + 'setTimeout(function () {' + '    ctx.node_helper.parentNode.removeChild(ctx.node_helper);' + '}, 100);';
        node_helper = document.createElement('SCRIPT');
        node_helper.type = 'text/javascript';
        node_helper.appendChild(document.createTextNode(helper));
        _xsajax$node[_xsajax$nodes] = {
            callback: this.callback.bind(this),
            node: this.node,
            node_helper: node_helper
        };
    } else {
        /* Firefox, Opera and other reasonable browsers can
           use the regular "onload" event... */
        this.node.onload = this.callback.bind(this);
    }

    /* inject <script> node into <head> of document */
    this.readyState = 3;
    this.onreadystatechange();
    var head = document.getElementsByTagName('HEAD')[0];
    head.appendChild(this.node);

    /* optionally inject helper <script> node into <head>
   (Notice: we have to use a strange indirection via
   setTimeout() to insert this second <script> node here or
   at least Konqueror (and perhaps also Safari) for unknown
   reasons will not execute the first <script> node at all) */
    if (node_helper !== null) {
        setTimeout(function() {
            var head = document.getElementsByTagName('HEAD')[0];
            head.appendChild(node_helper);
        }, 100);
    }

}

//
//------------------------------ Don't complain when these are called: setRequestHeader and onreadystatechange ----------
//

scriptTransport.prototype.setRequestHeader = function() {
}
scriptTransport.prototype.onreadystatechange = function() {
}

//
//------------------------------- Extend prototype a bit -----------------------
//
Ajax.Request.prototype = Object.extend(Ajax.Request.prototype,{
    initialize: function(url, options) {
		Ajax.Base.prototype.initialize.apply(this, [options]);
        this.transport = (!this.options.crossSite) ? Ajax.getTransport() : new scriptTransport;
        this.request(url);
        }    
});

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;