

var swf_html = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ';
			swf_html+= 'WIDTH="32" HEIGHT="15" id="photo" ALIGN="">';
			swf_html+= '<PARAM NAME=movie VALUE="/images/waitfor.swf"><PARAM NAME=quality VALUE=high>';
			swf_html+= '<param name="wmode" value="transparent">'; 			
			swf_html+= '<PARAM NAME=bgcolor VALUE=#ffffff>';
			swf_html+= '<EMBED src="/images/waitfor.swf" quality=high bgcolor=#ffffff wmode="transparent"  WIDTH="32" HEIGHT="15" NAME="photo"';
			swf_html+= ' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"><\/EMBED><\/OBJECT>';;
			
var tiptext= swf_html+"数据装载中，请稍候......";

function ajax_get(url,div,tipobj)
{
	var spanObj =  document.getElementById(tipobj);

	spanObj.style.display="";
	
	spanObj.innerHTML= tiptext;
		
	var ajax = new pubPopAjax(); 
	var ajax_o = new Ajax_callback_object();

	ajax_o.div = div;
	ajax.get(url,ajax_o,spanObj);
}

function ajax_getNo(url,div,tipobj)
{
	var spanObj =  document.getElementById(tipobj);
	spanObj.style.display="";
	spanObj.innerHTML= "";
					
	var ajax = new pubPopAjax(); 
	var ajax_o = new Ajax_callback_object();

	ajax_o.div = div;
	ajax.get(url,ajax_o,spanObj);
}


function ajax_post(url,q,div,tipobj)
{
	var spanObj =  document.getElementById(tipobj);
	spanObj.style.display="";
	spanObj.innerHTML= tiptext;
	var ajax = new pubPopAjax(); 
	var ajax_o = new Ajax_callback_object();
	ajax_o.div = div;
	ajax.post(url,q,ajax_o,spanObj);
}

function Ajax_callback_object() {
	
	this.div = '';
	this.callback = show_div;
	
	function show_div(response,tipobj){
		tipobj.innerHTML="";
		document.getElementById(this.div).innerHTML=response;
	}
}

function generate_post_query(f){
	var q='';
	for(var i=0;i<f.elements.length;i++){
		if(i!=0);q+='&';
		q+=f.elements[i].name+'='+f.elements[i].value;
	}
	return q;
}

function create_xmlhttp() { 
	if(window.XMLHttpRequest) { 
	
		req = new XMLHttpRequest(); 
	} else if(window.ActiveXObject) { 
	
		req = new ActiveXObject("Microsoft.XMLHTTP"); 
	} 
	return req; 
} 
	
// ajax class 
function pubPopAjax() { 
	this.xmlhttp = create_xmlhttp(); 
	
	this.get = ajax_get; 
	this.post = ajax_post; 
	
	this.response = ''; 
	this.callback_object = ''; 

	
	function ajax_get(url,callback_object,tipobj) { 
	
		this.callback_object = callback_object; 
		
		var this_obj = this; 

		this.xmlhttp.onreadystatechange = function() { 
			if(this_obj.xmlhttp.readyState == 4) { 
				if(this_obj.xmlhttp.status == 200) { 
					this_obj.callback_object.callback(this_obj.xmlhttp.responseText,tipobj);
				} else { 
					alert('There was a problem with the request. ('+this_obj.xmlhttp.status+')'); 
				} 
			} 
		} 
		this.xmlhttp.open("GET", url, true); 
		this.xmlhttp.send(null);
		
		return true; 
	}
	
	function ajax_post(url, query, callback_object,tipobj) { 
	
		this.callback_object = callback_object; 
		
		var this_obj = this; 
	
		this.xmlhttp.onreadystatechange = function() { 
			if(this_obj.xmlhttp.readyState == 4) { 
				if(this_obj.xmlhttp.status == 200) { 
				
					this_obj.callback_object.callback(this_obj.xmlhttp.responseText,tipobj);
					
				} else { 
					alert('There was a problem with the request. (' + this_obj.xmlhttp.status + ')'); 
				} 
			} 
		} 
	
		this.xmlhttp.open('POST', url); 
		
		this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
		this.xmlhttp.send(query); 
		return true; 
	} 
} 
