﻿/// <reference path="jquery-1.5-vsdoc.js" />

function createEditor(id)
{
	$("#" + id).cleditor({
		width: "100%",
		height: 450,
		controls:     // controls to add to the toolbar
						"bold italic underline | color highlight removeformat | bullets numbering | outdent " +
						"indent | alignleft center alignright justify | undo redo | " +
						"rule image link unlink | cut copy paste pastetext | source"
	});
}

var jquerycssmenu = {
	settings: { overduration: 300, outduration: 150 },

	buildmenu: function (menuid)
	{
		jQuery(document).ready(function ($)
		{
			var mainmenu = $("#" + menuid)
			mainmenu.find("li").each(function (i)
			{
				var item = $(this);
				if (item.hasClass("item"))
				{
					// ADD HOVER functionality
					item.hover(
					// over
						function () { jquerycssmenu.togglesubmenu(this, true) },
					// out
						function () { jquerycssmenu.togglesubmenu(this, false) }
					);

					// CHANGE VISIBILITY
					item.find("ul").css({display:'none',visibility:'visible'});
				}
			});
		}) //end document.ready
	},
	togglesubmenu: function (parent, show)
	{
		var el = $(parent)
		if (show) el.find("ul").fadeIn(this.settings.overduration)
		else el.find("ul").fadeOut(this.settings.outduration)
	}
}

function ChangeHomeImage()
{
	try
	{
		var nLower = 1;
		var nUpper = 14;
		var nNumber = Math.floor(Math.random() * (nUpper - nLower + 1)) + nLower;
		var sCss = "home-" + nNumber;
		var eContainer = $("#content-home .container");
		for (var i = nLower; i <= nUpper; i++)
		{
			eContainer.removeClass("home-" + i);
		}
		eContainer.addClass(sCss);
		ScheduleChangeHomeImage();
	} 
	catch (err) { }
}

function ScheduleChangeHomeImage()
{
	try
	{
		var nSeconds = 5;
		setTimeout(ChangeHomeImage, nSeconds * 1000);
	} 
	catch (err) { }
}

//build menu with ID="myjquerymenu" on page:
jquerycssmenu.buildmenu("menu")

