function MM_validateForm(fn) { 
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	if (fn=='payment') {
	radioGroup = document.forms["payment"].elements["card_type"];   
	  validRadio = false;   
	  for (i = 0; i < radioGroup.length; i++) {      
	  validRadio = (validRadio || radioGroup[i].checked);
	   }   
	  if (!validRadio)  errors += '- You must select a card type.\n<br>';
	}
    for (i=1; i<(args.length-2); i+=3) { 
	test=args[i+2]; 
	val=document.getElementById(args[i]);
      if (val) { nm=args[i+1]; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain a valid e-mail address.\n<br>';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n<br>';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n<br>';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n<br>'; }   
    }
		 
	if (errors) {
	var	errorobj = document.getElementById('error_display');
		errorobj.style.display="block";
 	 	errorobj.innerHTML = "<strong>The following error(s) occurred:</strong><br>"+errors+"<br><ul id='popupSelect' ><li><a href='#' onclick=\"OK();\">OK</a></li></ul><br>";
	if	((fn=='soltrad')||(fn=='ltdco')||(fn=='orders')||(fn=='payment')) {
	var	popupobj = document.getElementById('wrapper');	
		popupobj.style.visibility = 'hidden';
		}
	}
	if (document.MM_returnValue = ((errors == '')&&(fn=='contact')) || ((errors == '')&&(fn=='payment'))) {
		var errorobj = document.getElementById('error_display');
		errorobj.style.display="none";
 		eval('document.'+fn+'.submit()');
		}
	if (document.MM_returnValue = (errors == '')&&((fn=='soltrad')||(fn=='ltdco')||(fn=='orders')||(fn=='payment'))) {
	var	popupobj = document.getElementById('wrapper');	
		popupobj.style.visibility = 'visible';	
	}

		
}}
function OK() {
	obj = document.getElementById('error_display');
	obj.style.display = 'none';
	}
