// JavaScript Document
function CheckForm(obj1) {
	var pass=true;
	var	$msg = "";
	var s_amount = obj1['s_amount'].value;
	var c_amount = obj1['c_amount'].value;
	
	for (i=0;i<obj1.length;i++){
		var tempobj=obj1.elements[i];
		if (tempobj.name.substring(0,8)=="c_amount"){			
			if ((tempobj.value=="--> ?" || tempobj.value=='' ||  !parseFloat(tempobj.value) || tempobj.value==0) && s_amount=='') {
				pass=false
				$msg = "Please Enter in a valid dollar value for the card amount. \n\n(minimum $20)";
				tempobj.value='';
				tempobj.focus();
				break
			}	else if (tempobj.value<20 && s_amount==''){
				pass=false
				$msg = "Please Enter in an amount greater than or equal to $20";
				tempobj.value='';
				tempobj.focus();
				break
			} else {
				obj1['amount'].value = tempobj.value;
			}
		} else if (tempobj.name.substring(0,8)=="s_amount" && tempobj.value!='' && parseFloat(tempobj.value)) {
			
			obj1['amount'].value = tempobj.value;
		
		}else if (tempobj.name.substring(0,8)=="quantity"){
			if (tempobj.value=='' ||  !parseFloat(tempobj.value)) {
				pass=false
				$msg = "Please Enter in a valid number value for the card quantity greater than 0";
				//obj1.elements[i].focus();
				break
			}
		} 
	}

	if (!pass){
		
		alert($msg);
		return false;

	} else {
		obj1['item_name'].value = "Flanigan's Gift Card: $" + obj1['amount'].value;
		
	}
		
		
}
