	//------------------------------------------------------------------------------------------------
	function MountCarmelConfirmLeave(psUrl)
	{
		var element;
		var options = {'yes': function() {window.location = psUrl;},
								'cancel': function() {Void();}
							  };
		MountCarmelShowMessage( { 
										'title': 'Go to Our365.com',
										'message': "You are now leaving the Mount Carmel Little Miracles WebNursery to visit Our365.com, where you can edit your baby’s information and buy pictures, keepsakes and much more. Our365 took your Newborn Portraits and powers the Mount Carmel Little Miracles WebNursery."
														}, options 
													);
	}
	
	//------------------------------------------------------------------------------------------------
	function MountCarmelUnauthorizedEdit()
	{
		var element;
		var options = {	'cancel': function() {Void();}
							  };
		MountCarmelShowMessage( { 
										'title': 'Go to Our365.com',
										'message': "Sorry, only the user who set up the account linked to this baby can edit the baby record.  If this is your baby, <a href=\'/myaccount/editprofile.aspx\'>click here</a> to create a link between your account and your baby."
														}, options 
													);
	}
	
	//------------------------------------------------------------------------------------------------
	function MountCarmelShowMessage( message, options )
	{
		var newWindow = MountCarmelWindow( message, options );
		newWindow.addClass( UI.settings.hiddenClass );
		$(document.body).adopt( newWindow );
		UI.initCloseButton(newWindow);
		var callback;
		if( arguments.length > 2 )
		{
			callback = arguments[2];
		}
		UI.fadeInElement(newWindow,callback);
	}
	
	//------------------------------------------------------------------------------------------------
	function MountCarmelWindow(str, options)
	{
		var newWindow;
		if ( options != UI.settings.window.loading )
		{
			var buttonEles = [];

			for( var key in options ) {
				if (key == 'yes')
					buttonEles.push(new Element('a', {	'href': UI.settings.voidLink,'class': 'yes' + " " + 'yes' + "Button",'events': {'click': options['yes']}})
												.adopt(new Element('img', {'src':'/App_Themes/Default/img/MountCarmel_button_goto.png','width': HTMLFactory.settings.window['yes'].width,'height': HTMLFactory.settings.window['yes'].height,'alt': 'yes'}))
											  );
				if (key == 'cancel')
					buttonEles.push(new Element('a', {	'href': UI.settings.voidLink,'class': 'cancel' + " " + 'cancel' + "Button",'events': {'click': options['cancel']}})
												.adopt(new Element('img', {'src':'/App_Themes/Default/img/MountCarmel_button_cancel.png','width': HTMLFactory.settings.window['cancel'].width,'height': HTMLFactory.settings.window['cancel'].height,'alt': 'cancel'}))
											  );
			}
			
			buttonEles.each( function(ele) {ele.addEvent('click', function() {UI.fadeOutElement(newWindow);});} );	
			
			var innerContent = 
			[	
				new Element( 'a', {'class': 'close','href': UI.settings.voidLink} ).adopt(new Element('img', {'src':'/App_Themes/Default/img/ico_close.gif','width': 15,'height': 15,'alt': '[x]'})	),
				new Element( 'h2' ).setHTML( str.title ),
				new Element( 'p', {'class': 'message'} ).setHTML(str.message),
				new Element( 'div', {'class': 'genericWindowButtonContainer'} ).adopt( buttonEles )
			];
		} 
		else
		{
			var innerContent = new Element( 'div', {'class': 'loading'} ).adopt( new Element('p').setHTML(str) );
		}
		
		newWindow = new Element('div', {'class': 'genericWindowContainer'})
									.adopt(new Element( 'div', {'class': 'genericWindow window mcclearfix'} )
										.adopt(new Element( 'div', {'class': 'innerPad mcclearfix'} )
											.adopt(innerContent)));
		console.log(newWindow);
		return newWindow;
	}
	
// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
function AddClassName(objElement, strClass, blnMayAlreadyExist)
   {
   // if there is a class
   if ( objElement.className )
      {
      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');
      // if the new class name may already exist in list
      if ( blnMayAlreadyExist )
         {
         // get uppercase class for comparison purposes
         var strClassUpper = strClass.toUpperCase();
         // find all instances and remove them
         for ( var i = 0; i < arrList.length; i++ )
            {
            // if class found
            if ( arrList[i].toUpperCase() == strClassUpper )
               {
               // remove array item
               arrList.splice(i, 1);
               // decrement loop counter as we have adjusted the array's contents
               i--;
               }
            }
         }
      // add the new class to end of list
      arrList[arrList.length] = strClass;
      // add the new class to beginning of list
      //arrList.splice(0, 0, strClass);
      // assign modified class name attribute
      objElement.className = arrList.join(' ');
      }
   // if there was no class
   else
      {
      // assign modified class name attribute      
      objElement.className = strClass;
      }
   } // AddClassName

// ----------------------------------------------------------------------------
// RemoveClassName
//
// Description : removes a class from the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to remove
function RemoveClassName(objElement, strClass)
   {
   // if there is a class
   if ( objElement.className )
      {
      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');
      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();
      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {
         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {
            // remove array item
            arrList.splice(i, 1);
            // decrement loop counter as we have adjusted the array's contents
            i--;
            }
         }
      // assign modified class name attribute
      objElement.className = arrList.join(' ');
      }
   // if there was no class
   // there is nothing to remove
   } // RemoveClassName
