		// +--------------------------------------------------------+ 
		// | js version .x														 | 
		// +--------------------------------------------------------+ 
		// | Copyright : heo woong <comefeel.com>            | 
		// +--------------------------------------------------------+ 
		// | License  : GPLv3												| 
		// +--------------------------------------------------------+ 
		
		var Ajax = {

			__constructor : function( init ){

				this.rpc_list = new Array();
				this.loading = new Function();
				this.dynamic = true;
				this.error = function(errno){alert(errno);};
				this.application = 'application/x-www-form-urlencoded';
				this.char = 'UTF-8';
				this.head = top.document.getElementsByTagName('head').item(0);
				this.headers = {
					  'X-Requested-With': 'XMLHttpRequest',
					  'Accept' : 'text/javascript, text/html, application/xml, text/xml, */*'
				};

				this.foundIt( init , this );
			},

			rpc : function( rpc_variable , transfer_head ){

					this.rpc_list[this.rpc_list.length] = rpc_variable.length > 0 ? (transfer_head ? transfer_head : this.head).appendChild( rpc_variable.pop()) : false;
				return rpc_variable.length > 0 ? this.rpc( rpc_variable ) : this.rpc_list;
			},

			xml : function(req){

				try {

					return (new DOMParser()).parseFromString( req.responseText, 'text/xml' ).documentElement;
				}
				catch(e){

					return req.responseXML.documentElement;
				}
			},

			request : function(){

					var request = false;
					try {
						request = new XMLHttpRequest();
					}
					catch (trymicrosoft)
					{
						try {
							request = new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (othermicrosoft)
						{
							try {
								request = new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch ( e ) {
								request = e.status;
							}
						}
					}

				return request;
			},

			submit : function(){

					var that = this;
					var ajax = that.request();

					that.loading( ajax.readyState );
					that.query += /Konqueror|Safari|KHTML/.test(navigator.userAgent) ? '&_=' : '';
					ajax.open( that.method.toUpperCase() , that.url + String( that.method == 'get' && that.query.valueOf() != '' ? '?' + that.query : '' ) , that.dynamic );

					ajax.onreadystatechange = function(){

						that.loading( ajax.readyState );

						if( ajax.readyState == 4 ){

							if( ajax.status == 200 && typeof that.response == that.ty.fn )
								return that.response( ajax , that );
							else
								return that.error( ajax.status );
						}
					};

					if (that.method == 'post'){

						  that.headers['Content-type'] = that.application + ( that.char ? '; charset=' + that.char : '' );

						  if ( ajax.overrideMimeType &&  (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005 )
								that.headers['Connection'] = 'close';
					}

					that.foundIt(

						that.headers
						,
						function( args , value , that){

								ajax.setRequestHeader( value , args[0][value] );
							return true;
						}
					);

				return !ajax.send( that.query );
			},


			serialize : function( Form ){

				if( !Form ) return false;

					this.Form = Form;
					var memo =  new Array();
					void( this.foundIt(

						Form.getElementsByTagName('*')
						,

						function( args , value , that ){

								var obj = args[0][that.i];
								var Build = args[args.length -1];

								 var revert = Build[obj.tagName.toLowerCase()] ? Build[obj.tagName.toLowerCase()](obj , value , that) : false ;
								 if( revert != false ) 
									 memo[memo.length] = revert;

							return true;

						},{

								input : function( element , value , that ){
									switch( element.type.toLowerCase()){

										case 'checkbox' :
										case 'radio' : {

											return element.checked ? this.values(element) : false;
											break;
										};


										case 'password' :
										case 'hidden' :
										case 'text' : {

												var str = this.values(element);

											return str.indexOf('=') != -1 ? str : false ;
											break;
										};

										default : {
											return false;
										};
									}
								}
								,
								select : function( element , value , that ){
									switch( element.type.toLowerCase()){

										case 'select-one' : {

												var index = element.selectedIndex;
												return index >= 0 ? this.values(element , element.options[index]) : false;

											break;
										};

										default : {

												var letter = new Array();
												void( 
													
													new that.foundIt( element , function( childElements , childValue , there){

														var parents = childElements[childElements.length -1];
														var opt = element.options[there.i];

														if( there.i < element.length ){

															if(opt.selected) letter.push( parents.values(element , opt));
															return true;
														}
														else return false;
													} , this )
												);

											return letter.length > 0 ? letter : false;
										};
									}
								}
								,
								values : function( elements , selection ){

										var variable = selection || elements;

									return encodeURIComponent( elements.name || elements.id ) + '=' + encodeURIComponent( (variable.value || variable.getAttribute('value')) || (variable.text || variable.getAttribute('text')) || String());
								}
						}

					));

				return memo.join('&');
			}
		};
