YMS={
	A:{
		GetXmlHttpObject:function(){
			var xmlHttp=null;
			try{
				xmlHttp=new XMLHttpRequest();
			}
			catch (e){
				try{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e){
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			return xmlHttp;
		},
		stateChanged:function(){
			if (xmlHttp.readyState==4)
				document.getElementById("maincontent").innerHTML=xmlHttp.responseText;
		}
	},
	F:function(id){
		return document.getElementById(id).value;
	},
	sendForm:function(form){
		var loader = new Image;
		loader.src='http://www.yaomandarinschool.com/images/loader.gif';
		loader.alt='Loading...';
		document.getElementById('contactForm').appendChild(loader);
		var url=[
			'contact_form_send.php?',
			'first_name=',
			YMS.F('first_name'),
			'&last_name=',
			YMS.F('last_name'),
			'&office_phone=',
			YMS.F('office_phone'),
			'&house_phone=',
			YMS.F('house_phone'),
			'&email=',
			YMS.F('email'),
			'&note=',
			YMS.F('note'),
			'&submitted=TRUE&sid=',
			Math.random(),
			'&async=TRUE'
		].join('');
		xmlHttp=YMS.A.GetXmlHttpObject();
		if(xmlHttp==null)
			return false;
		xmlHttp.onreadystatechange=YMS.A.stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return true;
	},
	resetForm:function(){
		xmlHttp=YMS.A.GetXmlHttpObject();
		if(xmlHttp==null)
			return false;
		xmlHttp.onreadystatechange=YMS.A.stateChanged;
		xmlHttp.open("GET",'contact_form_send.php',true);
		xmlHttp.send(null);
		return true;
	}
}

