/**
* Javascripts for shoplupe Usability Manager
* @author Hendrik Bahr
*/

/**
* TinyMCE WYSIWYG definition
*/
tinyMCE.init({
			theme : "advanced",
			mode : "textareas",
			plugins: "advlink",
			width: "500",
			height: "200",
			editor_deselector : "mceNoEditor",
			theme_advanced_toolbar_location: "top",
			theme_advanced_disable: "styleselect, indent, outdent",
			theme_advanced_buttons3: "", 
			advlink_styles: "thumber=thumber"
});

function swapTabs(tabOld, tabNew) {
	$(tabOld).style.display = 'none';
	$(tabOld+'tab').className = 'agencyOrderFormTab';
	$(tabNew).style.display = '';
	$(tabNew+'tab').className = 'agencyOrderFormTab current';
	$('active_tab').value = tabNew;
}

function startLoading(contentId, loadingId) {
  $(loadingId).toggle();
  $(contentId).hide();
}

function finishLoading(contentId, loadingId) {
  $(contentId).show();
  $(loadingId).toggle();
}

function loadContent(contentId, loadingId, url, postbody) {
	new Ajax.Updater(contentId, url, {
		method: 'post',
		postBody: postbody,
		onCreate: function() { startLoading(contentId, loadingId); },
		onComplete: function() { finishLoading(contentId, loadingId); },
		evalScripts: true
	});
}

function openWindowCloseWindow(url, shopid) {
    fenster = window.open(url+'?sid='+shopid, "fenster1", "width=1,height=1,status=no,scrollbars=no,resizable=no");
    fenster.setTimeout(function() {fenster.close();}, 3000);
}
