function gen_videoToolbox()
{ }

gen_videoToolbox.prototype.var_requestURI = null;
gen_videoToolbox.prototype.nod_workspace = null;
gen_videoToolbox.prototype.nod_workspaceContent = null;
gen_videoToolbox.prototype.obj_player = null;
gen_videoToolbox.prototype.obj_playerData = null;

gen_videoToolbox.prototype.fnc_init = function (obj_player)
{
	try {
		this.obj_player = obj_player;
	}
	catch(e)
	{
		alert(e)
	}
}
	
gen_videoToolbox.prototype.fnc_itemMonitor = function(obj_playerData)
{
	this.obj_playerData = obj_playerData;
	// alert('Now Playing: ' + player.getPlaylist()[this.obj_playerData.index].file);
	fnc_loadSimilar(this.obj_player.getPlaylist()[this.obj_playerData.index].file)
};
	
gen_videoToolbox.prototype.fnc_loadSimilar = function(obj_playerData) {
	try{
		this.obj_playerData = obj_playerData;
		
		//alert('Get similar items to\n'+this.obj_player.getPlaylist()[this.obj_playerData.index].file);
		
		var tthis = this;
		
		try {
			var file = tthis.obj_player.getPlaylist()[tthis.obj_playerData.index].file
		}catch(e){};
		
		$.ajax({
			url: tthis.var_requestURI + file,
			type: "GET",
			dataType: 'xml',
			success: function(data) {
				try{
				  if (tthis.nod_workspaceContent)
				  {
					  while (tthis.nod_workspaceContent.firstChild) {
						 tthis.nod_workspaceContent.removeChild(tthis.nod_workspaceContent.firstChild);
					  }
				  }
				  
				  var tmpResponse = data;
				  if (!tmpResponse.documentElement && xmlhttp.responseStream) {
					  tmpResponse.load(xmlhttp.responseStream);
				  }else{
					  tmpResponse.documentElement;
				  }
				  
				  var items = tmpResponse.getElementsByTagName("item");
				  if(items.length){
					  for(var i=0; i<items.length; i++){
						  try
						  {
							  var tmpVideo = document.createElement('a');
							  var tmpTitle = '';
							  var tmpLink = '';
							  
							  if(items[i].getElementsByTagName('link')[0].firstChild){
								  tmpLink = items[i].getElementsByTagName('link')[0].firstChild.nodeValue;
							  }
							  tmpVideo.setAttribute('href', tmpLink)
							  
							  if(items[i].getElementsByTagName('title')[0].firstChild){
								  tmpTitle = items[i].getElementsByTagName('title')[0].firstChild.nodeValue;
							  }
							  tmpVideo.setAttribute('title', tmpTitle + '<br/><strong>' + items[i].getElementsByTagName('duration')[0].firstChild.nodeValue + '</strong><br/>' + items[i].getElementsByTagName('pubDate')[0].firstChild.nodeValue)
							  tmpVideo.setAttribute('class', "tooltip_popup")
							  
							  tmpVideo.style.cssFloat="left"
							  
							  var tmpVideoImg = document.createElement('img');
							  
							  if(document.getElementsByTagNameNS){
								  tmpVideoImg.setAttribute('src', items[i].getElementsByTagNameNS('*','thumbnail')[0].getAttribute('url'))
							  }else{
								  tmpVideoImg.setAttribute('src', items[i].getElementsByTagName('media:thumbnail')[0].getAttribute('url'))
							  }
							  
							  tmpVideo.appendChild(tmpVideoImg);
							  
							  var tmpVideoName = document.createElement('p');
							  
							  var max=15;
							  
							  if(tmpTitle.length>max){
								  tmpTitle = tmpTitle.slice(0,max) + '...'
							  }
							  
							  tmpVideoName.appendChild(document.createTextNode(tmpTitle));
							  
							  tmpVideo.appendChild(tmpVideoName);
							  
							  tthis.nod_workspaceContent.appendChild(tmpVideo)
						  }catch(e){
							  cyclone3.log(e)
						  }
					  }
					  tthis.nod_workspace.style.display="block";
				  }
				  
				  //$(".tooltip_popup").each( function(input) {
				  //  new Tooltip(input, {mouseFollow: false, backgroundColor: "#000", borderColor: "#000", textColor: "#fff", appearDuration:.1, hideDuration:.1});
				  //});
				  $(".tooltip_popup").simpletip(
						{
							//content: $(".day_2010-12-19 .day_events").html(),
							content: $(this).attr('title'),
							position:'left'
						}
					);
				  
				}
				catch(e)
				{
				  cyclone3.log(e);
				}
			}
		});
	}
	catch(e)
	{
		alert(e)
	}
};

