
regSpon = {
	
	regSpon: function(){
		this.item = '';
		this.price = '';
		this.payment_method = '';
		this.vdate_bool = true;
		this.err_msg = false;
	},
	
	setItem: function(item,price){
		this.item = item;
		$('optionPicked').innerHTML = 'You Picked <b>' + (item+' / '+price) + '</b>';
		$('dataForm').style.display = 'block';
	},
	
	setPrice: function(price){
		if($('amountInputField').value){
			this.price = $('amountInputField').value;
			$('amountField').value = this.price;
			$('amount').innerHTML = this.price;
		}
	},
	
	disableElec: function(){
 		$('elecField').disabled = true;
		$('elecField').checked = false;
	},
	
	enableElec: function(){
 		$('elecField').disabled = false;
	},
	
	setMethod: function(method){
		this.setPrice();
		if(!this.price){
			alert('Please choose your "Sponsorship Amount" above before selecting a payment method.');
		}else{
			
			this.payment_method = method;
			//$('paypal').style.display = 'none';
			$('check').style.display = 'none';
			$('po').style.display = 'none';
			$('default').style.display = 'none';
		
			if(method == 'check' || method == 'po'){
				if(method == 'check'){
					$('amount').innerHTML = this.price;
				}
				$(method).style.display = 'block';
			}else{
				$('default').style.display = 'block';
			}
		}
	},

	vdate: function(obj,msg){
		
		if(!$(obj).value){
			this.vdate_bool = false;
			this.err_msg += msg;
		}
		
	},
	
	validate: function(){

		this.vdate_book = true;
		this.err_msg = '';

		// some fields to validate
		this.vdate('booth_signage_text','Booth Signage Text is Missing<br>');
		this.vdate('company','Company/Org Name is Missing<br>');
		this.vdate('name','Name is Missing<br>');
		this.vdate('mailing_address','Mailing Address is Missing<br>');
		this.vdate('mailing_city','Mailing City is Missing<br>');
		this.vdate('mailing_state','Mailing State is Missing<br>');
		this.vdate('mailing_zip','Mailing Zip is Missing<br>');
		this.vdate('telephone','Telephone is Missing<br>');
		this.vdate('email','Email is Missing<br>');

		if(this.vdate_bool == false){
			$('error_msg').style.display = 'block';
			$('errorMsg').innerHTML = this.err_msg;
			return false;
		}
		
		return true;

	},
	
	getInstance: function(obj){
		if($(obj).value){
			return 'y';
		}
		return 'n';
	}
	
}

regGov = {
	
	regGov: function(){
		this.item = '';
		this.price = '';
		this.payment_method = '';
	},
	
	setItem: function(item,price){
		this.item = item;
		this.price = price;
		$('optionPicked').innerHTML = 'You Picked <b>' + (item+' / $'+price) + '</b>';
		$('dataForm').style.display = 'block';
		$('amountField').value = this.price;
		$('amount').innerHTML = this.price;
		$('tour_yes').checked = false; // reset the tour radios
		$('tour_no').checked = false; // reset the tour radios
		this.unsetFired = true; // if the tour has not been selected yet, don't modify the tour price
		this.setFired = false;
		
	},
	
	setTour: function(item,price){
		if(this.setFired == true){
			return false; // don't let them SET this more than once
		} else {
			this.item = item;
			this.price = price;
			$basePrice = $('amount').innerHTML; // get the current price
			$adjustedPrice = (parseInt($basePrice) + parseInt(this.price)); // add the tour fee
			$('amountField').value = $adjustedPrice;
			$('amount').innerHTML = $adjustedPrice;
			this.setFired = true;
			this.unsetFired = false; // allow them to UNSET this selection if they have already SET it
		}
	},
	
	unsetTour: function(item,price){
		if(this.unsetFired == true){
			return false;  // don't let them UNSET this more than once
		} else {
			this.item = item;
			this.price = price;
			$basePrice = $('amount').innerHTML; // get the current price
			$adjustedPrice = (parseInt($basePrice) - parseInt(this.price)); // add the tour fee
			$('amountField').value = $adjustedPrice;
			$('amount').innerHTML = $adjustedPrice;
			this.unsetFired = true;
			this.setFired = false; // allow them to SET this selection if they have already UNSET it
		}
	},
	
	setMethod: function(method){
		this.payment_method = method;
		$('paypal').style.display = 'none';
		$('check').style.display = 'none';
		$('po').style.display = 'none';
		$('default').style.display = 'none';
		
		if(method == 'paypal' || method == 'check' || method == 'po'){
			if(method == 'check'){
				$('amount').innerHTML = this.price;
			}
			$(method).style.display = 'block';
		}else{
			$('default').style.display = 'block';
		}
	},
	
	validate: function(){

		// default the validation as true.. if we find an error, then we can drop it
		var valid = true;
		var err_msg = '';
		
		if(this.getInstance('company') == false){
			valid = false;
			err_msg += 'Company/Org Name is Missing<br>';
		}
		
		if(this.getInstance('name_tag') == false){
			valid = false;
			err_msg += 'Print Name for Name Tag is Missing<br>';
		}

		if(this.getInstance('mailing_address') == false){
			valid = false;
			err_msg += 'Mailing Address is Missing<br>';
		}

		if(this.getInstance('mailing_city') == false){
			valid = false;
			err_msg += 'Mailing City is Missing<br>';
		}

		if(this.getInstance('mailing_state') == false){
			valid = false;
			err_msg += 'Mailing State is Missing<br>';
		}

		if(this.getInstance('mailing_zip') == false){
			valid = false;
			err_msg += 'Mailing Zip is Missing<br>';
		}

		if(this.getInstance('telephone') == false){
			valid = false;
			err_msg += 'Telephone is Missing<br>';
		}

		if(this.getInstance('email') == false){
			valid = false;
			err_msg += 'Email is Missing<br>';
		}
		
		if(valid == false){
			$('error_msg').style.display = 'block';
			$('errorMsg').innerHTML = err_msg;
		}
		
		return valid;
		
	},
	
	getInstance: function(obj){
		if($(obj).value){
			return true;
		}
		return false;
	}
	
}

