
function switchLoginType() {
	oldVis = (document.getElementById('newActionTeamMember').style.display=='block') ? 'NEW' : 'EXISTING';
	document.getElementById('newActionTeamMember').style.display = (oldVis=='NEW') ? 'none' : 'block';
	document.getElementById('existingActionTeamMember').style.display = (oldVis=='NEW') ? 'block' : 'none';
}


function sendMessages(actionUrl) {
	f = document.takeAction;
	loc = 'mailto:'+f.addresses.value+'?subject='+escape(f.subject.value)+'&body='+escape(f.personalMessage.value+"\n\n");
	if (loc.length > 1000) loc = 'mailto:'+f.addresses.value+'?subject='+escape(f.subject.value)+'&body='+escape(f.personalMessage.value);
	if (loc.length > 1000) loc = 'mailto:'+f.addresses.value+'?body='+escape(f.personalMessage.value);
	if (loc.length > 1000) loc = 'mailto:'+f.addresses.value+'?subject='+escape(f.subject.value)+'&body='+escape('Check out this campaign by Animals Australia:');
	loc += escape("\n"+actionUrl+"\n\n");
	if (confirm('This option will create a TEXT-ONLY version of this message to be sent using your email program. If you have a large list of contacts that you would like to send this important message to, you can forward this message using your usual Cc or Bcc list.\n\nYour email program will launch when you click the \'OK\' button:'))
		window.location = loc;
}

function previewF2f() {
	document.previewForm.personalMessage.value = document.takeAction.personalMessage.value;
	aaPreviewWin = window.open('about:blank','aaPreviewWin','width=800,height=650,status=yes,scrollbars=yes,resizable=yes');
	document.previewForm.submit();
	aaPreviewWin.focus();
}


function submitStory() {
	f = document.challengeStoryForm;
	params = "challengeStory="+escape(f.challengeStory.value);
	document.getElementById('storySubmission').innerHTML = "<div align='center' style='padding-top:20px;'><img src='/images/wait.gif' class='waiting' /></div>";
	ajaxCall('/take_action/challenge_submission.inc.php','storySubmission','',params);
}