/*
gen_videoToolbox.prototype.fnc_loadSimilar = function(obj_playerData) {
	try{
		this.obj_playerData = obj_playerData;
		
		//alert('Get similar items to\n'+this.obj_player.getPlaylist()[this.obj_playerData.index].file);
		
		var tthis = this;
		
		try {
			var file = tthis.obj_player.getPlaylist()[tthis.obj_playerData.index].file
		}catch(e){};
		
		new Ajax.Request(
			tthis.var_requestURI + file,
			{
			  method: 'get',
			  onSuccess: function(transport){
				 try{
					//var response = transport.responseText || "no response text";
					//alert("Success! \n\n" + transport.responseXML);
					
					if (tthis.nod_workspaceContent)
					{
						while (tthis.nod_workspaceContent.firstChild) {
						  tthis.nod_workspaceContent.removeChild(tthis.nod_workspaceContent.firstChild);
						}
					}
					
					var tmpResponse = transport.responseXML;
					if (!tmpResponse.documentElement && xmlhttp.responseStream) {
						tmpResponse.load(xmlhttp.responseStream);
					}else{
						tmpResponse.documentElement;
					}
					
					var items = tmpResponse.getElementsByTagName("item");
					if(items.length){
						for(var i=0; i<items.length; i++){
							try
							{
								var tmpVideo = document.createElement('a');
								var tmpTitle = '';
								var tmpLink = '';
								
								if(items[i].getElementsByTagName('link')[0].firstChild){
									tmpLink = items[i].getElementsByTagName('link')[0].firstChild.nodeValue;
								}
								tmpVideo.setAttribute('href', tmpLink)
								
								if(items[i].getElementsByTagName('title')[0].firstChild){
									tmpTitle = items[i].getElementsByTagName('title')[0].firstChild.nodeValue;
								}
								tmpVideo.setAttribute('title', tmpTitle + '<br/><strong>' + items[i].getElementsByTagName('duration')[0].firstChild.nodeValue + '</strong><br/>' + items[i].getElementsByTagName('pubDate')[0].firstChild.nodeValue)
								tmpVideo.setAttribute('class', "tooltip_popup")
								
								tmpVideo.style.cssFloat="left"
								
								var tmpVideoImg = document.createElement('img');
								
								if(document.getElementsByTagNameNS){
									tmpVideoImg.setAttribute('src', items[i].getElementsByTagNameNS('*','thumbnail')[0].getAttribute('url'))
								}else{
									tmpVideoImg.setAttribute('src', items[i].getElementsByTagName('media:thumbnail')[0].getAttribute('url'))
								}
								
								tmpVideo.appendChild(tmpVideoImg);
								
								var tmpVideoName = document.createElement('p');
								
								var max=15;
								
								if(tmpTitle.length>max){
									tmpTitle = tmpTitle.slice(0,max) + '...'
								}
								
								tmpVideoName.appendChild(document.createTextNode(tmpTitle));
								
								tmpVideo.appendChild(tmpVideoName);
								
								tthis.nod_workspaceContent.appendChild(tmpVideo)
							}catch(e){
								alert(e)
							}
						}
						tthis.nod_workspace.style.display="block";
					}
					
					$$(".tooltip_popup").each( function(input) {
						new Tooltip(input, {mouseFollow: false, backgroundColor: "#000", borderColor: "#000", textColor: "#fff", appearDuration:.1, hideDuration:.1});
					});
					
				 }
				 catch(e)
				 {
					alert(e);
				 }
			  },
			  onFailure: function(){
				// alert('Something went wrong...')
			  }
			}
		);
	}
	catch(e)
	{
		alert(e)
	}
};
*/
