<?php
error_reporting(0);
$xtem1=str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
$xtem2=str_replace("\\","/",dirname(__FILE__));
$xtem=str_replace($xtem1,"",$xtem2);

include dirname(__FILE__)."/config/config.php";



 $_GET[$full_list['ssvar']]=str_replace("&amp;","&",$_GET[$full_list['ssvar']]);
$_GET[$full_list['ssvar']]=str_replace("amp;","&",$_GET[$full_list['ssvar']]);


if(!intval($_GET[p])) $p=0; else $p=intval($_GET[p]);
 $ps=$p-2;
$query = isset($_GET[$full_list['ssvar']]) ? $query = urldecode($_GET[$full_list['ssvar']]) : '';
$query = iconv(get_encoding($query), 'utf-8', $query);
$_GET[$full_list['ssvar']]=$query;

delete_temp_f(dirname(__FILE__)."/cache/",$full_list[sshh],$full_list[ssmm],$full_list[ssss]);

if(strlen($_GET[abc])>0 AND strlen($query)==0){
$abc=iconv('windows-1251','utf-8',urldecode($_GET[abc]));
$abc=iconv('utf-8','windows-1251',urldecode($_GET[abc]));
$scdir=get_dir(urldecode($_GET[abc]),$p);
$stl_co=10;
$laga=$p*$stl_co;
echo "<div class='aabcl'><h1 class='player_block-title'>Исполнители на букву ".iconv('utf-8','windows-1251',urldecode($_GET[abc]))."</h1><div class='aabcl'><ul class='listalka'><center>";
echo "</center></ul></div></div>";
echo "";
echo "<div class='aidubal2'><ul class='xplayerabc' >";

if($scdir[count]>0){$scdir[item]=explode("\n",$scdir[item]); foreach($scdir[item] as $key=>$val){
	$qq=explode("{red}",$val); $qq[0]=trim($qq[0]);
$qq[0]=iconv('utf-8','windows-1251',$qq[0]);
  
          echo "<div style='float:left;width:357px'><li style='border-bottom:1px solid #D0D0D0;'><a href='$xtem/".$full_list['ssvar']."/".urlencode(str_replace($art,"",$qq[0]))."/0/' onClick='newmp3(this)'><b>".$qq[0]."</b></a></li></div>";
         
}}
echo "<ul></div>";
echo "<div class='aabcl'><ul class='listalka'><center>";
echo "</center></ul></div>
";

echo <<<RT
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}

