var xmlHttp;

function doAjax(inURL,inFunc,ret){
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Browser does not support our technology!");
		return;
	}
	
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
			if (inFunc){
				if (ret){
					eval(inFunc + '(\'' + xmlHttp.responseText + '\')');
				} else {
					eval(inFunc + '()');
				}
			}
		}
	}
	xmlHttp.open("GET",inURL,true)
	xmlHttp.send(null)
}

function GetXmlHttpObject(){ 
	var objXMLHttp = null;
	if (window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject){
		objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

function serialize (txt) {
	switch(typeof(txt)){
	case 'string':
		//if (txt !== 'forEach')
		//{
			return 's:'+txt.length+':"'+txt+'";';
		//}
	case 'number':
		if(txt>=0 && String(txt).indexOf('.') == -1 && txt < 65536) return 'i:'+txt+';';
		return 'd:'+txt+';';
	case 'boolean':
		return 'b:'+( (txt)?'1':'0' )+';';
	case 'object':
		var i=0,k,ret='';
		for(k in txt){
			if (k !== 'forEach' && k !== 'each' && k !== 'copy' && k !== 'remove' && k !== 'test' && k !== 'extend' && k !== 'associate' && k !== 'removeDuplicates' && k !== 'empty' && k !== 'indexOf'){
				//alert(isNaN(k));
				if(!isNaN(k)) k = Number(k);
				ret += serialize(k)+serialize(txt[k]);
				i++;
			}
		}
		return 'a:'+i+':{'+ret+'}';
	default:
		return 'N;';
		return undefined;
	}
}