var thFormID = '';
function submitContactForm(theForm) {
	if (Summit.Form.ValidateForm(theForm)) {
		thFormID = theForm.id;
		send('include/ajax/ajaxcall.php?do=submitContactForm&' + $(theForm.id).serialize(), 'submitContactFormResponse');
		return false;
	}
	return false;
}

function submitContactFormResponse() {
	if (XmlHttp.readyState==4){
		result = XmlHttp.responseText;
		XmlHttp=null;
		if (result>0) {
			$(thFormID).hide();
			$('errMsg').hide();
			$('thankYouMsg').show();
		} else {
			$('errMsg').show();
		}
		return false;
	}
}



var XmlHttp;
var curRequest="";
var responseTexts = new Array();
function createXMLHttp(txtURL) {
	var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp"];
    for (var i = 0; i < aVersions.length; i++) {
		try {
			if (navigator.appName!="Netscape") {
				var oXmlHttp = new ActiveXObject(aVersions[i]);
		    } else {
				var oXmlHttp = new XMLHttpRequest(); 
	    	}
			return oXmlHttp;
        } catch (oError) {
            //Do nothing
        }
    }
//	window.frames['ajaxLegacySupport'].location.href=txtURL;
//	id = window.setTimeout("afterBirksLegacy()",1000);
}

function send(txtURL, runFunction) {
	XmlHttp = createXMLHttp(txtURL);
	if (runFunction) {
		XmlHttp.onreadystatechange = eval(runFunction);
		XmlHttp.open("GET", txtURL);
	}
	XmlHttp.send(null);
}
