
	/* Globals */
	isEditing = false;
	isSlided  = false;


	/*
	 * The Green Top Slider
	 */
	function DestroyAjaxInnerContainer()
	{
		// $('mainAjaxContainer').removeChild($('innerContainer'));
		// console.log($('mainAjaxContainer').childNodes);
		// $('mainAjaxContainer').childNodes[0].remove();
	
	
		// if($('mainAjaxContainer').down())
		// 	{
		// 		console.log('removed:');
		// 		console.log($('mainAjaxContainer').down());
		// 		$('mainAjaxContainer').down().remove();
		// 	}
	
	
		if($('innerContainer'))
			$('innerContainer').remove();
	
	
		
	}

	function UnsetCurrentTabSelection()
	{
		if($('current'))
			$('current').id = '';
	}

	function CloseTopSlider()
	{
		UnsetCurrentTabSelection();
		Effect.SlideUp('mainAjaxSlider', {duration:0.4, afterFinish: function() { DestroyAjaxInnerContainer(); }});
	}
	
	function CloseBottomSlider()
	{
		Effect.SlideUp($('bottomAjaxSlider'), {duration:0.3, afterFinish: function(){$('bottomAjaxContainer').update('');}});
		$$('.bottomCurrent').each(function(currentEls) { currentEls.removeClassName('bottomCurrent');});
		// Effect.SlideUp('bottomAjaxSlider', {duration:0.4, afterFinish: function() { $('bottomAjaxContainer').update(''); $('bottomAjaxContainer').show();}});
	}

	function CloseButton()
	{
		return ' <a class="cancelLink" href="javascript:;" onclick="CloseTopSlider();">Cancel</a>';
	}
	
	function CloseBottomButton()
	{
		return ' <a class="cancelLink" href="javascript:;" onclick="CloseBottomSlider();">Cancel</a>';
	}

	/*
	 * "Don't display again" feature of entrance messages
	 */
	function dontDisplayAgain(messageId) 
	{
		new Ajax.Request(ajaxUrl, { postBody: 'ajaxAction=dontShowAgain&messageId=' + messageId});
		Effect.BlindUp('entranceMessage', {duration: 0.3});
	}

	/*
	 * Show warning if browser is IE6
	 */
	function showIE6Warning()
	{
		if(BrowserDetect.browser == 'Explorer' && BrowserDetect.version == 6)
			$('outerWrapper').insert({'top':"<div class=\"flaggedUserWarning\"><p>It seems that you're using Internet Explorer 6; Jumpchart doesn't support this browser and <strong>functions may not work as they should</strong>. Please consider upgrading to <a target=\"_blank\" href=\"http://google.com/chrome/\">Chrome</a>, <a target=\"_blank\" href=\"http://apple.com/safari/\">Safari</a>, <a target=\"_blank\" href=\"http://getfirefox.com\">Firefox</a> or <a target=\"_blank\" href=\"http://www.microsoft.com/windows/products/winfamily/ie/default.mspx\">Explorer 8</a>.</p></div>"});
	}
	
	/*
	 * WP Export
	 */
	function exportToWordpress()
	{
		if($F('wpExportURL').empty())
			Shake('wpExportURL');
		else
			$('wpExportForm').submit();
	}
	
	/*
	 * Body onload - this fixes a very weird bug on Safari where it wouldn't load the full background color of <body>
	 */
	function initBody()
	{
		if(BrowserDetect.browser == 'Safari')
			$$('body')[0].style.backgroundColor = '#9A9A9A';
	}


