/**
 * @author	Markus Brunner, mail [at] markusbrunner-design [dot] de
 * @content	JQuery-Functions in Dollar-Conflict-Mode ($j instead of $ -> to use with other JS-Frameworks like Mootools)
 */

/**********************************************************************
 *	showHide-Functionality - begin
 **/

/**
 * Initialize showHideFunctionality
 */
$j(document).ready(function () {
	var clickElement = $j('#viralmail-form-legend');
	var slideElement = $j('#viralmail-form');
	var closeScan = $j('#closed');
	showHideFunctionality(clickElement,slideElement,closeScan);
});

/**
 * Function for showing and hiding Content
 */
function showHideFunctionality(clickElement,slideElement,closeScan) {
	if(clickElement.length > 0 && slideElement.length > 0){
		// toggle Event
		clickElement.click(function() {
			slideElement.slideToggle('slow');
		});
	}
	if(closeScan.length > 0) {
		// initial hiding
		var timeoutMilliseconds = closeScan.html();
		window.setTimeout('hideElement()', timeoutMilliseconds);
	}
	
}

/**
 * Function for hiding an Element
 */
function hideElement() {
	var slideElement = $j('#viralmail-form');
	slideElement.hide();
}

/**
 *	showHide-Functionality - end
 **********************************************************************/