 								switchActiveCCFile( ccObj );
 							}
 							
-							if (_flashvars.allowCookies=="true" && ccObj.language )
-							{
-								try
-								{
-									var sharedObj : SharedObject = SharedObject.getLocal("Kaltura_CC_SO");
-									sharedObj.data.language = ccObj.language;
-									sharedObj.flush();
-								}
-								catch (e : Error)
-								{
-									sendNotification( NotificationType.ALERT, {message: "Application is unable to access your file system.", title: "Error saving localized settings"} );
-								}
-							}
+							saveToSO( ccObj.language );
 							
 							break;
 						}

	
	import org.osmf.events.LoadEvent;
	import org.osmf.events.MediaElementEvent;
	import org.osmf.traits.LoadTrait;
	import org.osmf.traits.MediaTraitType;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	import org.osmf.traits.LoadState;

	public class ClosedCaptionsMediator extends Mediator
	{

				case ClosedCaptionsNotifications.LOAD_EMBEDDED_CAPTIONS:
					onTextData(note.getBody());
					break;
			}
		}
		
		private function saveToSO(langKey:String):void {
			if (_flashvars.allowCookies=="true" && langKey )
			{
				try
				{
					var sharedObj : SharedObject = SharedObject.getLocal("Kaltura_CC_SO");
					sharedObj.data.language = langKey;
					sharedObj.flush();
				}
				catch (e : Error)
				{
					sendNotification( NotificationType.ALERT, {message: "Application is unable to access your file system.", title: "Error saving localized settings"} );
				}
			}
		}
		
