/*Load by ghost, hello.world.ghost@gmail.com*/


var Load = {
  
  text: function getAjax(uri, type, handl)
        {
            var hash = new Object();
            var tempArray = new Array();
            var strArray1 = new Array();
            var strArray = new Array();
        
            strArray1 = uri.split("?");
            
            if(strArray1.length<2)
            {
                strArray1[0] = uri;
            }
            else
            {
                strArray = strArray1[1].split("&");
                for (var i = 0; i < strArray.length; i++) {
               	tempArray = strArray[i].split("=")
        	hash[tempArray[0]] = tempArray[1];
                }
            }
                
            if(type==false)
            {
                $.get( strArray1[0], hash, handl );
            }
            else
            {
                $.post( strArray1[0], hash, handl );
            }
        }
        
        
};






















var Load2 = {
        _def: function(uri, ret, method, handler, sync, ishow) {
                var req = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'), sh;

/*
		if (!ishow) {
			sh = StatusBar.write('Загрузка: ' + uri);
		}
*/
                if (method) {
                        
                        
                        
			if (uri.indexOf('?') != -1) {
        	                req.open('POST', uri.substring(0, uri.indexOf('?')), !sync);
                	        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        	req.send(uri.substring(uri.indexOf('?') + 1));
			} else {
	                        req.open('POST', uri, !sync);
        	                req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                	        req.send('');
			 }
                } else {

                        req.open('GET', uri, !sync);
                        req.send(null);
                }
		
                if (req.readyState == 4) {
/*
			if (!ishow) {
	                        StatusBar.del(sh);
			}
*/
                        if (typeof(handler) == 'function') {
                                handler(ret ? req.responseXML : req.responseText);
                        }
                } else {
                        req.onreadystatechange = function() {
                                if (req.readyState == 4) {
/*
					if (!ishow) {
                	                        StatusBar.del(sh);
					}
*/
					
                                        if (typeof(handler) == 'function') {
						handler(ret ? req.responseXML : req.responseText);
                                        }
                                }
                        }
                }
        },








        xml: function(uri, method, handler, sync, ishow) {
                var handlerHandler = function(x) {
                        if (typeof(handler) == 'function') {
                                handler(x);
                        }
                }

                this._def(uri, true, method, handlerHandler, sync, ishow);
        },

        xmlE: function(uri, method, handler, sync, ishow) {
                var handlerHandler = function(x) {
                        if (typeof(handler) == 'function') {
				if (x && x.documentElement && x.documentElement.tagName.toUpperCase() != 'ERROR') {
	                                handler(x);
	       	                } else {
        	       	                alert(x && x.documentElement && x.documentElement.firstChild ? x.documentElement.firstChild.nodeValue : '?');
                	       	}
                        }
                }

                this._def(uri, true, method, handlerHandler, sync, ishow);
        },

        xmlNE: function(uri, method, handler, sync, ishow) {
                var handlerHandler = function(x) {
                        if (typeof(handler) == 'function') {
				if (x && x.documentElement && x.documentElement.tagName.toUpperCase() != 'ERROR') {
	                                handler(x);
	       	                }
                        }
                }

                this._def(uri, true, method, handlerHandler, sync, ishow);
        },








        text: function(uri, method, handler, sync, ishow) {
                
		
		var handlerHandler = function(t) {
			
                        if (typeof(handler) == 'function') {
                                handler(t);
                        }
                }
                
                this._def(uri, false, method, handlerHandler, sync, ishow);
		
        },

        textE: function(uri, method, handler, sync, ishow) {
                var handlerHandler = function(t) {
                        if (typeof(handler) == 'function') {
				if (t && t.indexOf('<error>') == -1) {
	                                handler(t);
				} else {
					alert(t && t.indexOf('<error>') != -1 ? t.substring(t.indexOf('<error>') + 7, t.indexOf('</error>')) : '?');
		        	}
                        }
                }

                this._def(uri, false, method, handlerHandler, sync, ishow);
        },

        textNE: function(uri, method, handler, sync, ishow) {
                var handlerHandler = function(t) {
                        if (typeof(handler) == 'function') {
				if (t && t.indexOf('<error>') == -1) {
	                                handler(t);
				}
                        }
                }

                this._def(uri, false, method, handlerHandler, sync, ishow);
        },








        css: function(uri, method, handler, sync, ishow) {
		var t;

		if (!document.styleSheets[0] || !document.styleSheets[0].cssText) {
			(t = document.getElementsByTagName('head')[0].insertBefore(document.createElement('style'), null)).setAttribute('type', 'text/css');
		}

                var handlerHandler = function(css) {
                        css = css.replace(/url\((['"])/ig, 'url($1' + uri.substring(0, uri.lastIndexOf('/') + 1));

                        if (document.styleSheets[0].cssText) {
                                document.styleSheets[0].cssText += css;
                        } else {
//                                document.styleSheets[0].ownerNode.innerHTML += css;
				t.insertBefore(document.createTextNode(css), null);
                        }

                        if (typeof(handler) == 'function') {
                                handler();
                        }
                }

                this._def(uri, false, method, handlerHandler, sync, ishow);
        }
};