/*<![CDATA[*/

window.addEvent('domready', function() {
	$$('div.centerPage a').morph('div.centerPage a').addEvents({
		'mouseenter': function() {
			var hoverContactLink = new Fx.Morph(this, {duration: 0});
			hoverContactLink.start('div.centerPage a:hover');
		},
		'mouseleave': function() {
			var unHoverContactLink = new Fx.Morph(this, {duration: 200});
			unHoverContactLink.start('div.centerPage a');
		}
	})
});

// Function to switch content of form container
function switchFormContainer(id, instant) {
	
	// Define suffix for content
	var suffix = "_content";
	
	// Define ID of content container
	var formContainer = "buttons";
	
	// Define ID of container of content container
	var formContainerContainer = "formContainer";
	
	// If ID is not empty
	if (id.length !== 0) {
		
		// If ID of content exists
		if (document.getElementById(id) && document.getElementById(id + suffix) && document.getElementById(formContainerContainer)) {
			
			// If content container exists
			if (document.getElementById(formContainer)) {
				
				// Place calling container in to short variable
				var clrCntnr = document.getElementById(id + suffix);
				
				// Place calling DIV in to short variable
				var clrDIV = document.getElementById(id);
				
				// Place info container ID in to short variable
				var frmCntnr = document.getElementById(formContainer);
				
				// Set class of current selected DIV to NotSelected
				$$('.blockDivRow .blockDivSelected').setProperty('class', 'blockDivNotSelected');
				
				// If instant not requested
				if (instant == 'false') {
				
					try {
					
						// Fade content out
						frmCntnr.fade('hide');
					
					} catch(err) { }
					
				}
				
				// Set class of new selected DIV to Selected
				clrDIV.className = 'blockDivSelected';
				
				// Set info container to the HTML contained inside the calling container
				frmCntnr.innerHTML = clrCntnr.innerHTML;
				
				// If instant not requested
				if (instant == 'false') {
					
					try {
					
						// Fade content in
						frmCntnr.fade('in');
						
					} catch(err) { }
					
				}
				
			}
			
		}
		
	}
	
}

// Handle form actions
function formAction(action, form) {
	
	// If form exists
	if (typeof(form) !== "undefined") {
		
		// If action is to submit
		if (action == "submit") {
			
			// Submit form
			form.submit();
			
		} else if (action == "reset") {
			
			// Reset form
			form.reset();
			
		}
		
	}
	
	// Return false
	return false;
	
}

/*]]>*/
