function sendRequest(id,method,url,headers,datas){
	//alert(method+" "+url+" "+headers+" "+datas);
	//alert(headers);
	//alert('sendz');
	/*try {
		if (netscape.security.PrivilegeManager.enablePrivilege) {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
		}
	} catch (ex) { // eat it
	}*/
	var req=null;
    if (window.XMLHttpRequest){
      req = new XMLHttpRequest();
	  if (req.overrideMimeType) {
        req.overrideMimeType('text/xml');
      }
    }else if (window.ActiveXObject){
      req = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
		alert("wrong");
	}
	//req.id=id;
	//req.url=url;
	req.onreadystatechange=function(){
		//alert(req.readyState);
		if(req.readyState == 4){
			headers=req.getAllResponseHeaders();
			isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
			if(isInternetExplorer){
				headers=headers.split("\r\n");
			}else{
				headers=headers.split("\n");
			}
			var httpcode=req.status;
			var httpstatus=req.statusText;
			var response_headers={};
			for(var i=0;i<headers.length;i++){
				var name=headers[i].substr(0,headers[i].indexOf(":"));
				var value=headers[i].substr(headers[i].indexOf(":")+1);
				if(name.indexOf("phproxy_")!=-1){
					switch(name){
						case "phproxy_httpcode":
							httpcode=Number(value);
							break;
						case "phproxy_httpstatus":
							httpstatus=value;
						default:
							response_headers[headers[i].substring(15,headers[i].indexOf(":"))]=headers[i].substr(headers[i].indexOf(":")+1);
							break;
					}
				}
			}
			flash=isInternetExplorer?document.all.blogsync:document.blogsync;
			//output.innerHTML+=id+"<br/>";
			//alert(req.status+" | "+req.statusText+" "+req.getAllResponseHeaders()+" "+req.responseText);
			//alert(httpcode+"\n"+response_headers);
			flash["onHttpLoad"+id](httpcode,httpstatus,response_headers,req.responseText);
		}
	}
	var datastr='';
	if(typeof(datas)=="string"){
		datastr=datas;
	}else if(typeof(datas)=="object"){
		for(var i in datas){
			datastr+=i+"="+encodeURIComponent(datas[i])+"&";
		}
	}
	if(method=="GET" && datastr!=''){
		url+="?"+datastr;
	}
	//for proxy
	req.open(method,"/custom/tools/phproxy.php?r="+Math.random(),true);
	//req.open(method,"/custom/tools/phproxy.php?p="+url+"&r="+Math.random(),true);
	//if(headers!=''){
	for(var i=0;i<headers.length;i++){
		//alert(i+":"+headers[i]);
		var th=headers[i].split(":");
		req.setRequestHeader("ppheader_"+th[0],th[1]);
	}
	req.setRequestHeader("phproxy_url",url);
	//}
	if(method=="GET"){
		req.send('');
	}else{
		req.send(datastr);
	}
}
function makeflash(swfpath,width,height,vars){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="blogsync" align="left"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+swfpath+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="salign" value="lt" /><param name="flashVars" value="'+vars+'" /><embed loop="false" menu="true" debug="true" src="'+swfpath+'" quality="high" salign="lt" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="blogsync" salign="lt" flashVars="'+vars+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}
