function tellafriend(){

	window.open("/tellafriend_form.php", "tell", "width=520, height=400, scrollbars=1");

}

function openMap(){

	window.open("/google-map.php", "map", "width=425, height=350, scrollbars=0");

}

function validate_subscriber(){

	if(!echeckSignup(document.getElementById('newsletter_email').value)){
								
		alert("Invalid Email Address!");
		document.getElementById('newsletter_email').style.backgroundColor = "#ebebeb";
		document.getElementById('newsletter_email').focus();
		return false;
								
	}

}

function echeckSignup(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}
						
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	  return false
	}
					
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	return false
	}
						
	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}
						
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}
						
	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
								
	if (str.indexOf(" ")!=-1){
		return false
	}
						
	return true					
}

function calculateCart(){

	var package1_total = document.getElementById('quantity1').value * 100.00;
	var package2_total = document.getElementById('quantity2').value * 275.00;
	var package3_total = document.getElementById('quantity3').value * 800.00;
	
	var cart_description = '';
	
	if(package1_total > 0){ cart_description += 'Single Raffle Ticket Purchase, to benefit the Boys &amp; Girls Clubs in Colorado x ' + document.getElementById('quantity1').value + ' :: '; }
	if(package2_total > 0){ cart_description += '3 Pack Of Raffle Tickets, to benefit the Boys &amp; Girls Clubs in Colorado x ' + document.getElementById('quantity2').value + ' :: '; }
	if(package3_total > 0){ cart_description += '10 Pack Of Raffle Tickets, to benefit the Boys &amp; Girls Clubs in Colorado x ' + document.getElementById('quantity3').value + ' :: '; }
	
	var cart_amount = package1_total + package2_total + package3_total;
	
	var ticket_quantity = (document.getElementById('quantity1').value * 1) + (document.getElementById('quantity2').value * 3) + (document.getElementById('quantity3').value * 10);
	
	if(!cart_description){
	
		alert('Please enter the number of tickets you wish to purchase!');
		return false;
	
	} else {
	
		document.getElementById('x_description').value = cart_description;
		document.getElementById('x_amount').value = cart_amount.toFixed(2);
		document.getElementById('ticket_quantity').value = ticket_quantity;
		
		if(document.getElementById('quant')){
		
			document.getElementById('quant').value = ticket_quantity;
		
		}
		
		return true;
	
	}
	
}