<!--

// THIS FILE REQUIRES transaction.js, parser.js

/*********************************************************************************
	(Modified) Simple Drop-Down Menu
	
	Description:	One Level Drop-Down Menu with Timeout effect
	
	Written By:		Unknown @ http://javascript-array.com 
	Written On:		December 10, 2006
	
	Modified By:	Keith McDonald
	Modified On:	May 15, 2009
	Modified:		Added draw/fade concept for the selection of tab and subitems;
					Whenever the tab is selected or any of its subitems, the 
					id is recorded as the last item and when a new tab is opened
					the tab switches the "class" to take on a different style to 
					show it has been selected.  This "class" returns to original
					"class" when the timer for that selection event expires.

**********************************************************************************/
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;
var openedLayer = "";
// open hidden layer
function mopen(id)
{	
	// Added
	if ((lastItem.length > 0) && (openedLayer != id)) 
	{
		setFade(lastItem);
	}
	
	openedLayer = id;
	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	// Added 
	if (ddmenuitem && lastItem.length > 0)
	{ 
		setFade(lastItem);
	}
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 

// The last item that was selected in the navigation
var lastItem = "";

// Added
function draw( itemName ) 
{
	if ((lastItem.length > 0) && (lastItem != itemName)) setFade(lastItem);
	
	var itemMid = itemName + '_mid_hover';
	var targetAnchor = document.getElementById(itemMid);
	targetAnchor.className = 'nav_mid_hover' ;
	
	var itemLeft = itemName + '_left_hover';
	var targetAnchor = document.getElementById(itemLeft);
	targetAnchor.className = 'nav_left_hover' ;
	
	var itemRight = itemName + '_right_hover';
	var targetAnchor = document.getElementById(itemRight);
	targetAnchor.className = 'nav_right_hover' ;
}

// Added
function fade(itemName)
{	
	lastItem = itemName;
}

// Added 
function setFade( itemName ) 
{
	var itemMid = itemName + '_mid_hover';
	var targetAnchor = document.getElementById(itemMid);
	targetAnchor.className = 'nav_mid' ;
	
	var itemLeft = itemName + '_left_hover';
	var targetAnchor = document.getElementById(itemLeft);
	targetAnchor.className = 'nav_left' ;
	
	var itemRight = itemName + '_right_hover';
	var targetAnchor = document.getElementById(itemRight);
	targetAnchor.className = 'nav_right' ;
}

/*********************************************************************************
	Nifty.js
	
	Description:	
	Written By:		Alessandro Fulciniti 
					(http://www.html.it/articoli/niftycube/index.html)
	Written On:		April 6, 2005

**********************************************************************************/

function NiftyCheck(){
	if(!document.getElementById || !document.createElement)
		return(false);
	var b=navigator.userAgent.toLowerCase();
	if(b.indexOf("msie 5")>0 && b.indexOf("opera")==-1)
		return(false);
	return(true);
}

function Rounded(selector,bk,color,size){
	var i;
	var v=getElementsBySelector(selector);
	var l=v.length;
	for(i=0;i<l;i++){
		AddTop(v[i],bk,color,size);
		AddBottom(v[i],bk,color,size);
		}
}

function RoundedTop(selector,bk,color,size){
	var i;
	var v=getElementsBySelector(selector);
	for(i=0;i<v.length;i++)
		AddTop(v[i],bk,color,size);
}

function RoundedBottom(selector,bk,color,size){
	var i;
	var v=getElementsBySelector(selector);
	for(i=0;i<v.length;i++)
		AddBottom(v[i],bk,color,size);
}

function AddTop(el,bk,color,size){
	var i;
	var d=document.createElement("b");
	var cn="r";
	var lim=4;
	if(size && size=="small"){ cn="rs"; lim=2}
	d.className="rtop";
	d.style.backgroundColor=bk;
	for(i=1;i<=lim;i++){
		var x=document.createElement("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
		d.appendChild(x);
		}
	el.insertBefore(d,el.firstChild);
}

function AddBottom(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size && size=="small"){ cn="rs"; lim=2}
d.className="rbottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
    var x=document.createElement("b");
    x.className=cn + i;
    x.style.backgroundColor=color;
    d.appendChild(x);
    }
el.appendChild(d,el.firstChild);
}

function getElementsBySelector(selector){
var i;
var s=[];
var selid="";
var selclass="";
var tag=selector;
var objlist=[];
if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag"
    s=selector.split(" ");
    var fs=s[0].split("#");
    if(fs.length==1) return(objlist);
    return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
    }
if(selector.indexOf("#")>0){ //id selector like "tag#id"
    s=selector.split("#");
    tag=s[0];
    selid=s[1];
    }
