
function win(fileName) 
{
	var myFloater = window.open('','myWindow','scrollbars=yes,resizable=yes,status=no,width=300,height=300');
	myFloater.location.href = fileName;
	if (window.focus) myFloater.focus();
}

function winimage(fileName,width,height) 
{
	var myFloater = window.open('','myWindow','scrollbars=yes,resizable=yes,status=no,width=' + width + ',height=' + height);
	myFloater.location.href = fileName;
}

function getCookie(sName) {
	var aCookie = document.cookie.split('; ');
	for (var i=0; i < aCookie.length; i++) {
		var aCrumb = aCookie[i].split('=');
		if (sName == aCrumb[0]) {
			return unescape(aCrumb[1]);
		}
	}
	return null;
}

function toggleTinyEditors () {
	for (var i = 0; i < editors.length; i++) {
		var id = editors[i].identify();
		if (!tinyMCE.getInstanceById(id)) {
			tinyMCE.execCommand('mceAddControl',false,id);
			document.cookie = 'tinyMCE=on';
		} else {
			tinyMCE.execCommand('mceRemoveControl',false,id);
			document.cookie = 'tinyMCE=off';
		}
	}
}

/**
 * Handles taking user to next page automatically when logging in or
 * registering
 * 
 * Note: Uses prototype!
 * 
 * @param string form ID of form to submit
 * @param string replaceTxt
 */
function autoSubmitForm (form, replaceTxt) {
	var delay = 2000; //time to wait after the page is done loading
	
	Event.observe(window, 'load', function () {
		setTimeout(function () {
			//2 seconds after page is done loading, auto submit the form.
			myForm = $(form);
			if (myForm){
				if (replaceTxt) {
					window.location.replace(replaceTxt);
				}
				myForm.submit();
			}
		}, delay);
	});
}

