/* subscription jobs based on selected dropdown option; i.e. set form action & display warning, if applicable */
function do_plan(form_name, field_name) {
	
	/* set doc shortcuts */
	doc = document.forms[form_name];
	doc_plan = doc.subscription_plan;
	doc_val = doc_plan[doc_plan.selectedIndex].value;
	
	// set path; i.e. web_access, newsletter, or greenbook
	switch(doc_val) {
		
		// newsletter request
		case '9': path = 'newsletter'; doc.newsletter.value=1; break;
		case '10': path = 'newsletter'; doc.newsletter.value=1; break;
			
		// green book request
		case '11':
		case '12': 
		case '14':
		case '15':
		case '16':
		case '17':
			path = 'green_book'; 
		break;
			
		// web access request
		default: path = 'web_access';
	}
	
	// *********** SET FORM ACTION *************
	//doc.action = 'https://ushr.com/subscriptions/' + path + '/2/';
	doc.action = '/subscriptions/' + path + '/2/';
	
		
	// ***************** SUBSCRIPTION WARNINGS *****************
	// prep coach
	if(doc_val=="2") { 
		alert('THIS OPTION IS FOR PARTICIPATING USHR PREP COACHES ONLY!\n\nIf it is determined that you are not a USHR Prep Coach,\n\nyour subscription will be cancelled WITHOUT REFUND.\n\nQuestions? Email admin@ushr.com.'); 
	} 
	// div III college coach
	else if(doc_val=="13") {
		alert('THIS OPTION IS FOR DIV III COLLEGE COACHES ONLY!\n\nIf it is determined that you are not a Div III college Coach,\n\nyour subscription will be cancelled WITHOUT REFUND.\n\nQuestions? Email admin@ushr.com.'); 
	} 
	// alert user of professional & family subscription requirement if standard plan selected
	else if(doc_val=="4" || doc_val=="7") {
		
		if(doc_val=="4") { 
			var sub_display = 'Single Annual'; 
		}
		else if(doc_val=="7") { 
			var sub_display = 'Single Monthly'; 
		}
		
		alert('IMPORTANT NOTE!!!\n\n' + sub_display + ' plan is prohibited if you are a coach or employee of any pro, college, Tier I or Tier II junior teams OR are a player agent, member of the media, or are otherwise employed in the business of hockey. If any of the above apply to you -- Choose the Professional plan.\n\n' + sub_display + ' plan is set up for one person. If you also wish to grant access to your spouse and/or children -- Choose the Family plan.\n\nUSHR depends on your honesty & support, without which we would be unable to continue serving you. Please understand: if the USHR website access policy is violated, your subscription will be subject to cancellation.\n\nQuestions? Please email admin@ushr.com.\n'); 
	}
	// alert user of professional subscription requirement if family plan selected
	else if(doc_val=="5" || doc_val=="8") {
		
		if(doc_val=="5") { 
			var sub_display = 'Family Annual'; 
		}
		else if(doc_val=="8") { 
			var sub_display = 'Family Monthly'; 
		}
		
		alert('IMPORTANT NOTE!!!\n\n' + sub_display + ' plan is prohibited if you are a coach or employee of any pro, college, Tier I or Tier II junior teams OR are a player agent, member of the media, or are otherwise employed in the business of hockey. If any of the above apply to you -- Choose the Professional plan.\n\nUSHR depends on your honesty & support, without which we would be unable to continue serving you. Please understand: if the USHR website access policy is violated, your subscription will be subject to cancellation.\n\nQuestions? Please email admin@ushr.com.\n');
	}
		
	// alert Green Book purchasers of shiiping and handling charge
	if(path == 'green_book') {
		alert('PLEASE NOTE:\n\nthere is a $2.50 shipping & handling charge per Green Book purchased.');
	}
}

function check_login(form_name) {
	 
	doc = document.forms[form_name];
  
  	// Check email entry
	if (doc.email.value.indexOf("@")==-1 || doc.email.value.indexOf(".")==-1) {
		alert('Please be sure to enter a Valid Email Address (e.g. j_doe@aol.com).'); 
		return false;
	}
	
	// Check password entry
	pass = doc.password.value; 
	
   	if (pass.length < 4) {
		alert('Your password must be at least 4 characters long'); 
		return false;
	}
		 
  	// Check if password entry = passwordAgain entry
	if (doc.password.value != doc.confirm_pass.value) {
		alert('Please be sure the "password" and "confirm password" fields are identical'); 
		return false;
	} 		
} 