function renderPlayer() 
{
	var player = GetPlayerType();
	var playerType = new PlayerType();
	if(player == playerType.WindowsMediaFirefox)
	{
		document.write('<OBJECT id=\"playerObj\" name=\"player\" type=\"application/x-ms-wmp\" width=\"320\" height=\"240\" >\n');
		document.write('<param name=\"URL\" value=\"\">\n');
		document.write('<param name=\"AutoStart\" value=\"False\">\n');
		document.write('<param name=\"TransparentAtStart\" value=\"0\">\n');
		document.write('<param name=\"ShowStatusBar\" value=\"0\">\n');
		document.write('<param name=\"ShowDisplay\" value=\"0\">\n');
		document.write('<param name=\"AutoSize value=\"0\">\n');
		document.write('<param name=\"UImode\" value=\"none\">\n');
		document.write('<param name=\"AnimationAtStart\" value=\"True\">\n');
		document.write('<param name=\"StretchToFit\" value=\"True\">\n');
		document.write('<param name=\"EnableContextMenu\" value=\"False\">\n');
		document.write('</OBJECT>\n');
		
		flashMode = true;
	}
	else if(player == playerType.WindowsMedia)
	{
		// Player
		document.write('<OBJECT id=\"playerObj\" name=\"player\" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" width=\"320\" height=\"240\">\n');
		document.write('<param name=\"FileName\" value=\"\">\n');
		document.write('<param name=\"AutoStart\" value=\"False\">\n');
		document.write('<param name=\"TransparentAtStart\" value=\"0\">\n');
		document.write('<param name=\"ShowStatusBar\" value=\"0\">\n');
		document.write('<param name=\"ShowDisplay\" value=\"0\">\n');
		document.write('<param name=\"AutoSize value=\"0\">\n');
		document.write('<param name=\"UImode\" value=\"none\">\n');
		document.write('<param name=\"AnimationAtStart\" value=\"True\">\n');
		document.write('<param name=\"StretchToFit\" value=\"False\">\n');
		document.write('<param name=\"EnableContextMenu\" value=\"False\">\n');
		document.write('</OBJECT>\n');
		
		flashMode = true;
	}
	else
	{
		PluginNotFound(windowsMediaUrl, flashUrl, pluginFirefoxUrl);
	}
}

function loadCookieData() {
	var cookieManager = new CookieManager('megaplayer_session', null, window.location.toString().match('^(http://)?([^/]+)')[2]);
	var contents;
	var defPl;
	
	defPl = cookieManager.getValue('defPl'); // Checks if the previous playlist was a "default" one

	// We must only reload "non-default" playlists	
	if(defPl!='true')
	{
		// Calls the method to add the contents from the cookie
		PerformCookieAdd(false);
	}
}

function updatePlaylistCount() {
	var obj;
	var plCount = plIg.count();
	
	obj = document.getElementById('playlistStatus');
	
	if(obj != null)
		obj.innerHTML = '<img src="image/iconMovie.gif" />' + plCount + ' vídeos na playlist';
}

function showHide(obj) { //v1.0
	var obj; 
	
	obj = document.getElementById(obj)

	if(obj != null)
		obj.style.display = (obj.style.display == 'none') ? '' : 'none';
}

function stopScroll() { 
	if (timer_id) clearTimeout(timer_id); 
}

// script to scroll iframe
var timer_id;
function scroll_iframe(frm,inc,dir) {
	if (timer_id) clearTimeout(timer_id);
	if (window.frames[frm]) {
    	if (dir == "v") window.frames[frm].scrollBy(0, inc);
    	else window.frames[frm].scrollBy(inc, 0);
    	timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
	}
}

function showHidePlayer(img, img1, img2, obj) { //v1.0
	obj = document.getElementById(obj);

	if(obj != null) { 
		img = document.getElementById(img);
		
		if(obj.style.display == 'none') {
			obj.style.display = '';
			img.src = img1;
		}
		else {
			obj.style.display = 'none';
			img.src = img2;
		}
	}
}