HtmlContentEditor = {
mode: "specific_textareas",
plugins: "spellchecker,taoquote,csscleanup,media,pagebreak",
theme: "advanced",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1: "styleselect,bold,italic,underline,strikethrough,separator,undo,redo,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,forecolor",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,image,media,separator,code,anchor,html,link,unlink,spellchecker,separator,blockquote,taoquote,|,removeformat,csscleanup,|,pagebreak",
theme_advanced_buttons3: "",
pagebreak_separator: "<!-- page_split -->",
convert_urls: false,
theme_advanced_statusbar_location: "bottom",
theme_advanced_path: false,
theme_advanced_resize_horizontal: false,
theme_advanced_resizing: true,
theme_advanced_styles : "Normal Paragraph=tinymce_paragraph;Left Align Paragraph Image=tinymce_image_left;Main News Text=tinymce_main_news;Main News Image=tinymce_main_image_left;Continue Reading Link=tinymce_continue_link;Homepage Story=story;Homepage Story Date=story_date;Homepage Story Tags=story_tags",
cleanup_on_startup: true,
convert_fonts_to_spans : true,
apply_source_formatting: true,
extended_valid_elements: "object[width|height],param[name|value],embed[src|type|wmode|width|height]",
width: "100%",
height: 580,
relative_urls: false,
content_css : "/css/styles-sept2008-tiny.css"
};

UserFacing = {
mode: "specific_textareas",
theme: "simple",
convert_urls: false, 
cleanup_on_startup: true,
convert_fonts_to_spans : true,
apply_source_formatting: true,
width: "100%",
relative_urls: true
};

Tiny.addConfig('HtmlContent',HtmlContentEditor);
Tiny.addConfig('UserFacing',UserFacing);

//adds classes to the input depending on the type
jQuery(document).ready(function(){
    jQuery('#left-column input[type="text"]').addClass('text');
    jQuery('#left-column input[type="button"]').addClass('btn');
	jQuery('#left-column input[type="radio"]').addClass('radio');
});

interface={
	text_focus:{
		init:function() {interface.text_focus.attachFocus($$("input.focus)"));},
		attachFocus:function(sfEls){
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onfocus=function() {interface.text_focus.OnFocus(this,this.defaultValue);}
			}
		},
		OnFocus:function(txtInput,str){
			if(txtInput.hasFocus){return;}
			txtInput.hasFocus=true;
			if(str=='Password'&&txtInput.value==str){
				txtInput=interface.text_focus.swapInputType(txtInput,str);
			}
			if(txtInput.value==str)txtInput.value='';
			txtInput.className+=" sffocus";
			txtInput.onblur = function(){
				if(txtInput.value==''){
					if(txtInput.type=='password')txtInput=interface.text_focus.swapInputType(txtInput,str);
					txtInput.value=str;
				}
				$(txtInput).removeClassName("sffocus");
				txtInput.hasFocus=false;
			}
		},
		swapInputType:function(txtInput,str){
			var newInput = document.createElement('input');
			if(txtInput.type=='password')newInput.type='text';
			else newInput.type='password';
			newInput.name = txtInput.name;
			newInput.value = txtInput.value;
			newInput.id = txtInput.id;
			newInput.className = txtInput.className;
			objParent=txtInput.parentNode;
			objParent.replaceChild(newInput,txtInput);
			newInput.onfocus = function (){txtInputOnFocus(newInput,str)};
			newInput.hasFocus=false;
			window.newInput = newInput;
			newInput.onblur = function(){
				if(newInput.value==''){
					if(newInput.type=='password')newInput=swapInputType(newInput,str);
					newInput.value=str;
				}
				newInput.hasFocus=false;
			}
			setTimeout("newInput.hasFocus=true;newInput.focus();",1);
			return newInput;
		}
	}	
}

document.observe("dom:loaded",
	function(){
		interface.text_focus.init();
	}
);

var ssi = {
		openRegistration: function(content) {
			registrationFrameHtml = '<iframe src="'+content+'" width="100%" height="100%"><p>Your browser does not support iframes.</p></iframe>';
			swc.popup.create(registrationFrameHtml, {modal: 'true', width: '650px', className: 'registration', resizable: 'false'});
		},
		
		openLogin: function(content) {
			swc.popup.create(content, {modal: 'true', width: '560px', className: 'login', resizable: 'false'});
		}
	};