if(strlen($_GET[top])>0 AND strlen($query)==0){

delete_temp_f(dirname(__FILE__)."/cacheg/",$full_list[0],$full_list[0],$full_list[1]);
$sig_vk = get_sigd($akk_on,$skoka_vivg);
{
$xml_responsed=cache_xxd($query,$p,$akk_on,$sig_vk,$skoka_vivg); 
if(empty($xml_responsed)){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sigd($akk_on,$skoka_vivg);
	$xml_responsed=get_xml_responsed($akk_on,$sig_vk,$skoka_vivg);
}
if(!empty($xml_responsed)){
	$parse = @simplexml_load_string(trim(ltrim($xml_responsed)));
if(isset($parse[error_msg])){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sig($akk_on,$skoka_vivg);
	$xml_responsed=get_xml_responsed($akk_on,$sig_vk,$skoka_vivg);
	$parse = @simplexml_load_string(trim(ltrim($xml_responsed)));
}
if(isset($parse[error_msg]))  echo "Ошибка подписи!";
else {

if(($parse->audio AND $parse->count>0) OR ($parse->item>0))
{
if($parse->item>0){
	$parse->count=$parse->item;
	for($i=0;$i<count($parse->aid);$i++){
		$parse->audio[$i]->title=$parse->title[$i];
		$parse->audio[$i]->aid=$parse->aid[$i];
		$parse->audio[$i]->owner_id=$parse->owner_id[$i];
		$parse->audio[$i]->artist=$parse->artist[$i];
		$parse->audio[$i]->duration=$parse->duration[$i];
		$parse->audio[$i]->url=$parse->url[$i];
	}
	
}

if($parse->count>0) echo "<h1 class='player_block-title'>ТОП 50 самых популярных на Bitmuz.com</h1>
<ul class='xplayer' id='playlist'>   
            


\n";
$jjs=''; $mzt=1;
foreach($parse->audio as $key => $val)
{
$nnm=date('i:s', (int)$val->duration);


$val->artist=clean_text($val->artist);
$val->title=clean_text($val->title);


$val->artist = iconv(get_encoding($val->artist), $full_list[sscharset],$val->artist);
$val->title= iconv(get_encoding($val->title),  $full_list[sscharset],$val->title); 
	
	$val->title = preg_replace("/club[0-9]{2,15}/i","",$val->title);
	$val->artist = preg_replace("/club[0-9]{2,15}/i","",$val->artist);

$tname=totranslit($val->artist.'-'.$val->title);
$tname=preg_replace("~([^a-z0-9_-]+)~ui","",$tname);
$tname=str_replace(array(',','\'','\"','&'),"",$tname);

$mysi="";
$md5_arg=$val->aid . $val->owner_id . $tname;//это та информация, по которой мы будем получать нужные значения для конкретной песни в ajax-запросе
$val_url=$val->url;//это та информация, по которой мы будем получать нужные значения для конкретной песни в ajax-запросе



$serv=get_servers();
$idhash=md5($val->aid."*".$val->owner_id.'_'.rand(500,2550));

if($full_list[ssoneurl]=="true") $li1="http://".$serv."/saudio/".$hashss."/".$val->aid."/".$tname."(".$serv.").mp3";
else $li1="http://".$serv."/audios/".$val->aid."/".$val->owner_id."/".$tname."(".$serv.").mp3";
echo <<<GPP

<li  class="track" background-color: #4B95E5; >

			<div class="xplayer-btn">
				<table cellspacing=0 cellpadding=0 ><tr><td align=middle valign=middle>

</div>
</td>

</tr></table>
			</div>
			<div  class="dd" style="float:left; width:25px; cursor:pointer; " onclick="gopl(this)" id="plid_{$idhash}">
	<noindex><span class="ui-icon ui-icon-play"  id="ui-icon-play"><img src="/images/play.png"  title="Играть"></span></noindex>
	<noindex><span class="ui-icon ui-icon-pause" id="ui-icon-pause" style="display:none; "><img src="/images/playlist.png"  title="Пауза"></span></noindex>
	<noindex><span style="display:none;" id="norber">http://{$serv}/audios/{$val->aid}/{$val->owner_id}/play.mp3</span></noindex>
	<noindex><span style="display:none;" id="xftitle">{$val->artist} - {$val->title}</span></noindex>
</div>

<div class="dd" style="width:25px;float:left; ">
	<noindex><div  id="addmp3_{$idhash}">
	<img src="/images/add.png" border="0" id="is_add1" title="Добавить в плейлист" style="cursor:pointer;"\>
	<img src="/images/addok.png"  title="Добалено" id="is_add2" style="display:none; cursor:default;">
	<span style="display:none" id="aid">{$val->aid}</span>
	<span style="display:none" id="oid">{$val->owner_id}</span>
	<span style="display:none" id="autor">{$val->artist}</span>
	<span style="display:none" id="title">{$val->title}</span>
	<span style="display:none" id="time">{$val->duration}</span></div></noindex>
	</div>

	<div class="dd" style="width:25px; float:left; padding: 0px 7px 0px 0px;">
	<noindex><a href="{$li1}" style="text-decoration:underline; font-size:13px;"><img src="/images/download.png"  title="Скачать"></a></noindex>
	</div>
			<h2 class="xplayer-title"><a href="javascript:return false;" onclick="$('#aplayer_{$mzt}_z').slideToggle('slow');" id="aplayer_{$mzt}" {$istxt}><b>{$val->artist}</b> - {$val->title} </a></h2>
			
			<em>&nbsp;{$nnm} </em>
		<ems><span class="size" rel="{$md5_arg}" rel2="{$val_url}" style="cursor:pointer;"><br><img src="/images/mb.png"  title="Узнать размер и битрейт">&nbsp;&nbsp;</span></ems>


</li>





GPP;



	
if($count_comm > 0){
	

$ssaq=htmlspecialchars($val->artist." - ".$val->title);
echo <<<EE

EE;

}
 else {
	
}

$jjs.='';
$mzt++;
} 
echo <<<GPP

</ul>

GPP;



} else echo "<br><br><center>Ошибка запроса!</center><br><br>";

}
} else echo "<br><br><center>Ошибка запроса!</center><br><br>";

} 
echo "";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[maximum])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Радио Maximum</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/maximum.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[russkoe])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Русское радио</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/russkoe.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[dfm])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Радио DFM</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/dfm.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[nashe])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Наше Радио</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/nashe.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[shanson])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Радио Шансон</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/shanson.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}
if(strlen($_GET[europa])>0 AND strlen($query)==0){

echo "<h1 class='player_block-title'>ТОП 20 Europa Plus</h1>
<ul class='xplayer' id='playlist'>";
include dirname(__FILE__)."/europa.php";
echo "</ul>";
echo <<<RT
<script>
jQuery(document).ready(function(){

$("div[id^=addmp3_]").click(function() {
		var iz=$(this).attr('id');
	var vaid=$(this).find("#aid").text();
	var oid=$(this).find("#oid").text();
	var title=$(this).find("#title").text();
	var autor=$(this).find("#autor").text();
	var vtime=$(this).find("#time").text();

a_this = $(this);
$.post("/play_list.php",{'add':'ok','aid':vaid,'oid':oid,'title':title,'autor':autor,'time':vtime,'uid':get_cookie('uid')},  function(msg){
if(msg=='ok'){
    a_this.find('img').attr("src",'/images/addok.png');
            a_this.removeAttr('id'); //a_this.off("click");
			a_this.addClass('pls'); //a_this.off("click");
plist_load();}
});

event.preventDefault();
	});
	
   jQuery.fn.alignCenter = function() {
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});
</script>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
{JAVASCRIPT}

RT;
exit;
}






$skoka_viv=$full_list['ssoften']*$p;
$sig_vk = get_sig($akk_on,$query,$skoka_viv);
if($query AND stop_ll($query)) echo "<h2><center>Закрыто правообладателем!</center></h2>";
else if($query)
{

$xml_response=cache_xx($query,$p,$akk_on,$sig_vk,$skoka_viv); 

if(empty($xml_response)){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sig($akk_on,$query,$skoka_viv);
	$xml_response=get_xml_response($akk_on,$sig_vk,$query,$skoka_viv);
}

if(!empty($xml_response)){
	$parse = @simplexml_load_string(trim(ltrim($xml_response)));

if(isset($parse[error_msg])){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sig($akk_on,$query,$skoka_viv);
	$xml_response=get_xml_response($akk_on,$sig_vk,$query,$skoka_viv);
	$parse = @simplexml_load_string(trim(ltrim($xml_response)));
}
if(isset($parse[error_msg]))  echo "Ошибка подписи!";
else {
//echo $parse->audio." AND ".$parse->count;
if(($parse->audio AND $parse->count>0) OR ($parse->item>0))
{
if($parse->item>0){
	$parse->count=$parse->item;
	for($i=0;$i<count($parse->aid);$i++){
		$parse->audio[$i]->title=$parse->title[$i];
		$parse->audio[$i]->aid=$parse->aid[$i];
		$parse->audio[$i]->owner_id=$parse->owner_id[$i];
		$parse->audio[$i]->artist=$parse->artist[$i];
		$parse->audio[$i]->duration=$parse->duration[$i];
		$parse->audio[$i]->url=$parse->url[$i];
	}
	//echo "<pre>"; print_r($parse); echo "</pre>";
}

query_write($query);

if($parse->count>0) echo "<h1 class='player_block-title'>Поиск: ".iconv('utf-8','windows-1251',$query)."  </h1>

<ul class='xplayer' id='playlist'>             


\n";
$jjs=''; $mzt=1;




foreach($parse->audio as $key => $val)
{
$nnm=date('i:s', (int)$val->duration);


$val->artist=clean_text($val->artist);
$val->title=clean_text($val->title);


$val->artist = iconv(get_encoding($val->artist), $full_list[sscharset],$val->artist);
$val->title= iconv(get_encoding($val->title),  $full_list[sscharset],$val->title); 
	
	$val->title = preg_replace("/club[0-9]{2,15}/i","",$val->title);
	$val->artist = preg_replace("/club[0-9]{2,15}/i","",$val->artist);

$tname=totranslit($val->artist.'-'.$val->title);
$tname=preg_replace("~([^a-z0-9_-]+)~ui","",$tname);
$tname=str_replace(array(',','\'','\"','&'),"",$tname);

$mysi="";

// текст песни
$lir_txt='';
if($full_list[sslyr]=="true"){
if($val->lyrics_id){
  if($full_list[sspostr]=="true")
  { $tmpfname2=md5($val->lyrics_id);
     if(is_file(dirname(__FILE__)."/cache/".$tmpfname2.".txt"))
     {
     $lir_txt=file_get_contents(dirname(__FILE__)."/cache/".$tmpfname2.".txt");
     }
	 else { $lir_txt=get_lyr($val->lyrics_id);
	 if($lir_txt){
	    $fpt=fopen(dirname(__FILE__)."/cache/".$tmpfname2.".txt", w);
        fputs($fpt,$lir_txt);
        fclose($fpt);
		}
	 }
  }
  else { $tmpfname2=md5($val->lyrics_id); $lir_txt=get_lyr($val->lyrics_id); }
} else $lir_txt=false;;

if($lir_txt){ $lir_txt=iconv(get_encoding($lir_txt),'windows-1251',$lir_txt);
$mcc="href=\"javascript:sshow('".$val->lyrics_id."')\" style='color:#FF8000'";
} else { $mcc=""; $lir_txt="";}
  }
if(strlen($lir_txt)<2 OR !isset($lir_txt)) $istxt=""; else $istxt='<img src="/images/text.png"  title="Текст к треку">';
$lir_txt="<div style='padding:0px 40px 0px 40px'>".$lir_txt."</div>";
// текст песни

$md5_arg=$val->aid . $val->owner_id . $tname;//это та информация, по которой мы будем получать нужные значения для конкретной песни в ajax-запросе
$val_url=$val->url;//это та информация, по которой мы будем получать нужные значения для конкретной песни в ajax-запросе


$serv=get_servers();
$idhash=md5($val->aid."*".$val->owner_id.'_'.rand(500,2550));
if($full_list[ssbit]=="true") $zl='	<div class="dd" style="width:80px;">
	{$lsize[bit]}&nbsp;
	</div>';
if($full_list[ssoneurl]=="true") $li1="http://".$serv."/saudio/".$hashss."/".$val->aid."/".$tname."(".$serv.").mp3";
else $li1="http://".$serv."/audios/".$val->aid."/".$val->owner_id."/".$tname."(".$serv.").mp3";





echo <<<GPP



<li  class="track" background-color: #4B95E5; >

			<div class="xplayer-btn">
				<table cellspacing=0 cellpadding=0 ><tr><td align=middle valign=middle>

</div>
</td>

</tr></table>
			</div>
			<div  class="dd" style="float:left; width:25px; cursor:pointer; " onclick="gopl(this)" id="plid_{$idhash}">
	<noindex><span class="ui-icon ui-icon-play"  id="ui-icon-play"><img src="/images/play.png"  title="Играть"></span></noindex>
	<noindex><span class="ui-icon ui-icon-pause" id="ui-icon-pause" style="display:none; "><img src="/images/playlist.png"  title="Пауза"></span></noindex>
	<noindex><span style="display:none;" id="norber">http://{$serv}/audios/{$val->aid}/{$val->owner_id}/play.mp3</span></noindex>
	<noindex><span style="display:none;" id="xftitle">{$val->artist} - {$val->title}</span></noindex>
</div>

<div class="dd" style="width:25px;float:left; ">
	<noindex><div  id="addmp3_{$idhash}">
	<img src="/images/add.png" border="0" id="is_add1" title="Добавить в плейлист" style="cursor:pointer;"\>
	<img src="/images/addok.png"  title="Добалено" id="is_add2" style="display:none">
	<span style="display:none" id="aid">{$val->aid}</span>
	<span style="display:none" id="oid">{$val->owner_id}</span>
	<span style="display:none" id="autor">{$val->artist}</span>
	<span style="display:none" id="title">{$val->title}</span>
	<span style="display:none" id="time">{$val->duration}</span></div></noindex>
	</div>

	<div class="dd" style="width:25px; float:left; padding: 0px 7px 0px 0px;">
	<noindex><a href="{$li1}" style="text-decoration:underline; font-size:13px;"><img src="/images/download.png"  title="Скачать"></a></noindex>
	</div>
			<h2 class="xplayer-title"><a href="javascript:return false;" onclick="$('#aplayer_{$mzt}_z').slideToggle('slow');" id="aplayer_{$mzt}"><b>{$val->artist}</b> - {$val->title} </a></h2>
			
			<em>&nbsp;{$nnm} </em>
			<emr><b><a href="javascript:return false;" onclick="$('#aplayer_{$mzt}_z').slideToggle('slow');" id="aplayer_{$mzt}" style="top:6px;"><br>{$istxt}</a></b></emr>
            <ems><span class="size" rel="{$md5_arg}" rel2="{$val_url}" style="cursor:pointer;"><br><img src="/images/mb.png"  title="Узнать размер и битрейт">&nbsp;&nbsp;</span></ems>


</li>

<div id="aplayer_{$mzt}_z" style='display:none;' class='tsst'><pre>{$lir_txt}</pre></div>





GPP;




	
if($count_comm > 0){
	

$ssaq=htmlspecialchars($val->artist." - ".$val->title);
echo <<<EE

EE;

}
 else {
	
}

$jjs.='';
$mzt++;
} 
echo <<<GPP

</ul>
<script type="text/javascript">
<!--

				refer = (typeof(window.custom_ref) != 'undefined')?window.custom_ref:document.referrer;

				new Image().src = "//counter.yadro.ru/hit?r"+

					escape(refer)+((typeof(screen)=="undefined")?"":

					";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?

					screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+

					";"+Math.random();//-->


			</script>
<div class="div_hr">&nbsp;</div>

GPP;

// ПОСТРАНИЧКА

if($full_list[sspostr]=="true"){
	if($parse->count > $full_list[ssoften]){
		echo '<div id="four_page">
				<ul class="listalka"><center>';
if($parse->count>480) $parse->count=480;

if($p!=0) echo " <li><a href=\"javascript:get_pl3('".($p-1)."')\"  ><b>&nbsp;Назад&nbsp;</b></a></li> ";

for($i=0;$i<floor($parse->count/$full_list[ssoften]);$i++){
		if($p!=$i) echo " <li><a href=\"javascript:get_pl3('".($i)."')\" ><b>&nbsp;".($i+1)."&nbsp;</b></a></li> ";
		else echo " <li><a href=''  style='margin: 0 3px 0 3px'><em>&nbsp;".($i+1)."&nbsp;</em></a> </li>";
}

if($p>=0 AND ($full_list[ssoften]*($p+1)) < $parse->count) echo " <li><a href=\"javascript:get_pl3('".($p+1)."')\"  ><b>&nbsp;Далее&nbsp;</b></a></li> ";

		echo '</center></ul></div>';
	}
}
// ПОСТРАНИЧКА


} else echo "<br><center><img src='/images/alert.png'  ><br><b>По вашему запросу треки не найдены!<br> <br>Возможно допустили ошибку или это технический сбой сервера.</b></center><br>
<center><a href=\"javascript:get_pl3('".($p-1)."')\"  ><h1 class='player_block-title'>Обновить страницу</b></h1><center><br><br>";

}
} else echo "<br><br><center>Ошибка запроса!</center><br><br>";

} 
?>
<script type="text/javascript">
$(".size").click(function(){
	var md5_arg, val_url, el=$(this);
	md5_arg=el.attr("rel");
	val_url=el.attr("rel2");
	$.ajax({
		type: "POST",
		url: "/size.php",
		data: "md5_arg="+md5_arg+"&val_url="+val_url,
		success: function(msg){
			el.html(msg).css("cursor","default");
		}
	});
});
</script>
<?php

$query = iconv(get_encoding($query), 'utf-8', $query);

$_GET[$full_list['ssvar']]=$query;

delete_temp_f(dirname(__FILE__)."/cache_video/",$full_list[1],$full_list[0],$full_list[0]);

$skoka_vivv=$full_list['ssoften']*$p;
$sig_vk = get_sigv($akk_on,$query,$skoka_viv);
 
if($query)
{

$xml_responsev=cache_v($query,$p,$akk_on,$sig_vk,$skoka_viv); 

if(empty($xml_responsev)){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sig($akk_on,$query,$skoka_viv);
	$xml_responsev=get_xml_responsev($akk_on,$sig_vk,$query,$skoka_viv);
}
if(!empty($xml_responsev)){
	$parse = @simplexml_load_string(trim(ltrim($xml_responsev)));

if(isset($parse[error_msg])){
	$akk_on=new_apiid($akk_list); 
	$sig_vk = get_sig($akk_on,$query,$skoka_viv);
	$xml_responsev=get_xml_responsev($akk_on,$sig_vk,$query,$skoka_viv);
	$parse = @simplexml_load_string(trim(ltrim($xml_responsev)));
}

if(isset($parse[error_msg]))  echo "Ошибка подписи!";
else {
//print_r($parse);
if(($parse->video) OR ($parse->item>0))
{
if($parse->item>0){
	$parse->count=$parse->item;
	for($i=0;$i<count($parse->aid);$i++){
		$parse->video[$i]->title=$parse->title[$i];
		$parse->video[$i]->aid=$parse->aid[$i];
		$parse->video[$i]->owner_id=$parse->owner_id[$i];
		$parse->video[$i]->artist=$parse->artist[$i];
		$parse->video[$i]->duration=$parse->duration[$i];
		$parse->video[$i]->url=$parse->url[$i];
	}
	//echo "<pre>"; print_r($parse); echo "</pre>";
}
if(!$parse->count){
	$parse->count=count($parse->video);
}

if($parse->count>0) echo "<br><div class='lines'></div><br><h1 class='player_block-title'>Видео: ".iconv('utf-8','windows-1251',$query)."  </h1>
<div style='width: 667px;'>
<table style='height:auto; width: 667px; clear:left;'>
<tr>\n";

echo <<<R

<center>

R;

foreach($parse->video as $key => $val)
{
	if($z>$full_list['ssoften']) break;
$nnm=date('H:i:s', trim(ltrim(strtotime("01.01.1970 00:00:00")+$val->duration)));

$val->title=clean_text($val->title);

	$val->title = preg_replace("/club[0-9]{2,15}/i","",$val->title);

$tname=totranslit(substr($val->title,0,20));
$mysi="";

$idhash=md5($val->aid."*".$val->owner_id.'_'.rand(500,2550));



echo <<<R

<td class="dd" style="width:24%; padding: 9px 7px 0px 0px;">
<ul class='resultsv' style='width:162px;'>
<li >
<center>
<div style="height:34px; ">
<a href="javascript:wplay('{$val->owner_id}_{$val->id}')" >{$val->title} </a>
</div>
 </li>
</ul>
<a href="javascript:wplay('{$val->owner_id}_{$val->id}')" ><img src="{$val->thumb}" style="border: 1px solid #000000;"></a>

<ul class='resultsvs' style='width:162px;'>
<li>
&nbsp;&nbsp;&nbsp;Время ролика: {$nnm}
</center>

</li>
</ul>
</td>



R;



} 
echo "\n\n</tr>
		</table></div>
<div style='clear:left'>&nbsp;</div><div style=\"clear:left\">&nbsp;</div>      </center> \n\n";

} else echo "";

}
} else echo "";

}

?>
{JAVASCRIPT}<?=$jjs?>