var t = Class.create();

t.prototype = {
	initialize : function(element) {
		this.element = $(element);
		var options = Object.extend({}, arguments[1] || {});
		this.menu = $A(this.element.getElementsByTagName('a'));
		this.show(this.getInitialTab());
		this.menu.each(this.setupTab.bind(this));
	},
	setupTab : function(elm) {
		Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)
	},
	activate :  function(ev) {
		var elm = Event.findElement(ev, "a");
		Event.stop(ev);
		this.show(elm);
		this.menu.without(elm).each(this.hide.bind(this));
	},
	hide : function(elm) {
		$(elm).removeClassName('active-tab');
		$(this.tabID(elm)).removeClassName('active-tab-body');
	},
	show : function(elm) {
		$(elm).addClassName('active-tab');
		$(this.tabID(elm)).addClassName('active-tab-body');

	},
	tabID : function(elm) {
		return elm.href.match(/#(\w.+)/)[1];
	},
	getInitialTab : function() {
		if(document.location.href.match(/#(\w.+)/)) {
			var loc = RegExp.$1;
			var elm = this.menu.find(function(value) { return value.href.match(/#(\w.+)/)[1] == loc; });
			return elm || this.menu.first();
		} else {
			return this.menu.first();
		}
	}
}

var currentURL = document.location.href;
if (currentURL.indexOf("EditProfile") >= 0)
	Event.observe(window,'load',function(){ new t('tabs'); },false);


						function deleteProfile(PROFILE)
						{
							if (confirm("Are you sure you want to delete this profile?")) 
							{
								var relocate = 'eventsentry_config.asp?PROFILE=' + PROFILE + '&DELETECONFIG=DELETE&refer=<%=Referral%>';
								location.href = relocate;
								
							}
						} 
						function PassProfile(myProfile)
						{
							myForm = document.forms.Input;
							myForm.PROFILE.value = myProfile;
						} 		
						function Nessus()
						{
							if (document.forms.Input.NessusEnable.options[document.forms.Input.NessusEnable.selectedIndex].value == 0)
							{
								document.forms.Input.NessusResolveNames.disabled = true;
								document.forms.Input.NessusDisplayScans.disabled = true;
								document.forms.Input.NessusMessageLen.disabled = true;
								document.forms.Input.NessusExcludePID.disabled = true;
							}else{
								document.forms.Input.NessusResolveNames.disabled = false;
								document.forms.Input.NessusDisplayScans.disabled = false;
								document.forms.Input.NessusMessageLen.disabled = false;
								document.forms.Input.NessusExcludePID.disabled = false;
							}
						}
						
						function showDetails(o)
						{
							var message = "";
					
							if (o == "Name")
								message = 'The profile name is used in the Web Reports as the alias for your database connection and configuration values associated with it. For example, it is possible to have one profile designated for current events and the another for your archived database. It is also possible to setup multiple connections to the same database with different language settings.'; 
							if (o == "Title")
								message = 'The title tag can be seen at the very top of the web browser window.'; 
							if (o == "DefaultProfile")
								message = 'This option sets the current profile to be handled first if another profile isn\'t otherwise selected. '; 
							if (o == "ODBCDSN")
								message = 'Specify either a Connection String or System DSN to allow the Web Reports to connect to the database.';
							if (o == "Username")
								message = 'This is the username used to connect to the System DSN. The user account "eventsentry_web" has been created for this purpose.';
							if (o == "Password")
								message = 'This is the password field for the System DSN.';
							if (o == "TablePrefix")
								message = 'The table prefix is only used when connecting to an Oracle database.';
							if (o == "QueryTimeout")
								message = 'The timeout value set here will be reflected on the amount of time allotted when connecting and retreiving values the database. This is separate timeout value set on the script in IIS.';
							if (o == "EmailServer")
								message = 'The SMTP server that can be used to send email from the web reports.';
							if (o == "EmailSender")
								message = 'This is the address that the emails should be sent from.';
							if (o == "EmailSubject")
								message = 'The subject of the emails sent.';
							if (o == "EmailMessage")
								message = 'The default message that appears at the bottom of all the emails.';
							if (o == "JabberServer")
								message = 'The server that the Web Reports should connect to when sending Jabber messages. By default this should be <i>talk.google.com</i>.';
							if (o == "JabberUSR")
								message = 'The username of the account that should send the Jabber messages.';
							if (o == "JabberPWD")
								message = 'The password for the account used to send the Jabber messages.';
							if (o == "JabberMessage")
								message = 'The default Jabber message that will appear at the bottom of all the messages.';
							if (o == "JabberPort")
								message = 'This is the port used to connect to the Jabber server. By default this is <i>5223</i>.';
							if (o == "JabberUseSSL")
								message = 'Declares whether SSL should be used.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
								
							$('general-moreInfo').innerHTML = message;
							message = "";
								
							// Appearance	
							if (o == "DateFormat")
								message = 'This controls how the Web Report displays time and date.';
							if (o == "Language")
								message = 'This allows you to change the Language of the Web Reports. By changing this value, all menus and descriptive text will be in the selected language.';
							if (o == "CharacterEncoding")
								message = 'By default the character encoding of the Web Reports is "iso-8859-1". ';
							if (o == "CSVSEP")
								message = 'The is the value used to separate values in the CSV format.';
							if (o == "FontDefault" || o == "FontDefaultsize")
								message = 'This value lets you declare the font type and the font size for the general text in the Web Reports.';
							if (o == "FontForm" || o == "FontFormsize")
								message = 'This value lets you declare the font type and the font size for the Form/Menu text in the Web Reports.';
							if (o == "FontResult" || o == "FontResultsize")
								message = 'This value lets you declare the font type and the font size for the result text in the Web Reports.';
							if (o == "ShowLocations")
								message = 'The Locations functionality can be very useful despite the performance impact. It allows you to organize your computers based on descriptions you set. ';
							if (o == "ShowGroupsAndFilters")
								message = 'Allows you to view your results with Group and Filter information.';
					
							if (o == "HideAnonymous")
								message = 'This value hides the anonymous warning that is displayed when any one has permissions to view the contents of the Web Reports.';
							if (o == "SurpressOutOfDate")
								message = 'This value hides any warning that indicates the database structure is out of date.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
								
							$('appearance-moreInfo').innerHTML = message;																					
							message = "";
					
							if (o == "RecentDrop")
								message = 'This option allows you to populate menus with only recent data.';
							if (o == "DisableDrop")
								message = 'Turn off dynamic menus.';
							if (o == "ResolveIP")
								message = 'Tells the Web Reports to resolve IP address which will impact the performance.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
								
							$('optimization-moreInfo').innerHTML = message;																					
							message = "";			
					
							if (o == "OverviewMaxEventCount")
								message = 'This value respresents the initial number of event messages that are loaded on the Network Overview page.';
							if (o == "OverviewMaxHBFailed")
								message = 'This value respresents the number of Heartbeat events that are displayed in the Heartbeat Status section on the Network Overview page when hosts have a negative status.';
							if (o == "OverviewMaxHBHistory")
								message = 'This value respresents the number of Heartbeat events that are loaded in the Heartbeat History section on the Network Overview page.';
							if (o == "OverviewMaxReport")
								message = 'This value respresents the number of Popular Reports that are loaded on the Network Overview page.';
							if (o == "OverviewMaxInstall")
								message = 'This value respresents the number of installed applications that are loaded on the Network Overview page.';
							if (o == "IndexOrder")
								message = 'This represents the loading order of the tiles on the Network Status page. Please note that the values can also be changed by dragging tiles in to place.';
							if (o == "PerfOverviewPos1" || o == "PerfOverviewPos2" || o == "PerfOverviewPos3")
								message = 'This value is used when loading the default counters on the Computer Overview page.';
							if (o == "PerfOverviewPos1instance" || o == "PerfOverviewPos2instance" || o == "PerfOverviewPos3instance")
								message = 'This value is used when loading the default instances on the Computer Overview page.';
							if (o == "ComputerOrder")
								message = 'This represents the loading order of the tiles on the Computer Overview page. Please note that the values can also be changed by dragging tiles in to place.';
							if (o == "ComputerOverviewDefault")
								message = 'This will be the first computer loaded when navigating to the Computer Overview page. If this value is blank the first computer in the list will be loaded.';
							if (o == "ComputerOverviewExclude")
								message = 'This option lets you filter computers from the Computer Overview list.';
							if (o == "ComputerOverviewMaxEventCount")
								message = 'This value respresents the initial number of event messages that are loaded on the Computer Overview page.';
							if (o == "ComputerOverviewMaxProcess")
								message = 'This value respresents the initial number of processes that are loaded on the Computer Overview page.';
							if (o == "ComputerOverviewMaxInstalled")
								message = 'This value respresents the number of installed applications that are loaded on the Computer Overview page.';
							if (o == "ComputerOverviewSwap")
								message = 'This value allows you to swap which side the tiles are loaded from.';
							if (o == "NetworkStatusCheck")
								message = 'This value controls the interval in which the Network Status page will check for new values.';
							if (o == "NetworkStatusTransition")
								message = 'Controls the method in which changes are represented on the Network Status page.';
							if (o == "NetworkStatusExclude")
								message = 'This option lets you filter computer from the Network Status page.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
								
							$('overview-moreInfo').innerHTML = message;																					
							message = "";					
								
							if (o == "EventDetailShowCharacters")
								message = 'This is the display length for event messages in the result set.';
							if (o == "CategoryLen")
								message = 'This is the display length for category in the result set.';
							if (o == "SourceLen")
								message = 'This is the display length for source in the result set.';
							if (o == "DefaultRecordLimit")
								message = 'This is the default record limit placed on all pages in the Web Reports.';
							if (o == "DefaultTimeLimit")
								message = 'This is the default time limit that affects all the pages in the Web Reports.';
							if (o == "MyEventlogComments")
								message = 'This controls whether comments are posted to Myeventlog.com.';
							if (o == "TruncateSelect")
								message = 'This value controls the widths of the options lists in the Web Reports. In Firefox when the select box is click you can clearly read the entire value. However in Internet Explorer this value is truncated. Turning this value \'On\' allows you to toggle this option and lets you view the entire value.';
					
							$('search-moreInfo').innerHTML = message;																					
							message = "";		
							
							if (o == "DiskReportsInitialComputerCount")
								message = 'This is the initial number of computers displayed on the Diskspace Status page.';
							if (o == "WarningThresholdExpired")
								message = 'This is the durations considered before flagging that old data is present.';
							if (o == "HideExpiredDisks")
								message = 'This is the durations allowed before hiding a drive from the Diskspace Status page.';
							if (o == "DiskReportsDefaultAbsoluteLimit")
								message = 'This is the default value given in the "Only show drives with free space below:" value.';
							if (o == "DiskLowerBound")
								message = 'Any value below this will be flagged with red.';
							if (o == "DiskUpperBound")
								message = 'Any value below this will be flagged with yellow while the values over this value will be green.';
							if (o == "DiskChartDefaultShowAs")
								message = 'This value will determine whether the Diskspace Charts will represent free diskspace or used.';
							if (o == "DiskChartYAxis")
								message = 'Controls the Y Axis of the Diskspace values.';
							if (o == "PerformYAxis")
								message = 'Controls the Y Axis of the Performance values.';
							if (o == "TemperatureScale")
								message = 'This value controls the temperature method used.';
							if (o == "LowerBound")
								message = 'Any value below this will be flagged with green.';
							if (o == "UpperBound")
								message = 'Any value below this will be flagged with yellow while the values over this value will be red.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							
							$('charts-moreInfo').innerHTML = message;																					
							message = "";		
								
							if (o == "NessusEnable")
								message = 'This options turns on Nessus in the Web Report.';
							if (o == "NessusResolveNames")
								message = 'Since most nessus scans use IP address, this functionality allows the Web Reports to do a reverse lookup and obtain the hostname. Please note that this does impact performance.';
							if (o == "NessusDisplayScans")
								message = 'This allows you to search based on scan timestamps. Please note that this slightly impacts performance.';
							if (o == "NessusMessageLen")
								message = 'This controls the message length of description in the results set.';
							if (o == "NessusExcludePID")
								message = 'Allows you to declare a comma separated list of Plugin ID\'s that you would like to exclude from the results.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
					
							$('nessus-moreInfo').innerHTML = message;																					
							message = "";	
					
							if (o == "PTDefaultCost")
								message = 'Allows you to set a default price for printing.';
							if (o == "PTShowCost")
								message = 'This value lets you display a cost associated with printing.';
							if (o == "DashboardComputers")
								message = 'This list represents the initial computers that are loaded on the dashboard.';
							if (message.length == 0)
								message = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
								
							$('advanced-moreInfo').innerHTML = message;																					
							message = "";	
						}
						
						function hideDetails(o)
						{
							$('general-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('appearance-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('optimization-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('overview-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('search-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('charts-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('nessus-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
							$('advanced-moreInfo').innerHTML = '<a href="http://www.netikus.net/software/eventsentry/index.html?webprofileeditor.htm" title="Help" target="_blank">Help</a>';
						}
