plugindiv="";

// load url in specified div
function loadURL(url,pdiv,postdata,vid){

	plugindiv = pdiv;
	viewid = vid;
	urlhttp=null;
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		urlhttp=new XMLHttpRequest();
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		urlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (urlhttp!=null)
	{
		waitdiv=document.getElementById('zc_wait');
		if(waitdiv != null)
		waitdiv.style.display="block";
		//setTimeout('document.getElementById("zc_wait").style.display=""',1000);

		urlhttp.onreadystatechange=state_Change;
		if(!postdata){
		urlhttp.open("GET",url,true);
		urlhttp.send(null);
		}
		else{
			urlhttp.open("POST",url,true);
			urlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			urlhttp.setRequestHeader("Content-length", postdata.length);
			urlhttp.setRequestHeader("Connection", "close");
			urlhttp.send(postdata);
		}
	}
}

function state_Change(){
	// only if req shows "complete"
	if (urlhttp.readyState == 4) {
		// only if "OK"
		if (urlhttp.status == 200) {
			if(plugindiv != ""){
				pluginajax = document.getElementById(plugindiv);
				if(pluginajax != null)
					pluginajax.innerHTML = urlhttp.responseText;

				waitdiv=document.getElementById('zc_wait');
				if(waitdiv != null)
					waitdiv.style.display="none";
				refreshZ(viewid);
			}
		}
	}
}

