//**********************************************************************************************
//Function used for Show/Hide Division as per passed Division Id
//SS_20050622_1416:BEGIN: 
function ShowHide( objectId )
{

	var obj = eval("window.document.all." + objectId );
	if ( String ( obj ) == '[object]')
	{
		if ( obj.style.display == 'none')
		{
			obj.style.display = 'block';
		}
		else
		{
			obj.style.display = 'none';
		}
	}
}
// SS_20050622_1416:END. 
//**********************************************************************************************

//**********************************************************************************************
// START: Standard messages.
// Following are the standard variables those will be used to store the standard error messages.
// All these variables are not supposed to be changed by the developers in the their pages.
var NOT_AVAILABLE_IN_DEMO = "This functionality is not available in the Demo version.";

var __sArrDemoMessages = new Array();

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/PCardsFrequency.asp
__sArrDemoMessages[ "MONTHLYRADIO" ] = "Mailing will be delivered monthly.";
__sArrDemoMessages[ "ONETIMERADIO" ] = "Mailing will be delivered only once.";
__sArrDemoMessages[ "ANNUALLYRADIO" ] = "Mailing will be delivered annually.";
__sArrDemoMessages[ "QUARTLERLYRADIO" ] = "Mailing will be delivered quarterly.";
__sArrDemoMessages[ "WEEKLYRADIO" ] = "Mailing will be delivered weekly.";
__sArrDemoMessages[ "CUSTOMIZEDRADIO" ] = "Mailing will be delivered as per dates specified here.";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/RecipientsSelectionPkg.asp
__sArrDemoMessages[ "COMMFILTERGO" ] = "Filter recipients by pre-defined searches.";
__sArrDemoMessages[ "IMPORTRECIPIENT" ] = "Import contacts from an external source.";
__sArrDemoMessages[ "NEWSAVEDSEARCH" ] = "Perform search with several criteria and save it for future reference.";
__sArrDemoMessages[ "ADVANCESEARCHLINK" ] = "Perform search with several criteria and save it for future reference.";

// http://dev.accrmsuite.com/CRMSuite/Contacts/Setsearch.asp
__sArrDemoMessages[ "SAVESEARCH" ] = "Saves the search criteria defined here for your future reference.";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/NLFinish.asp
__sArrDemoMessages[ "SAVEDATAFINISH" ] = "Mailing will be saved but it is not scheduled for delivery.";
__sArrDemoMessages[ "SENDNOWFINISH" ] = "Mailing will be delivered right now.";
__sArrDemoMessages[ "APPROVALFINISH" ] = "Mailing will be sent for compliance approval. Once approved it will be scheduled for delivery";
__sArrDemoMessages[ "SCHEDULEFINISH" ] = "Mailing will be scheduled for delivery.";
__sArrDemoMessages[ "FINISH" ] = "Mailing will be scheduled for delivery.";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/CardsFinish.asp
__sArrDemoMessages[ "SAVEDATACARDS" ] = "Mailing will be saved but it is not scheduled for delivery."
__sArrDemoMessages[ "CARDSFINISH" ] = "Mailing will be scheduled for delivery.";
__sArrDemoMessages[ "CARDSSAVEDATA" ] = "Mailing will be saved but it is not scheduled for delivery.";
__sArrDemoMessages[ "OTHERCCRADIO" ] = "Another Credit Card information can be provided for billing.";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/EmailDesign.asp
__sArrDemoMessages[ "LEAFLETSPELLCHECKID" ] = "Performs spell-check on mailing content.";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/PcardsFront.asp
__sArrDemoMessages[ "BTNUPLOADOWNIMAGE" ] = "Images can be uploaded for use in mailings.";
__sArrDemoMessages[ "LINKADDTOFAVORITE" ] = "";

// http://dev.accrmsuite.com/crmSuite/products/PageMaker/PMulticardsBack.asp
__sArrDemoMessages[ "BTNMULTICARDSPELLCHECK" ] = "Performs spell-check on the content specified.";
__sArrDemoMessages[ "BTNMULTICARDUPDATETEXT" ] = "Creates image of the specified content.";

// http://dev.accrmsuite.com/CRMSuite/Diary/Default1.asp
__sArrDemoMessages[ "EVENTDATESENDCARD" ] = "Setup a card for the selected contacts.";

//http://dev.accrmsuite.com/CRMSuite/Contacts/Setappointment.asp
__sArrDemoMessages[ "APPOINTMENTDELETE" ] = "Appointment will be deleted from your diary."; 
__sArrDemoMessages[ "APPOINTMENTSAVE" ] = "Appointment will be added to your diary.\nIf opted, application will send you a reminder for the appointment.";

