/* This script will show/hide a contact form on a page.
   Originally set up for the Fact Checker blog. Uses the 
   Scripaculous library to create the animation effects. */


	var thisBox, thisForm, toggleLink;
	function initPromoBox() {
		if (!document.getElementById) { return; }
		if (!document.getElementById('fcContactBox') || !document.getElementById('fcContactForm')) { return; }
		
		thisBox = document.getElementById('fcContactBox');
		thisForm = document.getElementById('fcContactForm');
		
		// initially hide the form
		thisForm.style.display = 'none';
		
		// dynamically create a show/hide link
		toggleLink = document.createElement('p');
		toggleLink.setAttribute('id', 'fcShowForm');
		toggleLink.style.display='block';
		var newlink = document.createElement('a');
		newlink.setAttribute('href', 'javascript:toggleContactForm()');
		toggleLink.appendChild(newlink);
		var newtext = document.createTextNode('[+] Show Form');
		newlink.appendChild(newtext);
		thisBox.appendChild(toggleLink);

	}
//	initPromoBox();
	
	function toggleContactForm() {
		if (thisForm.style.display == 'none') {
			toggleLink.firstChild.firstChild.nodeValue = '[-] Hide Form';
			toggleLink.setAttribute('id', 'fcHideForm');
			thisForm.style.display = 'block';
//			new Effect.BlindDown(thisForm, {duration: .5});
			return;
		} else if (thisForm.style.display = 'block') {
			toggleLink.firstChild.firstChild.nodeValue = '[+] Show Form';
			toggleLink.setAttribute('id', 'fcShowForm');
//			new Effect.BlindUp(thisForm, {duration: .5});
			thisForm.style.display = 'none';
			return;
		}
	}
