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

acrobatconnect.contextMenuID = "contextStartMeeting";

acrobatconnect.rightClickHandler = function(enabled)
{
	if(acrobatconnect.contextMenu == undefined && enabled)
	{		
		var localizedString = acrobatconnect.localize("$$$/CS3/AcrobatConnect/ContextMenu/cntCommand=TBT");
		
		acrobatconnect.contextMenu = MenuElement.find(acrobatconnect.contextMenuID);		
		try{
			acrobatconnect.contextMenu = MenuElement.create("command", localizedString, "at the end of Thumbnail", "Thumbnail/contextStartMeeting");
			acrobatconnect.contextMenu.onSelect = acrobatconnect.launchStartPage;						
		}
		catch(error){	}			
	}
	else
	{
		MenuElement.remove(acrobatconnect.contextMenuID);
	}
}

acrobatconnect.launchStartPage = 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();
	}		
}
  