if(selid!=""){
    objlist.push(document.getElementById(selid));
    return(objlist);
    }
if(selector.indexOf(".")>0){  //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
    }
var v=document.getElementsByTagName(tag);  // tag selector like "tag"
if(selclass=="")
    return(v);
for(i=0;i<v.length;i++){
    if(v[i].className==selclass){
        objlist.push(v[i]);
        }
    }
return(objlist);
}

/***************************** cb.js **************************
cbb function by Roger Johansson, http://www.456bereastreet.com/
***************************************************************/
var cbb = {
	init : function() {
	// Check that the browser supports the DOM methods used
		if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		var oElement, oOuter, oI1, oI2, tempId;
	// Find all elements with a class name of cbb
		var arrElements = document.getElementsByTagName('*');
		var oRegExp = new RegExp("(^|\\s)cbb(\\s|$)");
		for (var i=0; i<arrElements.length; i++) {
	// Save the original outer element for later
			oElement = arrElements[i];
			if (oRegExp.test(oElement.className)) {
	// 	Create a new element and give it the original element's class name(s) while replacing 'cbb' with 'cb'
				oOuter = document.createElement('div');
				oOuter.className = oElement.className.replace(oRegExp, '$1cb$2');
	// Give the new div the original element's id if it has one
				if (oElement.getAttribute("id")) {
					tempId = oElement.id;
					oElement.removeAttribute('id');
					oOuter.setAttribute('id', '');
					oOuter.id = tempId;
				}
	// Change the original element's class name and replace it with the new div
				oElement.className = 'i3';
				oElement.parentNode.replaceChild(oOuter, oElement);
	// Create two new div elements and insert them into the outermost div
				oI1 = document.createElement('div');
				oI1.className = 'i1';
				oOuter.appendChild(oI1);
				oI2 = document.createElement('div');
				oI2.className = 'i2';
				oI1.appendChild(oI2);
	// Insert the original element
				oI2.appendChild(oElement);
	// Insert the top and bottom divs
				cbb.insertTop(oOuter);
				cbb.insertBottom(oOuter);
			}
		}
	},
	insertTop : function(obj) {
		var oOuter, oInner;
	// Create the two div elements needed for the top of the box
		oOuter=document.createElement("div");
		oOuter.className="bt"; // The outer div needs a class name
	    oInner=document.createElement("div");
	    oOuter.appendChild(oInner);
		obj.insertBefore(oOuter,obj.firstChild);
	},
	insertBottom : function(obj) {
		var oOuter, oInner;
	// Create the two div elements needed for the bottom of the box
		oOuter=document.createElement("div");
		oOuter.className="bb"; // The outer div needs a class name
	    oInner=document.createElement("div");
	    oOuter.appendChild(oInner);
		obj.appendChild(oOuter);
	},
	// addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	addEvent : function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};

// Add an event for load to call the init
cbb.addEvent(window, 'load', cbb.init);

/*********************************************************************************
	checkBeforeDisplay
	
	Description:	Check the screen size to make sure that there is enough space
					to display the column for the column id specified, hide it if
					there is not enough space, show it if there is enough space
	Parameter(s):	displayColumnId - a string value to specify the HTML tag id
					totalWidth - width that the column must be at an absolute
					minimum to show the column specified
	Return(s):		Nothing
	Written By:		Keith McDonald
	Written On:		May 15, 2009

**********************************************************************************/
function checkBeforeDisplay(displayColumnId, totalWidth)
{
	if (document.body.clientWidth < totalWidth)
	{
		var elem = document.getElementById(displayColumnId);
		if (elem)
		{
			elem.style.display = "none";
			elem.style.visibility = "hidden";
		}
	}
	else
	{
		var elem = document.getElementById(displayColumnId);
		if (elem)
		{
			elem.style.display = "block";
			elem.style.visibility = "visible";
		}
	}
	return;
}

var RESIZE_COL_TO_DISPLAY = "news_column";
var RESIZE_MIN_SIZE = 1225;
var EMPTY_STRING = "";
var NO_WRITE = 1;

/*********************************************************************************
	makeAddress
	
	Description:	Helper function that assembles the name and domain to create
					a full email address
	Parameter(s):	lhs - a string that represents the user name for an email
					address
					rhs - a string that represents the domain name for an
					email address
	Return(s):		String representing the full email address
	Written By:		Keith McDonald
	Written On:		October 24, 2009

**********************************************************************************/
function makeAddress(lhs,rhs)
{
	var tempAddress = "";
	
	tempAddress ="";
	tempAddress +=lhs;
	tempAddress +="@";
	tempAddress +=rhs;
	
	return tempAddress;
}

/*********************************************************************************
	createMailLink
	
	Description:	Creates a email link in HTML, based on name and domain
					and whether or not the user wants to define a class and/or
					special text to represent the link on the page.
	Parameter(s):	user - a string representing the name of the user for the
					email address
					domain - a string representing the domain of the email address
					linkText - a string representing any special text to use for
					the link tag value, if empty string passed will use the full
					email address
					classPath - a string representing the class for the link tag
					to use for style, if empty string passed will not add a class
	Return(s):		String representing link text
	Written By:		Keith McDonald
	Written On:		October 24, 2009

**********************************************************************************/
function createMailLink(user,domain,linkText,classPath,noWrite)
{
	var content ="";
	var tempAddress = makeAddress(user,domain);
	content += "<a href=\"mailto:";
	content += tempAddress;
	if (classPath != "")
	{
		content += "\" class=\"";
		content += val;
	}
	content += "\">";

	if (linkText != "")
	{
		content += linkText;
	}
	else
	{
		content += tempAddress;
	}

	content += "</a>";
	if (noWrite != 1)
	{
		document.write(content);
	}
	return content;
}

//  Hardcoded settings
var DIRECTION_START = 0;
var DIRECTION_FORWARD = 1;
var DIRECTION_BACKWARD = -1;
var mainTimeout = 0;
var TIMEOUT_VALUE = 20000;
var MAX_IMAGES = 1;

var PLAY_PAUSE_IMG_ID = "play_pause_image";
var PLAYING_TEXT = "&lt;&lt; Playing &gt;&gt;";
var PAUSED_TEXT = "&lt;&lt; Paused &gt;&gt;";
var playPauseText = PLAYING_TEXT;
var PAUSED = 0;
var PLAYING = 1;
var FEATURE_CONTENT_INITIALIZED = false;
// Variables to hold state/counts
var currentContentItem = 1;
var playPauseState = PLAYING;

// Function to change the opacity for different browsers
function changeOpacity(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

// Function to transition image from previous to next as specified by imagefile
function blendImage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    
    //make image transparent
    changeOpacity(0, imageid);
    
    //make new image
    document.getElementById(imageid).src = imagefile;

    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpacity(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
} 

// Function to handle timeout event, should call changeContentArea
function handleMainTimeout()
{
	changeContentArea(DIRECTION_FORWARD, TIMEOUT_VALUE);
}

// Update the content area and set timeout for next occurance based on
// the direction that the user selected, or based on timer event
function changeContentArea(direction,timeout)
{
	// Check that the array is valid and not emtpy
	if (contentArray == null || contentArray.length == 0)
	{
		return;
	}
	MAX_IMAGES = contentArray.length;
	if (mainTimeout)
	{
		window.clearTimeout(mainTimeout);
		mainTimeout = 0;
	}
	// Increment or Decrement the currentContentItem based on direction, reset on MAX/MIN
	if (direction == DIRECTION_BACKWARD)
	{
		currentContentItem -= 1;
		if (currentContentItem < 1) currentContentItem = MAX_IMAGES;
	}
	else if (direction == DIRECTION_FORWARD)
	{
		currentContentItem += 1;
		if (currentContentItem > MAX_IMAGES) currentContentItem = 1;
	}
	else
	{
		// Any other direction should be considered as reset
		currentContentItem = 1;
	}
	
	var elem = document.getElementById("main_dynamic");
	if (!elem) return;
	
	var page = document.getElementById("main_middle");
	if (!page) return;
	
	var playPauseImg = document.getElementById(PLAY_PAUSE_IMG_ID);
	if (!playPauseImg) return;
	
	// Show pause button, and set state to playing
	playPauseImg.src = "images/pause.png";
	playPauseState = PLAYING;
	playPauseText = PLAYING_TEXT;
	
	// Update the content area and images for current item
	if (contentArray.length >= currentContentItem)
	{
		var contentItem = contentArray[currentContentItem - 1];
		elem.innerHTML = "<h2>" + contentItem.featureTitle + "</h2>";
		elem.innerHTML += contentItem.featureSummary;
		blendImage('image_box','image_photo',contentItem.featureImagePath,500);
	}
	
	// Change the page value
	page.innerHTML = playPauseText + "&nbsp;&nbsp;<strong>Page " + currentContentItem +  " of " + MAX_IMAGES + "</strong>";
	
	// Set the timeout value
	mainTimeout = window.setTimeout(handleMainTimeout,timeout);	
}

function playPauseContentArea(imageId)
{
	if (!FEATURE_CONTENT_INITIALIZED) return;
	// Read the button image from the page
	var playPauseImg = document.getElementById(imageId);
	
	// Return if we could not get the button on the page
	if (!playPauseImg) return;
	
	// Alternate the current state when the button is clicked.
	if (playPauseState == PLAYING)
	{
		
		playPauseState = PAUSED;
		playPauseImg.src = "images/play.png";
		playPauseText = PAUSED_TEXT;
		
		// State = Paused, kill the timer, if available
		if (mainTimeout)
		{
			window.clearTimeout(mainTimeout);
			mainTimeout = 0;
		}
	}
	else
	{
		playPauseState = PLAYING;
		playPauseImg.src = "images/pause.png";
		playPauseText = PLAYING_TEXT;
		
		// State = Playing, kill the timer if available and restart it
		if (mainTimeout)
		{
			window.clearTimeout(mainTimeout);
			mainTimeout = 0;
		}
		
		mainTimeout = window.setTimeout(handleMainTimeout,TIMEOUT_VALUE);
	}
	
	var page = document.getElementById("main_middle");
	
	if (!page) return;
	page.innerHTML = playPauseText + "&nbsp;&nbsp;<strong>Page " + currentContentItem +  " of " + MAX_IMAGES + "</strong>";
	
	return;
}
function initMain()
{
	// Check if we are able to support the style updates
	if( !NiftyCheck() ) return;
	
	// Round the top and bottom of the resource box, unless the 
	// page does not have a resource box
	if (CURRENT_PAGE != "Calendar")
	{
		RoundedTop("div#resource_box","#fff","#B8B8B8");
		RoundedBottom("div#resource_box","#fff","#ECECF2");
	}
	
	// Round the bottom of the menu dropdowns
	if (CURRENT_PAGE == "Resources" || CURRENT_PAGE == "Worship" || CURRENT_PAGE == "Events" || CURRENT_PAGE == "Calendar" )
	{
		RoundedBottom("ul#sddm_fix div","transparent","#fac875");
	}
	else
	{
		RoundedBottom("ul#sddm div","transparent","#fac875");
	}

	// Initialize the window on first load
	checkBeforeDisplay(RESIZE_COL_TO_DISPLAY, RESIZE_MIN_SIZE);
}

// Set the onload for the body, do NOT override this in the HTML!
window.onload=function()
{
	initMain();
	
	// HOME PAGE ONLY
	if (CURRENT_PAGE == "Home" || CURRENT_PAGE == "Layout1" || CURRENT_PAGE == "Outreach")
	{
		// Round the left and right columns
		Rounded("div#column_left","#fff","#D3D7FE");
		Rounded("div#column_right","#fff","#D3D7FE");
	}
	
	var req = new CommandRequest();
	var updater = new PageUpdater();
	var resp = new CommandResponse(updater);
	
	var req2 = new CommandRequest();
	var updater2 = new PageUpdater();
	var resp2 = new CommandResponse(updater2);

	////////////////////////////////////////////////////////////////////////////
	// Attach updaters for each element
	if (CURRENT_PAGE != "Resources")
	{
		updater.attachUpdaterToElement("resources_content",parseResourcesHome);
	}
	else
	{
		updater.attachUpdaterToElement("resources_all_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_all_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_forms_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_forms_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_sermons_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_sermons_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_announcements_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_announcements_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_newsletters_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_newsletters_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_features_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_features_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_opportunities_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_opportunities_archived",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_others_active",parseResourcesIncrement);
		updater.attachUpdaterToElement("resources_others_archived",parseResourcesIncrement);
	}
	if (CURRENT_PAGE == "Home")
	{
		updater2.attachUpdaterToElement("upcoming_events",parseCalendarEvents);
		updater2.attachUpdaterToElement("worship_services",parseWorshipServices);
		updater.attachUpdaterToElement("sermon_focus",parseSermons);
		updater.attachUpdaterToElement("announcements",parseAnnouncements);
		updater.attachUpdaterToElement("main_content",parseFeatures);
		updater.attachUpdaterToElement("opportunities",parseOpportunities);
	}
	if (CURRENT_PAGE == "Events")
	{
		updater2.attachUpdaterToElement("event_list_week",parseAllEvents);
	}
	if (CURRENT_PAGE == "Sermon Focus")
	{
		updater.attachUpdaterToElement("sermons_active_content",parseSermonsActive);
		updater.attachUpdaterToElement("sermons_archived_content",parseSermonsArchived);
		Rounded("div#sermons_active_div","#fff","#D3D7FE");
		Rounded("div#sermons_archived_div","#fff","#D3D7FE");
	}
	if (CURRENT_PAGE == "Announcements")
	{
		updater.attachUpdaterToElement("announcements_active_content",parseAnnouncementsActive);
		updater.attachUpdaterToElement("announcements_archived_content",parseAnnouncementsArchived);
		Rounded("div#announcements_active_div","#fff","#D3D7FE");
		Rounded("div#announcements_archived_div","#fff","#D3D7FE");
	}
	if (CURRENT_PAGE == "Outreach")
	{
		updater.attachUpdaterToElement("volunteering_opportunities",parseVolunteerOpps);
	}
	if (CURRENT_PAGE == "Get Involved")
	{
		updater.attachUpdaterToElement("involvement_opportunities",parseInvolvementOpps);
	}
	////////////////////////////////////////////////////////////////////////////
	
	////////////////////////////////////////////////////////////////////////////
	// Get all the content for each of the elements
	if (CURRENT_PAGE != "Resources")
	{
		if (CURRENT_PAGE == "Events")
		{
			req.addCommand("Get","Resources","Active","None","10");
		}
		else if (CURRENT_PAGE == "Home")
		{
			req.addCommand("Get","Resources","Home","None","-1");
		}
		else
		{
			req.addCommand("Get","Resources","Active","None","20");
		}
	}
	else
	{
		req.addCommand("Get","Resources","Active","All","-1");
		req.addCommand("Get","Resources","Archived","All","-1");
		req.addCommand("Get","Resources","Active","Forms","-1");
		req.addCommand("Get","Resources","Archived","Forms","-1");
		req.addCommand("Get","Resources","Active","Sermons","-1");
		req.addCommand("Get","Resources","Archived","Sermons","-1");
		req.addCommand("Get","Resources","Active","Announcements","-1");
		req.addCommand("Get","Resources","Archived","Announcements","-1");
		req.addCommand("Get","Resources","Active","Newsletters","-1");
		req.addCommand("Get","Resources","Archived","Newsletters","-1");
		req.addCommand("Get","Resources","Active","Features","-1");
		req.addCommand("Get","Resources","Archived","Features","-1");
		req.addCommand("Get","Resources","Active","Opportunities","-1");
		req.addCommand("Get","Resources","Archived","Opportunities","-1");
		req.addCommand("Get","Resources","Active","Others","-1");
		req.addCommand("Get","Resources","Archived","Others","-1");
	}
	if (CURRENT_PAGE == "Home")
	{
		req2.addCommand("Get","Calendar Events","Upcoming Events","None","10");
		req2.addCommand("Get","Worship Services","Current Week","None","-1");
		req.addCommand("Get","Sermons","Current Series","None","15");
		req.addCommand("Get","Announcements","Active","None","15");
		req.addCommand("Get","Features","Active","None","10");
		req.addCommand("Get","Opportunities","Active","None","10");
	}
	if (CURRENT_PAGE == "Events")
	{
		req2.addCommand("Get","Calendar Events","All Events","None","-1");
	}
	if (CURRENT_PAGE == "Sermon Focus")
	{
		req.addCommand("Get","Sermons","Active","None","-1");
		req.addCommand("Get","Sermons","Archived","None","-1");
	}
	if (CURRENT_PAGE == "Announcements")
	{
		req.addCommand("Get","Announcements","ActiveMain","None","-1");
		req.addCommand("Get","Announcements","ArchivedMain","None","-1");
	}
	if (CURRENT_PAGE == "Outreach")
	{
		req.addCommand("Get","Volunteering Opportunities","Active","None","-1");
	}
	if (CURRENT_PAGE == "Get Involved")
	{
		req.addCommand("Get","Involvement Opportunities","Active","None","-1");
	}
	////////////////////////////////////////////////////////////////////////////
	
	////////////////////////////////////////////////////////////////////////////
	// Ajax Transaction to send data to server and handle callback
	// and processing of the received XML data
	var ajax = new AjaxTransaction("cmdprocessor.php",req,resp);
	ajax.send();
	
	// Perform a second transaction for all calendar events,
	// since there is a significant delay with processing from
	// Google API service, only do this, if we have at least one
	// command that is sent to the command processor
	if (req2.cmdArray.length > 0)
	{
		var ajax2 = new AjaxTransaction("cmdprocessor.php",req2,resp2);
		ajax2.send();
	}
}

// Set the onresize function for the body, do NOT override this in HTML!
window.onresize=function()
{
	// On resize, check whether or not to display the ELCA news column
	checkBeforeDisplay(RESIZE_COL_TO_DISPLAY, RESIZE_MIN_SIZE);
}

// -->