/********************************************************************************
Class WSConfiguration
	Store default settings.
	Settings may be override by the user (using merge function).
********************************************************************************/
function WSConfiguration() {
	this.version = {major: 1, minor: 1.3, str: "1.1.3", releaseDate: "2008-01-15"};
	this.userId = '1334641007';
	this.profile = '998';
	//this.sServerURL = "http://www.whitesmoke.com/tools/checker/lib/php/server2.php";
	//this.sAJAXExURL = "http://www.whitesmoke.com/client_v2/xmlhttp.php",
	
	this.bTrial = false;
	this.sMode = "full";
	this.sFormat = "html";
	this.nMaxSuggestions = (this.sMode == "min" ? 4 : 6);
	this.nMaxContentLength = 10000;
	
	this.sContent = "";
	this.sInitailContent = "";
	this.sRSFrameId = "WSRSIFrame"; //RemoteScriptFrameId ?

	this.autoCheck = {onInit: false, whileTyping: false, onChange: false};
	this.enableDictionary = false;

	this.enableProgressWindow = false;
	this.globalProgressWindow = false;
	this.progressWindow = '';
	//this.progressWindow = {win: '', enabled: false, global: false}
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.stLangType = {
	unknown: 0, verb: 4, noun: 5,	adjective: 6, adverb: 7
};
//---------------------------------------------------------------------------------
WSConfiguration.prototype.sendMethod = {
	iframe: 1, ajax: 0, ajax_ex: 0, json: 0
};
//---------------------------------------------------------------------------------	
WSConfiguration.prototype.commandNames = {
	spellcheck: 0, redo: 1, undo: 2, config: 3, debug: 4
};
//---------------------------------------------------------------------------------
WSConfiguration.prototype.resultElementsInfo = {
	suggestions: {id: "wsSuggestionsResult", className: "wsSuggestionsResult"},
	dictionary:  {id: "wsDictionaryResult",  className: "wsDictionaryResult"},
	feedback:    {id: "wsFeedbackResult", className: "wsFeedbackResult"},
	progress:    {id: "wsProgress", className: "wsProgress"}
};
//---------------------------------------------------------------------------------
WSConfiguration.prototype.leftBorderHTML = '';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.rightBorderHTML = '';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.getLengthExceededMsg = function() {
	var msg = 
	"WhiteSmoke's Free Online Checker does not check more than " + 
	this.nMaxContentLength + 
	" characters at a time." + 
	"<p>Upgrade to the full desktop application for unlimited use.<BR>" + 
	"<a href='javascript: openLandingPage();'>Get it Now</a></p>";
	return msg;
};
//---------------------------------------------------------------------------------
WSConfiguration.prototype.explanationMsg =
	"Available only in the desktop application";
//---------------------------------------------------------------------------------
WSConfiguration.prototype.noChangesMsg =
	"<b>Your text has been checked - no changes were made.</b> " +
	"<p>To read about the errors WhiteSmoke detects, click " + 
	"<a target='_blank' href='http://www.whitesmoke.com/features1.html'>here</a></p>" +
	"Upgrade to the full desktop application for unlimited use - " + 
	"<a href='javascript: openLandingPage();'>Get it Now</a>";
//---------------------------------------------------------------------------------
WSConfiguration.prototype.feedbackTemplate = //Same format that the server sends
	'<div class="screenContainerMsg" id="scrCont">' + 
		'<div id="innerContainer">' + 
			'<div id="bgTopMsg">' + 
				'<div class="left"></div>' + 
				'<div class="center" style="color:#fff">' + 
					'<div id="questionMarkImg"></div>' + 
					'<div id="ServerFeedbackXButton"></div>' + 
				'</div>' + 
				'<div class="right"></div>' +
			'</div>' + 
			'<div id="screenContentMsg">' +
				'<div class="insideScreenMsg">' + 
					//'<div style="height:75px;">' + '#{sMessage}' + '</div>' + 
					'<div class=screenMsg>' + '#{sMessage}' + '</div>' + 
					'#{okButton}' +
					'#{downloadButton}' +
					//'<div id="ServerFeedbackOKButton" style="float:right;"></div>' +
					//'<div id="ServerFeedbackDownloadButton" style="float:left;"></div>' +
					//'<a href="http://www.whitesmoke.com/" target="_blank"></a>' + 
				'</div>' +
			'</div>' + 
			'<div id="bgBottomImg"></div>' + 
		'</div>' + 
	'</div>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.suggestionBox =
	'<table CELLPADDING="0" CELLSPACING="0"><tr valign="top"><td>' +
	  '<table wrap class="wsSuggestions"><tr><td id="wsReplace" valign="top" class="wsSuggestionsColumn">' +
		'<table>' +
		  '<th align="left" class="#{className}">#{title}</th>' +
			'#{suggestions}' +
			'#{explanation}' +
		'</table>' +
	  '</td></tr></table>' +
	'</td></tr></table>',
//---------------------------------------------------------------------------------
WSConfiguration.prototype.separatorHTML =
	'<tr><td colspan="3"><HR></td></tr>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.suggestionHTML =
	'<tr><td colspan="3" id="#{id}" name="#{name}" class=#{className}>#{suggestion}</td></tr>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.explanationHTML =
	'<tr><td colspan="3"><HR></td></tr>' + 	
	'<tr><td colspan="3" id="#{id}" name="#{name}" class=#{className}>#{suggestion}</td></tr>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.extendedSuggestionBox =
	'<table CELLPADDING=0 CELLSPACING=0 wrap class="wsSuggestions"><tr>' +
	  '#{enrichmentSuggestion}#{thesaurusSuggestion}' +
	'</tr></table>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.extendedSuggestionHTML =
	'<td valign="top" class="wsSuggestionsColumn"><table>' + 
	  '<th align="left" class="#{className}">#{title}</th>' +
	  '#{suggestions}' +
	'</table></td>';
//---------------------------------------------------------------------------------
WSConfiguration.prototype.enrichSettings = {
	general:	{title: "General",    className: "wsGeneralSuggestion",    name: "wsGeneralSuggestion",    showExplanation: false},
	grammar:	{title: "Grammar",    className: "wsGrammarSuggestion",    name: "wsGrammarSuggestion",    showExplanation: true},	
	spelling:	{title: "Spelling",   className: "wsSpellingSuggestion",   name: "wsSpellingSuggestion",   showExplanation: false},
	//style:	{title: "Style",      className: "wsStyleSuggestion",      name: "wsStyleSuggestion",      showExplanation: false},
	enrichment:	{title: "Enrichment", className: "wsEnrichmentSuggestion", name: "wsEnrichmentSuggestion", showExplanation: false},
	thesaurus:	{title: "Style",  className: "wsThesaurusSuggestion",  name: "wsThesaurusSuggestion",  showExplanation: false}
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.suggestionSettings = {
	single: {className: "wsSuggestion"},
	box: {className: "wsSuggestions"},
	header: {className: "wsSuggestionsHeader"},
	column: {className: "wsSuggestionsColumn"},
	mouseOver: {className: "wsSuggestionOver"},
	explanation: {className: "wsSuggestionExplanation"},
	disabled: {className: "wsSuggestionDisabled"}
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.isHTMLMode = function() {
	return (this.sFormat != "text");
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.toolbar = {
	autoCreate: false,
	location: "bottom",
	items: "spellcheck,undo,redo,config,debug",
	snippet: '<div class="whitesmokeMenuBarContainer"><table class="whitesmokeMenuBarTable"><tr>#{menubaritems}</tr></table></div>',
	itemSnippet: '<td><a href="javascript:#{action}"><img src="#{buttonUrl}" #{imageactions} id="#{buttonId}"/></a></td>'
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.merge2 = function(src, obj) {
	if (obj) {
		for (val in obj) {
			if (typeof(obj[val]) == "object")	{
				this.merge2(src[val],obj[val]);
			}
			else {
				//alert("src["+val+"] = " + obj[val]);
				src[val] = obj[val];
			}	
		}
	}
}
//---------------------------------------------------------------------------------
WSConfiguration.prototype.merge = function(obj) {
	this.merge2(this,obj);
}
//---------------------------------------------------------------------------------