function validateForm() { //v4.0
	if (document.getElementById){
		var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
		for (i=0; i<(args.length-2); i+=3){
			test=args[i+2];
			val=document.getElementById(args[i]);
			toStyle = val;
			if(val){
				if(val.tagName == 'SELECT')
				{
					if(test.indexOf('isSel0')!=-1 && (val.value == '' || val.value == 0) )
					{
							errors+='- Please select an option for '+args[i+1]+'.<br />';
							toStyle.style.backgroundColor = '#FF6666' ;
							toStyle.style.borderStyle = 'dotted';
							toStyle.style.borderWidth = '1pt';
							toStyle.style.borderColor = '#000000';
							toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
					}
					else if(test.indexOf('isSel')!=-1 && val.value == '')
					{
							errors+='- Please select an option for '+args[i+1]+'.<br />';
							toStyle.style.backgroundColor = '#FF6666' ;
							toStyle.style.borderStyle = 'dotted';
							toStyle.style.borderWidth = '1pt';
							toStyle.style.borderColor = '#000000' ;
							toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
					}
				}
				else if ((val=val.value)!="")
				{
					if (test.indexOf('isEmail')!=-1){
						p=val.indexOf('@');
						if (p<1 || p==(val.length-1))
						{
							errors+='- '+args[i+1]+' must contain an e-mail address.<br />';
							toStyle.style.backgroundColor = '#FF6666' ;
							toStyle.style.borderStyle = 'dotted';
							toStyle.style.borderWidth = '1pt';
							toStyle.style.borderColor = '#000000' ;
							toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
							toStyle.setAttribute("onKeyUp","restoreStyle(this)");
						}
					}
					else if (test!='R'){
						num = parseFloat(val);
						if (isNaN(val))
						{
							errors+='- '+args[i+1]+' must contain a number.<br />';
							toStyle.style.backgroundColor = '#FF6666' ;
							toStyle.style.borderStyle = 'dotted';
							toStyle.style.borderWidth = '1pt';
							toStyle.style.borderColor = '#000000';
							toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
							toStyle.setAttribute("onKeyUp","restoreStyle(this)");
						}
						if (test.indexOf('inRange') != -1){
							p=test.indexOf(':');
							min=test.substring(8,p);
							max=test.substring(p+1);
							if (num<min || max<num)
							{
								errors+='- '+args[i+1]+' must contain a number between '+min+' and '+max+'.<br />';
								toStyle.style.backgroundColor = '#FF6666' ;
								toStyle.style.borderStyle = 'dotted';
								toStyle.style.borderWidth = '1pt';
								toStyle.style.borderColor = '#000000';
								toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
							toStyle.setAttribute("onKeyUp","restoreStyle(this)");
							}
						}
					}
				}
				else if (test.charAt(0) == 'R')
				{
					errors += '- '+args[i+1]+' is required.<br />';
					toStyle.style.backgroundColor = '#FF6666' ;
					toStyle.style.borderStyle = 'dotted';
					toStyle.style.borderWidth = '1pt';
					toStyle.style.borderColor = '#000000' ;
					toStyle.style.color = '#CCFF00';
							toStyle.setAttribute("onChange","restoreStyle(this)");
							toStyle.setAttribute("onKeyUp","restoreStyle(this)");
				}
			}
		}
		if(errors !='')
			displayValidationErrors(errors);
	}
	return (errors=='');
}

function displayValidationErrors(errors){
	document.getElementById('Container').style.display = 'block';
	var errorContainer = document.getElementById('hiddenResponse');
	errorContainer.style.color="#FF0000";
	errorContainer.innerHTML = errors;
	setTimeout("document.getElementById('Container').style.display = 'none';", 60000);
}
function restoreStyle(elemnt)
{
	//background-color: #FF6666; border: dotted 1pt #000000; color:#CCFF00;
	//var txtField = document.getElementById(elemnt);
	elemnt.style.backgroundColor = '';
	elemnt.style.borderStyle = '';
	elemnt.style.borderWidth = '';
	elemnt.style.borderColor = '' ;
	elemnt.style.color = '';
}