

var country_selected = '';
var usa = 'United States';

function insitePost(formId) {
	// Set Insite Metrics URL
	var url = "http://www.topfloortech.com/insitemetrics/uRMJ/uniformv2.php";
	// Include other non-form variables
	url += "?imReferrerField=" + escape(document.referrer);
	url += "&imEmailField=" + escape($("[name=Email_REQ]").val());
	url += "&" + $('input,textarea', '#'+formId).not(':submit').serialize();	
	// Create image and use it to post the URL to Insite Metrics
	img = new Image(0, 0);
//	setTimeout(function(){img.src = url;}, 100);
	img.src = url;
	return true;
}

function checkValue(formId) {
	var printerror="The following item(s) must be filled in: ";
	$("input[name$=_REQ]").each(function() {
		var el = $(this);
		if(el.val() == '') {
			printerror += el.attr('name').replace(/\_REQ/,'').replace(/\_/g,' ') + "\n";
		}
	});
/*
	if($("#country").val() != usa) {
		$(".rqd_cntry").each(function() {
			var cntry_el = $(this);
			if(cntry_el.val() == '') {
				printerror += cntry_el.attr('name').replace(/\_/g, ' ') + "\n";
			}
		});
	}
*/	
	
	if ((document.getElementById('RUD_Finish3').checked)
   && (document.getElementById('Color_or_Paint_Spec').value == '')) { 
		printerror += "\nColor or Paint Spec";  
		}
        else { 
			return true; 
	}
	
	
	if (printerror == "The following item(s) must be filled in: ") {
		insitePost("rfqForm");
		return true;
	}else {
		alert(printerror);
		return false;
	}
}




jQuery(function($) {

	$("#rfqForm").submit(function() {
		var rtn = checkValue("rfqForm");
		return rtn;
	});
/*
	$("#country").change(function() {
		country_selected = this.value;
		if(country_selected != usa) {
			$("#fizzle").show();
		}
		else {
			$("#fizzle").hide();
		}
	});
*/
});

