/*
@@@BUILDINFO@@@ MeetingFav.jsx 1.0.1.0  4/16/07
*/
	
// Browse scheme
acrobatconnect.browseScheme = function (event)
{
	
}

//initialization
acrobatconnect.makeIconPath = function(baseName)
{	
	var iconPath = acrobatconnect.getScriptFolder();
	var iconExt;	
	if (Folder.fs == "Macintosh")
	{
		iconPath += "/Resources/Icons/";
		iconExt = ".icns"; 		
	}
	else
	{
		iconPath += "/Resources/Icons/";
		iconExt = ".ico";	
	}
	var iconFile = new File(iconPath + baseName + iconExt);
	return iconFile.fsName;
} 

//Path to startMeeting Flex app
acrobatconnect.flexURL = function()
{		
	var plainTextPass = acrobatconnect.tea.TEAdecrypt(app.preferences.acrobatconnect_password, app.preferences.acrobatconnect_login);
	plainTextPass =   Folder.encode(plainTextPass);
	plainTextPass = plainTextPass.replace ( /%00/g, "");	 //remove nulls from decoded password
	plainTextPass = Folder.decode(plainTextPass);
	var itemPath =  acrobatconnect.getScriptFolder() ;	
	itemPath =  itemPath + "/Resources/Flex/LoginDialog/bin/LoginScreen.html?locale=" + $.locale  
																													+ "&login=" + encodeURI(encodeURIComponent(app.preferences.acrobatconnect_login))
																													+ "&password=" + encodeURI(encodeURIComponent(plainTextPass)	)
																													+ "&meetingURL=" +  encodeURI(encodeURIComponent(app.preferences.acrobatconnect_meetingURL));																																																																																							    
																													+ "&traling=param"
																													
	return itemPath;
} 


acrobatconnect.makeFavorite = function(show)
{		
	app.favorites.section="standard";
	try{
		app.registerBrowseScheme( "acrobatconnect",  acrobatconnect.browseScheme);	
		acrobatconnect.startMeeting         = new Thumbnail( "acrobatconnect://root"  );
		acrobatconnect.startMeeting.iconPath    = acrobatconnect.makeIconPath( "meeting" );
		acrobatconnect.startMeeting.name       = acrobatconnect.localize("$$$/CS3/AcrobatConnect/MeetingFav/StartMeeting=TBT");	
		acrobatconnect.startMeeting.displayMode = "web";
		var theFile = File(acrobatconnect.flexURL());			
				
		acrobatconnect.startMeeting.displayPath = theFile ;				
		if(show)
		{
			if( !app.favorites.contains( acrobatconnect.startMeeting ) )
			{			
				app.favorites.insert( acrobatconnect.startMeeting, app.favorites.length );
			}		
		}	

	}
	catch(error){}
	
}

acrobatconnect.showFav = function(show)
{	
		if(show)
		{
			app.favorites.insert( acrobatconnect.startMeeting, app.favorites.length );
		}
		else
		{	
			app.favorites.remove( acrobatconnect.startMeeting ) ;
		}		
}