/**
 * This file is part of VAFPodcasts @ Virtual Assistant Forums
 * Sig: CHTSNPD
**/

var vafvideo_player		= 'http://www.virtualassistantforums.com/vafvideo/player';

function show_video(_video, autostart) {
	var video = '';
	for (var i = 0; i < _video.length; i++)
		video += _video.charAt(i) != ' ' ? _video.charAt(i) : '';
	// logo:		 				vafvideo_images_url + '/wm.png',
	var flashvars = {
		width: 					"400",
	   height: 					"320",
	   file:		 				vafvideo_video_url + '/' + video + '.flv',   
	   image:	 				vafvideo_snaps_url + '/' + video + '_large.jpg?' + new Date().getTime(),
	   search_bar:  			'false',
	   thumbsinplaylist:  	'true',
		autostart:				autostart != '' ? true : false
	};
	var params = {};
	var attributes = {
		allowscriptaccess: 	"always",
		allowfullscreen: 		"true" 
	};
	swfobject.embedSWF(vafvideo_player + "/player.swf", "video-player-" + _video, "400", "320", "9.0.0", "", flashvars, params, attributes);
}

$(document).ready(function() {
	$('div.vafpodcast').each(function() {
		var the_id = random_str();
		$(this).attr('id', the_id);
		_video = $(this).html();
		$(this).html('');
		var video = '';
		for (var i = 0; i < _video.length; i++)
			video += _video.charAt(i) != ' ' ? _video.charAt(i) : '';
		// logo:		 				vafvideo_images_url + '/wm.png',
		var flashvars = {
			width: 					"300",
			height: 					"20",
			file:		 				video,
			search_bar:  			'false',
			thumbsinplaylist:  	'true'
		};
		var params = {};
		var attributes = {
			allowscriptaccess: 	"always",
			allowfullscreen: 		"true" 
		};
		swfobject.embedSWF(vafvideo_player + "/player.swf", the_id, "300", "20", "9.0.0", "", flashvars, params, attributes);
	});
});

function random_str()
{
   chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   pass = "";

   for(x=0;x<20;x++)
   {
      i = Math.floor(Math.random() * 62);
      pass += chars.charAt(i);
   }
   return pass;
}