regAnn = {
	
	regAnn: function(){
		this.item = '';
		this.price = '';
		this.payment_method = '';
	},
	
	setItem: function(item,price){
		this.item = item;
		this.price = price;
		$('optionPicked').innerHTML = 'You Picked <b>' + (item+' / $'+price) + '</b>';
		$('dataForm').style.display = 'block';
		$('amountField').value = this.price;
		$('amount').innerHTML = this.price;
	},
	
	setMethod: function(method){
		this.payment_method = method;
		$('paypal').style.display = 'none';
		$('check').style.display = 'none';
		$('po').style.display = 'none';
		$('default').style.display = 'none';
	
		if(method == 'paypal' || method == 'check' || method == 'po'){
			if(method == 'check'){
				$('amount').innerHTML = this.price;
			}
			$(method).style.display = 'block';
		}else{
			$('default').style.display = 'block';
		}
	},
	
	validate: function(){

		// default the validation as true.. if we find an error, then we can drop it
		var valid = true;
		var err_msg = '';
		
		if(this.getInstance('company') == false){
			valid = false;
			err_msg += 'Company/Org Name is Missing<br>';
		}
		
		if(this.getInstance('name') == false){
			valid = false;
			err_msg += 'Name is Missing<br>';
		}

		if(this.getInstance('mailing_address') == false){
			valid = false;
			err_msg += 'Mailing Address is Missing<br>';
		}

		if(this.getInstance('mailing_city') == false){
			valid = false;
			err_msg += 'Mailing City is Missing<br>';
		}

		if(this.getInstance('mailing_state') == false){
			valid = false;
			err_msg += 'Mailing State is Missing<br>';
		}

		if(this.getInstance('mailing_zip') == false){
			valid = false;
			err_msg += 'Mailing Zip is Missing<br>';
		}

		if(this.getInstance('telephone') == false){
			valid = false;
			err_msg += 'Telephone is Missing<br>';
		}

		if(this.getInstance('email') == false){
			valid = false;
			err_msg += 'Email is Missing<br>';
		}
		
		if(valid == false){
			$('error_msg').style.display = 'block';
			$('errorMsg').innerHTML = err_msg;
		}
		
		return valid;
		
	},
	
	getInstance: function(obj){
		if($(obj).value){
			return true;
		}
		return false;
	}
	
}

