var player_obj='';

function showOtherCP_G(track_id) {
	var message='<div id="no_result" style="padding-top:5px;padding-bottom:5px;color:#656565;text-align:center;"><strong> Sign in above in order to vote for a track.</strong></div>';
	var resp=SearchManagerView.getInstance().showLoginConfirm(_e('fixTrackLink'),message);
	if (resp) return false;
	player_obj=	"	<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:/fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" name=\"playingNowVideoVote\" width=\"329\" height=\"280\" align=\"middle\" id=\"playingNowVideoVote\" >" + 
  		"			  <param name=\"AllowScriptAccess\" value=\"always\" />" + 
  		"			  <param name=\"allowFullScreen\" value=\"true\" />" + 
  		"			  <param name=\"movie\" value=\""+Config.playerURL+"ultimate_player.swf?serviceUrl="+encodeURIComponent('http://www.qloud.com/api_dev/index.php?pn=track_sources')+"&config_url="+Config.playerURLENC+"config_qloud_330.xml&jsListObject=playingNowVideoVote&givepoints_URL={GIVE_POINTS_URL}\" />" + 
  		"			  <param name=\"quality\" value=\"high\" />" + 
  		"			  <param name=\"bgcolor\" value=\"#FFFFFF\" />" + 
  		"			  <param name=\"wmode\" value=\"transparent\" />" + 
  		"			  <embed src=\""+Config.playerURL+"ultimate_player.swf?serviceUrl="+encodeURIComponent('http://www.qloud.com/api_dev/index.php?pn=track_sources')+"&config_url="+Config.playerURLENC+"config_qloud_330.xml&jsListObject=playingNowVideoVote&givepoints_URL={GIVE_POINTS_URL}\" width=\"329\" height=\"280\" align=\"middle\" quality=\"high\" bgcolor=\"#FFFFFF\" type=\"application/x-shockwave-flash\" pluginspage=\"http:/www.macromedia.com/go/getflashplayer\" swliveconnect=\"true\" wmode=\"transparent\" name=\"playingNowVideoVote\" id=\"playingNowVideoVote_embed\"  AllowScriptAccess=\"always\" allowFullScreen=\"true\"/>" + 
  		"			</object>" ;
  	var windowContent = "<div class=\"content\">" + 
  		"	<div style=\"position:relative;top:-5px;right:0px;bottom:-10px;z-index:4000;font-size:8pt;text-align:right;\"><a style=\"color:#42598E;text-decoration:none;\" href=\"javascript:void(0);\" onclick=\"closeVoteOtherPopup();return false;\">Close</a></div>" + 
  		"		<div class=\"playing_now_main\" id=\"vote_playing_now_main\" style=\"height:377px;border:0px;z-index:3500;\">" + 
  		"		  <div class=\"dlg_bg\" id=\"deleteRecordingDialog\">" + 
  		"			<div class=\"content\">" + 
  		"				<div style=\"display:block; position: relative; padding:5px;padding-top:0;\">" + 
  		"					<font style=\"font-size:11px; color:#111111;\">This will notify a Qloud admin of the bad recording and it will be removed accordingly.</font>" + 
  		"					<div style=\"height: 3px;\"></div>" + 
  		"					<font class=\"filesize\" style=\"color:#4D4D4D\"><strong>Note:</strong> if your reason for removal does not match one of the following, please do not continue with this process.</font>" + 
  		"					<div style=\"height: 3px;\"></div>" + 
  		"					<div style=\"margin-left:5px;\">" + 
  		"					      <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"main_table main_table_popup\" style=\"color:#111111;\">" + 
  		"				  <tr>" + 
  		"				    <td valign=\"middle\"><input style=\"margin:0px 5px;height:16px;\" id=\"mym_dead_link\" name=\"type\" type=\"radio\" value=\"dead_link\" checked=\"checked\" /></td>" + 
  		"				    <td valign=\"middle\">Videos does not play (dead link)</td>" + 
  		"				  </tr>" + 
  		"				  <tr>" + 
  		"				    <td valign=\"middle\"><input style=\"margin:0px 5px;height:16px;\" id=\"mym_amateur\" name=\"type\" type=\"radio\" value=\"amateur\" /></td>" + 
  		"				    <td valign=\"middle\">Not the correct artist (amateur performers)</td>" + 
  		"				  </tr>" + 
  		"				  <tr>" + 
  		"				    <td valign=\"middle\"><input style=\"margin:0px 5px;height:16px;\" id=\"mym_image\" name=\"type\" type=\"radio\" value=\"image\" /></td>" + 
  		"				    <td valign=\"middle\">No video (just an image)</td>" + 
  		"				  </tr>" + 
  		"				</table>" + 
  		"					</div>" + 
  		"					<div style=\"height: 23px; margin-top: 6px; padding-left: 29px;\">" + 
  		"						<input type=\"hidden\" id=\"selectedRecordingForDelete\" value=\"0\"><a  href='javascript:void(0)' onclick='SearchManagerView.getInstance().sendDeleteRecordingMessage(); return false;' style='color:#ffffff;margin:0;padding:0;'><img border=0 src='{APP_CALLBACK_URL}images/library/popup_send_button.gif' /></a>&nbsp;<a href='javascript:void(0)' onclick='SearchManagerView.getInstance().hideDeleteRecordingDialog(); return false;' style='color:#ffffff;margin:0;padding:0;margin-left:10px;'><img border=0 src='{APP_CALLBACK_URL}images/library/popup_close_button.gif' /></a>" + 
  		"					</div>" + 
  		"				</div>" + 
  		"			</div>" + 
  		"		  </div>" + 
  		"		  <div class=\"clearfix_ie\" style=\"clear:both\"></div>" + 
  		"		  <div style=\"position:relative\">" + 
  		"		    <div class=\"player_container\">" + 
  		"		      <div class=\"swf_cont\" id=\"vote_player\">" +player_obj+
  	
  		"		      </div>" + 
  		"		      <div class=\"track_info\" style=\"top: 290px; left: 0px; width: 331px;\">		" + 
  		"				<div class=\"img_container\"><img src=\"\" id='album_image_voted' height='50' width='50' border=\"none\"/></div>" + 
  		"				<div style=\"float:left; width:250px;\">		" + 
  		"					<div style=\"float:left\">" + 
  		"					<div id=\"track_name_voted\"></div>" + 
  		"						<div style=\"float:left\">by <a id=\"artist_name_voted\" href=\"\"></a></div>" + 
  		"						<div style=\"clear:both;padding-top:3px;height:18px;font-size:11px; overflow: hidden; line-height: 18px;text-align:left;\">from the album <a id=\"album_name_voted\" href=\"\" ></a></div>" + 
  		"					</div>" + 
  		"					<div style=\"float:right; padding-top: 5px;width:35px;\">" + 
  		"						<a id=\"crtBuyButton_voted\" target=\"_blank\" href='#' style=\"color:#42598E;text-decoration:none;position:absolute;right:10px;\" title=\"Buy\"><img src='{APP_CALLBACK_URL}images/library/action_buy.gif' alt='Buy'  border=\"none\" /> Buy</a>" + 
  		"					</div>			" + 
  		"				</div>" + 
  		"				<div class=\"clearfix_ie\" style=\"clear:both\"></div>		" + 
  		"			</div>" + 
  		"		    </div>" + 
  		"		    <div class=\"popular_songs_container\" style=\"height:358px;top:4px;width:330px;\">" + 
  		"		      <div class=\"title\" style=\"border-top:0px;\">Other Available recordings<br />" + 
  		"		 			<span style=\"font-weight:normal;\">Please choose the best recording for this song</span>" +
  		"				</div>" + 
  		"			  	<div style=\"padding-left:6px;margin-bottom:0pxpadding:0px;\"> " + 
  		"					<div class=\"box_row clearfix\" style=\"padding:5px 5px 0px 5px;\">" + 
  		"						<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"mytable\" >" + 
  		"							<tr>" + 
  		"								<td width=\"20\" valign=\"top\">" + 
  		"									<img src=\"{APP_CALLBACK_URL}images/library/play_button2.gif\" border=\"0\" />" + 
  		"								</td>" + 
  		"								<td valign=\"top\">" + 
  		"									<font class=\"filesize\">Click the \"Play\" button to sample the recording.</font>" + 
  		"								</td>				" + 
  		"							</tr>" + 
  		"							<tr>" + 
  		"								<td width=\"20\" valign=\"top\">" + 
  		"									<img src=\"{APP_CALLBACK_URL}images/library/thumbs_up_on.gif\" border=\"0\" />" + 
  		"								</td>" + 
  		"								<td valign=\"top\">" + 
  		"									<font class=\"filesize\">Click the \"Thumbs up\" to vote for the best.</font>" + 
  		"								</td>				" + 
  		"							</tr>" + 
  		"							<tr>" + 
  		"								<td width=\"20\" valign=\"top\">" + 
  		"									<img src=\"{APP_CALLBACK_URL}images/library/delete.gif\" border=\"0\" align=\"absmiddle\" style=\"padding-left:1px;padding-top: 3px;\"/>" + 
  		"								</td>" + 
  		"								<td valign=\"top\">" + 
  		"									<font class=\"filesize\">Click the \"Remove\" button if the recording<br />is wrong or doesn&rsquo;t play.</font>" + 
  		"								</td>				" + 
  		"							</tr>" + 
  		"						</table>			" + 
  		"					</div>" + 
  		"		     <div id=\"voted_songs_container\" class=\"voted_other_songs_container\"></div>" + 
  		"			    	<div class=\"clearfix\" style=\"line-height:15px; margin-left:5px; margin-bottom:8px; padding:0px 0px 0px 5px; font-size:9pt;\">" + 
  		"						<strong>Can&rsquo;t find your favorite song version listed?</strong><br />" + 
  		"						Submit the URL link to share with others:" + 
  		"						<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"mytable\" style=\"margin-left:-5px;\">" + 
  		"							<tr>" + 
  		"								<td valign=\"middle\"><input type=\"text\" class=\"inputtext\" name=\"the_url\" style=\"width:200px;\" id=\"saveFavoriteURL\"/></td>" + 
  		"								<td valign=\"middle\"><input type=\"hidden\" name=\"palyingFavTrackId\" id=\"palyingFavTrackId\" value=\""+track_id+"\"/><input type=\"image\" name=\"Submit\" src=\"{APP_CALLBACK_URL}images/library/submit.gif\" alt=\"Submit\" align=\"absmiddle\" onclick=\"SearchManagerView.getInstance().saveFavoriteURL(this); return false;\"/></td>" + 
  		"							</tr>" + 
  		"						</table>" + 
  		"				   </div>" + 
  		"		    </div>" + 
  		"		    </div>" + 
  		"		  </div>" + 
  		"		</div>" + 
  		"</div>";

  	var xCnt = document.getElementById('orContainerCnt');
  	
  	xCnt.innerHTML = windowContent;
  	OtherRecTrackData(track_id)
	SearchManagerView.getInstance().voteDifferentVersionPopup(track_id);
	if(_e('contextPlayerContainer'))
	{
		closeContextPlayer();
	}
	SearchManagerView.getInstance().pausePlayer();
  	document.getElementById('overlay').style.height = '100%';
		document.getElementById('overlay').style.display = '';
		trace(xCnt);
		return false;
	if(e('vote_player')){		
		_e('vote_player').innerHTML=player_obj;
	}	
	
	}
