function getQueryVariable(v) {
	var q = window.location.search.substring(1);
	var vars = q.split('&');
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split('=');
		if (pair[0] == v) {
			return pair[1];
		}
	}
	return '';
}

var tres = getQueryVariable('res');
var tname = getQueryVariable('name');
var temail = getQueryVariable('email');
var tlocation = getQueryVariable('location');
var tphone = getQueryVariable('phone');
var ttext = getQueryVariable('text');

if (tres=='bot') {
	document.write('<p>We\'re sorry, but your form is being flagged as a spam attempt.  Please <a href="/contact.html">contact us</a> for assistance.</p>');
}
else if (tres=='success') {
	document.write('<p>Thank you for your testimonial!  We always appreciate hearing from our customers.</p>');
}
else {
	if (tres=='incomplete') {
		document.write('<p>You did not fill out all required forms.  You must fill out your name, e-mail address, and your testimonial.</p>');
	}
	else if (tres=='wrongformat') {
		document.write('<p>Your attachment was in an unrecognized format.  We accept attachments in the following file formats: .jpg, .gif, .png, .bmp.</p>');
	}
	else if (tres=='error') {
		document.write('<p>There was an error processing the form.  We apologize for the inconvenience.  Please contact us directly at <a href="marketing@ameribag.com">marketing@ameribag.com</a>.</p>');
	}
	else {
	}
	document.testimonialform.testimname.value = urldecode(tname);
	document.testimonialform.testimemail.value=urldecode(temail);
	document.testimonialform.testimlocation.value=urldecode(tlocation);
	document.testimonialform.testimphone.value=urldecode(tphone);
	document.testimonialform.testimtext.value=urldecode(ttext);
}