regMember = {
	
	regGov: function(){
		this.item = '';
		this.price = '';
		this.payment_method = '';
	},
	
	setItem: function(item,price){
		this.item = item;
		this.price = price;
		$('optionPicked').innerHTML = 'You Picked <b>' + (item+' / $'+price) + '</b>';
		$('dataForm').style.display = 'block';
		$('amountField').value = this.price;
		$('amount').innerHTML = this.price;
	},
	
	setMethod: function(method){
		this.payment_method = method;
		$('paypal').style.display = 'none';
		$('check').style.display = 'none';
		$('po').style.display = 'none';
		$('default').style.display = 'none';
		
		if(method == 'paypal' || method == 'check' || method == 'po'){
			if(method == 'check'){
				$('amount').innerHTML = this.price;
			}
			$(method).style.display = 'block';
		}else{
			$('default').style.display = 'block';
		}
	},
	
	validate: function(){

		// default the validation as true.. if we find an error, then we can drop it
		var valid = true;
		var err_msg = '';
		
		if(this.getInstance('company') == false){
			valid = false;
			err_msg += 'Company/Org Name is Missing<br>';
		}s
		
		if(this.getInstance('contact_person') == false){
			valid = false;
			err_msg += 'Contact Person is Missing<br>';
		}

		if(this.getInstance('mailing_address') == false){
			valid = false;
			err_msg += 'Mailing Address is Missing<br>';
		}

		if(this.getInstance('mailing_city') == false){
			valid = false;
			err_msg += 'Mailing City is Missing<br>';
		}

		if(this.getInstance('mailing_state') == false){
			valid = false;
			err_msg += 'Mailing State is Missing<br>';
		}

		if(this.getInstance('mailing_zip') == false){
			valid = false;
			err_msg += 'Mailing Zip is Missing<br>';
		}

		if(this.getInstance('telephone') == false){
			valid = false;
			err_msg += 'Telephone is Missing<br>';
		}

		if(this.getInstance('email') == false){
			valid = false;
			err_msg += 'Email is Missing<br>';
		}
		
		if(valid == false){
			$('error_msg').style.display = 'block';
			$('errorMsg').innerHTML = err_msg;
		}
		
		return valid;
		
	},
	
	getInstance: function(obj){
		if($(obj).value){
			return true;
		}
		return false;
	}
	
}

regRoast = {
	
	regRoast: function(){
		this.item = '';
		this.price = '';
		this.payment_method = '';
	},
	
	setItem: function(item,price){
		this.item = item;
		this.price = price;
		$('optionPicked').innerHTML = 'Please fill out the form and choose your method of payment';
		$('dataForm').style.display = 'block';
		$('amountField').value = this.price;
		$('amount').innerHTML = this.price;		
	},
	
	setTotal: function(quantity,price){
		$('total').innerHTML = ($('quantity').value * this.price);
	},
	
	setMethod: function(method){
		this.payment_method = method;
		$('paypal').style.display = 'none';
		$('check').style.display = 'none';
		$('po').style.display = 'none';
		$('default').style.display = 'none';
		
		if(method == 'paypal' || method == 'check' || method == 'po'){
			if(method == 'check'){
				//$('amount').innerHTML = this.price;
				$('total').innerHTML = ($('quantity').value * this.price);
			}
			$(method).style.display = 'block';
		}else{
			$('default').style.display = 'block';
		}
	},
	
	validate: function(){

		// default the validation as true.. if we find an error, then we can drop it
		var valid = true;
		var err_msg = '';
		
		if(this.getInstance('name_f') == false){
			valid = false;
			err_msg += 'First Name is Missing<br>';
		}
		
		if(this.getInstance('name_l') == false){
			valid = false;
			err_msg += 'Last Name is Missing<br>';
		}

		if(this.getInstance('mailing_address') == false){
			valid = false;
			err_msg += 'Mailing Address is Missing<br>';
		}

		if(this.getInstance('mailing_city') == false){
			valid = false;
			err_msg += 'Mailing City is Missing<br>';
		}

		if(this.getInstance('mailing_state') == false){
			valid = false;
			err_msg += 'Mailing State is Missing<br>';
		}

		if(this.getInstance('mailing_zip') == false){
			valid = false;
			err_msg += 'Mailing Zip is Missing<br>';
		}

		if(this.getInstance('telephone') == false){
			valid = false;
			err_msg += 'Telephone is Missing<br>';
		}

		if(this.getInstance('email') == false){
			valid = false;
			err_msg += 'Email is Missing<br>';
		}
		
		if(valid == false){
			$('error_msg').style.display = 'block';
			$('errorMsg').innerHTML = err_msg;
		}
		
		return valid;
		
	},
	
	getInstance: function(obj){
		if($(obj).value){
			return true;
		}
		return false;
	}
	
}

