﻿Type.registerNamespace("UG");
UG.SWF = function() { };
UG.SWF.prototype = {}

UG.SWF.renderGAM = function(containerName, fileName, width, height) 
{
	if (typeof containerName == 'undefined'
			|| typeof fileName == 'undefined'
			|| typeof width == 'undefined'
			|| typeof height == 'undefined' 
			|| typeof swfobject == 'undefined')
		return;

	var url = 'http://ads.unigo.com/cdn/advertisements/' + fileName;
	var params = { allowscriptaccess: 'always', allownetworking: 'all', allowfullscreen: 'true', wmode: 'transparent' };
	
	swfobject.embedSWF(url,containerName,width,height,'9.0.0',false,'',params);
}

UG.SWF.renderFlv = function(containerName, videoName, thumbnailName, width, height) 
{
	if (typeof containerName == 'undefined' || typeof videoName == 'undefined' || typeof swfobject == 'undefined')
		return;

	var url = 'http://swf.unigo.com/media/flashplayer/flowplayerdark.swf';
	var cdnUrl = 'http://swf.unigo.com/cdn/advertisements/';
	var flashVars = {
		streamingServer: 'fms'
		, videoFile: cdnUrl + videoName
		, splashImageFile: cdnUrl + thumbnailName
		, scaleSplash: false
		, bufferLength: 5
		, autoPlay: false
		, autoBuffering: true
		, controlBarBackgroundColor: '0x567890'
		, initialScale: 'scale'
		, showVolumeSlider: true
		, controlsOverVideo: 'ease'
		, controlBarGloss: 'high'
		, loop: false
	};
	var params = { allowscriptaccess: 'always', allownetworking: 'all', allowfullscreen: 'true', wmode: 'transparent' };

	swfobject.embedSWF(url, containerName, width, height, '9.0.0', false, flashVars, params);
}

UG.SWF.renderKalturaVideo = function(containerName, kalturaEntryId, width, height, configID) {
	if (typeof containerName == 'undefined'
			|| typeof kalturaEntryId == 'undefined'
			|| typeof width == 'undefined'
			|| typeof height == 'undefined'
			|| typeof swfobject == 'undefined')
		return;

	var url = 'http://www.kaltura.com/index.php/kwidget/wid/_29959/ui_conf_id/';

	var flashVars = { entryId: kalturaEntryId, emptyF: "onKdpReady", readyF: "onKdpReady"};
	var params = { allowscriptaccess: 'always', allownetworking: 'all', allowfullscreen: 'true', wmode: 'transparent', id: containerName, name: containerName };

	if (typeof configID != 'undefined')
		url = url + configID;
	else
		url = url + '1000839';

	swfobject.embedSWF(url, containerName, width, height, '9.0.0', false, flashVars, params);
}

UG.SWF.render = function(containerName, url, width, height, flashVars) {
	if (typeof containerName == 'undefined'
			|| typeof url == 'undefined'
			|| typeof width == 'undefined'
			|| typeof height == 'undefined')
		return;

	if (typeof flashVars == 'undefined')
		flashVars = '';

	var params = { allowscriptaccess: 'always', allownetworking: 'all', allowfullscreen: 'true', wmode: 'transparent' };

	swfobject.embedSWF(url, containerName, width, height, '9.0.0', false, flashVars, params);
}

UG.SWF.registerClass("UG.SWF", null);
Sys.Application.notifyScriptLoaded();

