/* Your configuration */
var player_key = '06277cbaa836'; 
var epix_skin_key = '605206766d70'; // Standard player only (also called Epix)

//var player_key = '306eedd58f91'; 
//var epix_skin_key = '3100de66c689'; // Standard player only (also called Epix)

var language_code = 'fr';

var player_bgcolor = '000000';
var picto_color = 'FFFFFF';
var border_color = 'FFFFFF';
var btn_color = '000000';
var cbar_color = '000000';

var player_width = '588';
var player_height = '370';
var channel_menu_width = '588';
var channel_menu_height = '100';
//var channel_menu_width = '1';
//var channel_menu_height = '1';

var player_type = 'epix';
/* End of your configuration */


/*******************/
/* **DO NOT EDIT** */
/*******************/


/*
	Called on each video
 */
function setTitle(title)
{
	document.getElementById('kewegowebtv_title').innerHTML = title;
}

/*
	Called on each video
 */
function setDescription(description)
{
	document.getElementById('kewegowebtv_description').innerHTML = description;
}

/*
	Called on manual video change
 */
function setPlayer(sig, sig_next)
{
	//alert("setPlayer()");
	player(sig, sig_next);
	setVideoKad(sig);
	//recupCurrentSig(sig);
}

function setVideoKad(sig)
{
  //alert("?csig="+current_csig+"&sig="+sig);
  document.getElementById('iframe_kad').src = "./setkad.php?sig="+sig;
}

/*
	Generic function to display a flash using <object>
 */
function flash(container_id, swf_url, width, height, flash_vars, bgcolor, wmode)
{
	var embed_code = '<object id="flash_' + container_id + '" type="application/x-shockwave-flash" data="' + swf_url + '" width="' + width + '" height="' + height + '" bgcolor="' + bgcolor + '" >' +
	'<param name="flashVars" value="' + flash_vars + '&width=' + width + '&height=' + height + '" />' +
	'<param name="movie" value="' + swf_url + '" />' +
	'<param name="allowFullScreen" value="true" />' +
	'<param name="allowscriptaccess" value="always" />' + 
	'<param name="wmode" value="' + wmode + '" />' +
	'<param name="swliveconnect" value="true" />' +
	'</object>';

	/*
		container_id receive the embed code
	 */

	document.getElementById(container_id).innerHTML = embed_code;
}

/*
	Developers doc : http://developers.kewego.com/kb/?View=entry&EntryID=120
 */
function player(sig, sig_next)
{	
	if (player_type == 'fp')
	{
		/* player url */
		var player_url = 'http://sa.kewego.com/swf/fp.swf';
		var flash_vars = 'sig=' + sig + '&sig_next=' + sig_next + '&playerkey=' + player_key + '&language_code=' + language_code + '&redirect=false&suffix=';

		/*
		Decorations
		 */
		flash_vars += '&picto=' + picto_color + '&border=' + border_color + '&btn=' + btn_color + '&cbar=' + cbar_color;
	}
	else
	{
		/* player url */
		var player_url = 'http://sa.kewego.com/swf/p3/epix.swf';		
		var flash_vars = 'sig=' + sig + '&sig_next=' + sig_next + '&playerKey=' + player_key + '&skinKey=' + epix_skin_key + '&language_code=' + language_code + '&redirect=false&suffix=&is_playlist=false';
	}

	 /*
		Display or replace existing player
	 */

	flash('kewegowebtv_player' /* container_id */, player_url /* swf_url*/, player_width /* width */, player_height /* height */, flash_vars, player_bgcolor, 'window');
}

function channel_menu(csig, sig)
{		
	/* Channel menu url */
	var channel_menu_url = 'http://sa.kewego.com/swf/channelmenu.swf';

	/*
		Display or replace existing channel menu
	 */

	var flash_vars = 'csig=' + csig + '&sig=' + sig + '&playerkey=' + player_key + '&language_code=' + language_code + '&suffix=&senduserprofileinfo=false';

	/*
		Decorations
	 */
	flash_vars += '&picto=' + picto_color + '&border=' + border_color + '&btn=' + btn_color + '&cbar=333333';


	flash('kewegowebtv_channel_menu' /* container_id */, channel_menu_url /* swf_url*/, channel_menu_width /* width */, channel_menu_height /* height */, flash_vars, '', 'transparent');
	setPlayer(sig, '');
}

/*
	Start
 */
function start(csig, sig)
{
	/*
		Remove existing player
	 */
	document.getElementById('kewegowebtv_player').innerHTML = '';

	channel_menu(csig, sig);
}
	
