jQuery.fn.yswaddVerifyOptions = function() {
   return this.each(function() {
		jQuery("form",this).each(function(index){
			if (jQuery(this).attr('action').indexOf("test-order") >= 0 || jQuery(this).attr('action').indexOf("order.store.yahoo.") >= 0)
			{
				jQuery(this).submit(function(){
					return yswForceSelection(jQuery(this));
				});
			}
		});    									  
	});
}

function yswForceSelection(formToCheck) {
   
	var optionsOk = true;
   var yswRadioOptions = new Array();
	//loop through all select boxes without rel="optional"
	jQuery("select:not([@rel*=optional])",formToCheck).not("[@onChange]").each(function(index) {
                var currOption = jQuery(this).children("option:selected").attr('value');
		if (optionsOk && currOption.substring(0,1) == " ") {
	   		var firstLetter = jQuery(this).attr('name').substring(0,1).toLowerCase();
			if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" || firstLetter == "u") {
				alert('Please ' + jQuery(this).attr('name').toLowerCase().replace(/<\/?[^>]+(>|$)/g, ""));
			}
			else
			{
				alert('Please ' + jQuery(this).attr('name').toLowerCase().replace(/<\/?[^>]+(>|$)/g, ""));
			}
			optionsOk = false;
		}
	});
	
	if (optionsOk) {
		jQuery("input:radio:not([@rel*=optional])",formToCheck).each(function(index) {
			var radioName = jQuery(this).attr('name');
			if (yswRadioOptions[radioName]) {
				if (jQuery(this).attr('checked') == "1") {
					yswRadioOptions[radioName] = "1";
				}
			}
			else
			{
			   if (jQuery(this).attr('checked') == "1") {
					yswRadioOptions[radioName] = "1";
				}
				else
				{
					yswRadioOptions[radioName] = "0";
				}
			}
		});

		for (radioName in yswRadioOptions)
		{
		   if (yswRadioOptions[radioName] == "0") {
		   		var firstLetter = radioName.substring(0,1).toLowerCase();
				if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" || firstLetter == "u") {
					alert('Please ' + radioName.replace(/<\/?[^>]+(>|$)/g, ""));
				}
				else
				{
					alert('Please ' + radioName.replace(/<\/?[^>]+(>|$)/g, ""));
				}
				optionsOk = false;
				break;
			}
		}
		
	};
   return optionsOk;
}
