var playing_elem = 0;

$().ready(function(){	
	playVideo('');
});

function playVideo(video_url, auto_play){
	if (auto_play == undefined) {
		auto_play = true;
	}
	
	$('#PlayVideo').html("<div id='video1'></div>");
	var so = new SWFObject("http://www.gdd.ro/gdd/flvplayer/gddflvplayer.swf", "agdd_video_player", "500", "342", "8", "#62636B"); //change the player size as you want (now:500x360)
	so.addParam("scale", "noscale");
	so.addParam("quality", "best");
	so.addParam("allowScriptAccess", "always");
	so.addParam("allowFullScreen", 'true');
	
	//VIDEO PARAMS
	if (auto_play) { 
		so.addVariable("autoplay", 'true'); // autoplay: true or false | default: false
	}
	so.addVariable("sound", '80'); // sound volume 0-100
	so.addVariable("vdo", escape(video_url));
	so.write("PlayVideo"); // put the player inside div id=gddflvplayer
}

function playlistItemClick(video_url, elem, auto_play){
	playVideo(video_url, auto_play);
	$(elem).next("span").text(" - (((now playing )))");
	
	if ((playing_elem) && ($(elem).attr('id') != playing_elem.attr('id'))) {
		playing_elem.next("span").text("");
	}
	playing_elem = $(elem);
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

