﻿function sendEmail() {
	obj = document.getElementById('sendEmailForm');
	if (obj.className == 'sOff') {
		obj.className = 'sOn';
	} else {
		obj.className = 'sOff';
	}
}

function validateEventForm() {
	fName = document.getElementById('field_name').value;
	fEmail = document.getElementById('field_email').value;
	fBody = document.getElementById('field_body').value;
	doSubmit = true;
	if (fName == '') {
		doSubmit = false;
		alert('Please enter in your name');
	}
	
	if (validateEmailAddress(fEmail) == false && doSubmit == true) {
		doSubmit = false;
		alert('Please enter in a valid email address');
	}
	
	if (fBody == '' && doSubmit == true) {
		doSubmit = false;
		alert('Please enter in the message you would like to email to us');
	}

	if (doSubmit) {
		document.getElementById('sendEmailFormContainer').className = 'sOff';
		document.getElementById('sendEmailFormLoader').innerHTML = 'Sending Email...<br><img src="/net/images/processing.gif">';
		document.getElementById('sendEmailFormLoader').style.display = 'block';
		return true;
	} else {
		return false;
	}
}

function eventEmailSendComplete() {
	document.getElementById('sendEmailFormLoader').innerHTML = 'Your email has been sent.';
}

function buyTickets() {
	obj = document.getElementById('tickets');
	if (window.ticketStatus == 1) {
		obj.style.visibility = 'hidden';
		obj.height = '1px';
		window.ticketStatus = 0;
	} else {
		obj.style.visibility = 'visible';
		o = obj.offsetHeight;
		obj.height = o+'px';
		window.ticketStatus = 1;

	}
}

function verifyForm() {
	ids = document.getElementById('tidlist').innerHTML;
	idarray = ids.split(',');
	doSubmit = false;
	
	for (i=0; i<idarray.length; i++) {
		thisid = idarray[i];
		obj = document.getElementById('q'+thisid);
		s = obj.selectedIndex;
		v = obj.options[s].value;
		v = parseInt(v);
		
		if (v > 0) {
			doSubmit = true;
		}
	}
	
	if (doSubmit) {
		return true;
	} else {
		alert('You must select atleast 1 ticket to continue.');
		return false;
	}
}
function updateQty() {
	ids = document.getElementById('tidlist').innerHTML;
	idarray = ids.split(',');
	
	total = 0;
	totalprice = 0;
	
	for (i=0; i<idarray.length; i++) {
		thisid = idarray[i];
		obj = document.getElementById('q'+thisid);
		s = obj.selectedIndex;
		v = obj.options[s].value;
		v = parseInt(v);
		total = total + v;
		
		obj = document.getElementById('p'+thisid);
		p = obj.value;
		//p = parseInt(p);
		thisprice = Math.round(p * v * 100)/100;
		totalprice = totalprice + thisprice;
	}
	
	totalprice = totalprice.toFixed(2);
	
	document.getElementById('ticketStatus').innerHTML = '<hr>You are purchasing <b>' + total + '</b> tickets for a total of <b>$' + totalprice + '</b>.';
}

//updateQty();

