// JavaScript Document
function trackForm(form) {
	if(checkValue(form)) { 
		insitePost(form); 
	}
	setTimeout(function(){form.submit();},500); // increase this value if it's not tracking properly
}

function checkValue(form) {

	// Add additional fields if needed or more advanced validation below here.
	if (form.Name.value == "") { return false; }
	
	return true;
}

function insitePost(form) {

	//save the action to insite
	url = "http://www.topfloortech.com/insitemetrics/uRMJ/uniformv2.php";
	url += "?actk=yd6fp6-4hyi533suh"; //unique action key
	url += "&imReferrerField=" + escape(document.referrer);
	url += "&imEmailField=" + escape(form.Email.value);
	url += "&Name=" + escape(form.Name.value);
	url += "&Phone=" + escape(form.Phone.value);
	url += "&Company=" + escape(form.CompanyName.value);
	url += "&Address=" + escape(form.Address.value);
	url += "&City=" + escape(form.City.value);
	url += "&State=" + escape(form.State.value);
	url += "&Zip=" + escape(form.Zip.value);
	url += "&Country=" + escape(form.Country.value);
	//url += "&Title=" + escape(form.Title.value);
	url += "&Website=" + escape(form.CompanyWebsite.value);
	url += "&Fax=" + escape(form.Fax.value);
	url += "&StockSize=" + escape(form.StockSize.value);
	url += "&FinishSize=" + escape(form.FinishSize.value);
	url += "&Quantity=" + escape(form.Quantity.value);
	url += "&Hardness=" + escape(form.Hardness.value);
	url += "&TensileStrength=" + escape(form.TensileStrength.value);
	url += "&YieldStrength=" + escape(form.YeildStrength.value);
	url += "&TypicalFailureMode=" + escape(form.TypicalFailureMode.value);
	url += "&PreviousSteels=" + escape(form.PreviousSteels.value);
	url += "&NameofPart=" + escape(form.NameofPart.value);
	//alert(url);
	img = new Image(0,0);
 	img.src = url;
}
