<!--

function validate(form) {
   var xx = document.form1;
   var msg;
   var amt = 0;
   var newtext = "";
   var printText = ""; 
   var donated = "";
   var donation = 0;
   var noSelection = true;

   
//  check for sponsor value - radio button
		var mysp = radioPicked("slevel") 
		var sl = mysp
		switch (sl)
		{
			case false:
				break
			case 0:
				amt = 10000
				newtext = "  $10,000 Platinum Sponsor - "
				printText = "  $10,000 Platinum Sponsor <br>  "
				noSelection = false
				break
			case 1:
				amt = 5000
				newtext = "  $5,000 Gold Sponsor - " 
				printText = "  $5,000 Gold Sponsor  <br> "
				noSelection = false
				break
			case 2:
				amt = 3000
				newtext = "  $3,000 Silver Sponsor  - "
				printText = "  $3,000 Silver Sponsor  <br> "
				noSelection = false
				break
			case 3:
				amt = 1500
				newtext = "  $1,500 Bronze Sponsor -  "	  
				printText = "  $1,500 Bronze Sponsor   <br> "
				noSelection = false
				break										
		} // end swtich
		
		
	//  check for tickets or books
		
		var picked = radioPicked("pick") 
		var pdk = picked
		switch (pdk)
		{
			case false:
				break
			case 0:
				if (isEmpty(xx.num_tickets.value)) 
				{
				alert ("Please enter number of Raffle Tickets")
				xx.num_tickets.focus()
				return false;
				}
				else 
				{
					if (isNaN(xx.num_tickets.value)) 
					{
	   					alert ("Number of Raffle Tickets must be numeric.")
						xx.num_tickets.focus()
						return false;
					}
					var qty = parseInt(xx.num_tickets.value)
					amt += (200 * qty)
					newtext += "  " +qty + " Raffle Ticket(s) ($200 each) -  "	
					printText += "  " +qty + " Raffle Ticket(s) ($200 each) <br>  "
					noSelection = false
				}
				noSelection = false
				break
			case 1:
				if (isEmpty(xx.num_books.value)) 
				{
				alert ("Please enter number of Raffle Ticket Books")
				xx.num_books.focus()
				return false;
				}
				else 
				{
					if (isNaN(xx.num_books.value)) 
					{
	   					alert ("Number of Raffle Ticket Books must be numeric.")
						xx.num_books.focus()
						return false;
					}
					var qty = parseInt(xx.num_books.value)
					amt += (1500 * qty)
					newtext += "  " + qty + " Raffle Ticket Book(s) ($1,500 each) -  " 
					printText += "  " + qty + " Raffle Ticket Book(s) ($1,500 each) <br>   "
					noSelection = false
				}
				noSelection = false
				break
		
		} // end swtich



//  check for donation amount
	
    if (!(isEmpty(xx.gift.value)))	
	{	
		if (isNaN(xx.gift.value)) {
   			alert ("Donation Amount must be numeric.");
   			xx.gift.focus();
			return false;
   			}
		else  {
			var qty = parseFloat(xx.gift.value)
			newtext +=  "  $" + qty + "   Cash Donation " 
			printText +=  "  $" +qty + "   Cash Donation "  
			if (!(isEmpty(xx.donatename.value)))  { 
				donated = xx.donatename.value
			 	newtext += " made by:  " + donated + ", " + xx.donatestreet.value + ", " + xx.donatecity.value
				printText += " made by <br />  " + donated + "<br />" + xx.donatestreet.value + "<br />" + xx.donatecity.value 
			}

			amt += qty
			noSelection = false
		}
	}
	
// check to be sure something was selected
		
		if (noSelection) {
			alert ("No Selection was made.  Please make a selection then resubmit the form.")
			return false;
			}
		else {
			document.form1.amount.value = amt
			document.form1.description.value = newtext 
			document.form1.prdescription.value = printText
			return true;
		}		

}	// end function



function radioPicked(radioName)	{
	var radioSet = "";
	
	for (var k=0; k < document.forms.length; k++)  {
		if (!radioSet)  {  
			radioSet = document.forms[k][radioName];
		}
	}
	if (!radioSet) {  
		return false; 
	}

	for (k=0; k < radioSet.length; k++)  { 
		if (radioSet[k].checked)  {
			radioValue = radioSet[k].value;
			return k;  
		}
	}
	return false; 	
}

function isEmpty(inputStr) {
	if (inputStr == null || inputStr == "") {
		return true;
	}
	return false;
}

function validatePrompt(Ctrl, PromptStr) {
   alert(PromptStr) ;
   Ctrl.focus() ;
   return ;
}
//-->

