
/*
@@@BUILDINFO@@@ MenuItem.jsx 1.0.1.0   4/16/07
*/

acrobatconnect.startMenuSelected = function()
{

	var result = undefined;
	if(acrobatconnect.net.versionCheck(app.preferences.acrobatconnect_meetingURL))
	{		
		var checkVersion = false;
		result = acrobatconnect.net.loginStoredPrefs(checkVersion);
		if(result == undefined) //prompt for username / pass
		{			
			result = acrobatconnect.prefDlg.loginPassDlg( app.preferences.acrobatconnect_login, acrobatconnect.getClearPass(), app.preferences.acrobatconnect_meetingURL ) ;								
		}
		if(	result != undefined )	
		{
			app.openUrl(acrobatconnect.net.formatURL(app.preferences.acrobatconnect_meetingURL, result));		
			//$.write("launching meeting");
		}
	}
	else  //Invalid meeting url
	{		
		acrobatconnect.startMeeting.open();
	}	
	
}

acrobatconnect.menuID = "startMeetingMenu";


acrobatconnect.showMenuItem = function(show)
{
	if(show)
	{
			var elem = MenuElement.find(acrobatconnect.menuID);
			if(elem != undefined) return;
			var label = acrobatconnect.localize("$$$/CS3/AcrobatConnect/ContextMenu/menuCommand=TBT");
			
			elem = MenuElement.create("command", label, "-after submenu/VersionCue",  acrobatconnect.menuID);
			elem.onSelect = acrobatconnect.startMenuSelected;			
	}	
	else
	{
			MenuElement.remove (acrobatconnect.menuID)
	}	
	
}