function processform(tform){
	if(!checkminiregform(tform)) return false;
	return tipopup_sendform(tform, 0);	// first arg is the form, second arg is whether to close the popup when you get a response from the submission.
}






function tipopup_sendform(theform, closeonsend){
	var xmlHttp;
	
	try{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e){  // Internet Explorer  
		try	{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");      
				return false;      
			}
		}
	}
	
	// compile form fields
	var qs='';
	for(i=0; i<theform.elements.length; i++){
		if(theform.elements[i].type=='text' 
			|| theform.elements[i].type=='password'
			|| theform.elements[i].type=='select-one' 
			|| theform.elements[i].type=='hidden' 
			|| ((theform.elements[i].type=='radio' || theform.elements[i].type=='checkbox') && theform.elements[i].checked)
		){
			if(qs!='') qs+='&';
			qs+=theform.elements[i].name + "=" + theform.elements[i].value;
//		}else{
//			alert("type not found:" + theform.elements[i].type);
		}
	}

	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
//			alert("content updated");
			if(closeonsend==1){
				hidetipopup(); 
			}else{
				document.getElementById('tipopup_content').innerHTML=xmlHttp.responseText;
			}
		}
	}
	
	if(theform.method=='get'){
		xmlHttp.open("GET", theform.action + '?' + qs, true);
		xmlHttp.send(null);
		
	}else if(theform.method=='post'){
		xmlHttp.open("POST", theform.action, true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", qs.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(qs);
	}
	return false;
}

function loadtipopup(filename){
	// load content
	var xmlHttp;
		
	try{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e){  // Internet Explorer  
		try	{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");      
				return false;      
			}
		}
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
//			alert("content updated");
			document.getElementById('tipopup_content').innerHTML=xmlHttp.responseText;
			document.getElementById('tipopup_content').style.display='block';
			document.getElementById('tipopup_bg').style.display='block';
			self.scrollTo(0, 0);
		}
	}
//	alert("Making a request");
	xmlHttp.open("GET",filename,true);
	xmlHttp.send(null);	
	
}

function hidetipopup(){
	document.getElementById('tipopup_content').innerHTML='';
	document.getElementById('tipopup_content').style.display='none';
	document.getElementById('tipopup_bg').style.display='none';
}