//http://dev.accrmsuite.com/CRMSuite/Diary/SpecifyToDo.asp
__sArrDemoMessages[ "TODODELETE" ] = "To-Do task will be deleted from your diary."; 
__sArrDemoMessages[ "TODOSAVE" ] = "To-Do task will be added to your diary.";

//http://dev.accrmsuite.com/CRMSuite/Diary/SpecifyNotes.asp
__sArrDemoMessages[ "NOTESDELETE" ] = "Note will be deleted from your diary."; 
__sArrDemoMessages[ "NOTESSAVE" ] = "Note will be added to your diary.";

// http://dev.accrmsuite.com/CRMSuite/Contacts/Listallcontacts.asp
__sArrDemoMessages[ "CONTACTDELETE" ] = "Selected Contact(s) will be deleted from your contact list."; 
__sArrDemoMessages[ "CONTACTDELETE1" ] = "Selected Contact will be deleted from your contact list."; 
__sArrDemoMessages[ "CONTACTDELETE2" ] = "Selected Contact will be deleted from your contact list."; 

// http://dev.accrmsuite.com/CRMSuite/Contacts/SetPreferences.asp
__sArrDemoMessages[ "PREFERENCESAVE" ] = "Your preference(s) will be saved."; 

// http://dev.accrmsuite.com/CRMSuite/Contacts/ShowMailings.asp
__sArrDemoMessages[ "CONTACTMAILING" ] = "You can preview the mailings send to this Contact."; 

// END: Standard messages.

// VP_20050407_1750:BEGIN: Following function added to block the demo user from some funtionality.
// PARAMETERS: 
//     (1) sUsersTypes     : Comma separated string of users security levels who are to be restricted for the 
//                           particular functionalty. By default the 'DEMO_GUEST' will be restricted from the
//                           functionality from where this function is called.
//     (2) bDoNotDispAlert : By default this functions displays an alert. If you do not want this function 
//                           to display an alert pass this parameter as true.
//     (3) sSpecialMsg     : By default the alert message will be 'NOT_AVAILABLE_IN_DEMO'. Otherwise the specified
//                           message will be displayed in the alert.
//     (4) bContinue       : By default the event will be stopped. If it is specified as true, the event will 
//                           continue to execute after displaying the alert message.
// following global variable can be used whereever required.


function IsAllowedInDemo( sUsersTypes, bDoNotDispAlert, sSpecialMsg, bContinue, demoMessageId )
{
	if( String( sUsersTypes ) == "undefined" || String( sUsersTypes ) == "" )
	{
		sUsersTypes = "DEMO_GUEST";
	}

	if( String( bDoNotDispAlert ) == "undefined" || String( bDoNotDispAlert ) == "" )
	{
		bDoNotDispAlert = false;
	}

	if( String( sSpecialMsg ) == "undefined" || String( sSpecialMsg ) == "" )
	{
		sSpecialMsg = NOT_AVAILABLE_IN_DEMO;
	}

	if( String( bContinue ) == "undefined" || String( bContinue ) == "" )
	{
		bContinue = false;
	}
	
	var sTypes = "," + sUsersTypes + ",";

	var sExtraMsg;
	if( String( demoMessageId ) != "undefined" )
	{
		sExtraMsg = __GetDemoMessage( String( demoMessageId ) );
	}
	else
	{
		sExtraMsg = __GetDemoMessage( String( event.srcElement.demoMessageId ) );
	}

	

	if( sExtraMsg != "" )
	{
		sSpecialMsg = sExtraMsg + "\n\n" + sSpecialMsg;
	}

	if ( String( DEMO_SECURITY_LEVEL ) != "" && sTypes.search( DEMO_SECURITY_LEVEL ) != -1 )
	{
		if( ! bDoNotDispAlert )
		{
			alert( sSpecialMsg )
		}
		if( ! bContinue )
		{
			window.event.returnValue = false;
			return false;
		}
	}
	
	return true;
}
// VP_20050407_1750:END. 

function __GetDemoMessage( sElementId )
{
	sElementId = String(sElementId).toUpperCase();

	if( String( __sArrDemoMessages[ sElementId ] ) != "undefined" && String( sElementId ) != "UNDEFINED" )
	{
		return String( __sArrDemoMessages[ sElementId ] );
	}
	else
	{
		return "";
	}
}