function OtherRecTrackData(trackId) {
   try {
    var url = Config.baseURL + "index.php?action=getContextPlayerData&track_id="+trackId +"&use_format=json&module=main";
             var rqid=RequestManager.getInstance().createRequest(new OtherRecTrackData_handler(),url);
    		RequestManager.getInstance().startRequest(rqid);
        
   } catch (e) {
      
   } 
}

function OtherRecTrackData_handler(response) {
 this.handleResponse = function (managerIndex){
    var response = eval('('+RequestManager.getInstance().getRequestObj (managerIndex).xmlRequestObject['responseText']+')');
    getOtherRecTrackDataResponse(response);
 }    
} 

function getOtherRecTrackDataResponse (response){
     //create container   
   // createContextPlayer(playingTrackId,response.content.gp_URL);
 
    var data = response;
    var track_data=data.content['track_data'];
    tempData=data.content['track_data'];
    SearchManagerView.getInstance().tempTrackData=data.track_data;
   
  	_e('crtBuyButton_voted').href=data.content.buylink;
  	_e('album_image_voted').src= data.content['track_data']['artist_image'];
  	_e('track_name_voted').innerHTML= data.content['track_data']['track'];
  	_e('artist_name_voted').href= Config.baseURL + data.content['embeds']['artist'];
  	_e('album_name_voted').href= Config.baseURL + data.content['embeds']['album'];
  	_e('artist_name_voted').innerHTML= data.content['track_data']['artist'];
  	_e('album_name_voted').innerHTML= data.content['track_data']['album'];  	
}

this.closeVoteOtherPopup = function(mainHide) {
	SearchManagerView.getInstance().pausePlayerVote();
	_e('overlay').style.display='none';
	if (typeof mainHide == 'undefined') var mainHide = false;
	if (mainHide) { _e('vote_playing_now_main').style.display = 'none'; }
	return false;
}
