// browse.php
function show_text_bg() {
//var vijda_li_se = document.getElementById("text_bg").style.display;
var vijda_li_se = $("#text_bg").css("display");

$("#text_bg_show").html("");
if (vijda_li_se == 'block') $("#text_bg").slideUp(2500);
    else $("#text_bg").slideDown(2500);
//var bez_nov_red = document.getElementById("text_bg").innerHTML;
var bez_nov_red = $("#text_bg").html();
bez_nov_red=(bez_nov_red.replace(/ /g, "&nbsp;"));
$("#text_bg").html(bez_nov_red + "<br><HR width=\"100%\">");
var bez_nov_red2 = $("#text_glaven").html();
bez_nov_red2 = (bez_nov_red2.replace(/ /g, "&nbsp;"));
$("#text_glaven").html(bez_nov_red2 + "<br><HR width=\"100%\">");
if (vijda_li_se == 'none') document.location.href="#prevod";
    else $("#text_bg_show").html("<a href=\"#\" onCLick=\"javascript:show_text_bg();return false\" title=\"Покажи превода\"><b><br>П<br>о<br>к<br>а<br>ж<br>и<br> <br>П<br>р<br>е<br>в<br>о<br>д<br>а</b></a>");
}
// ----------------------- НАЧАЛО ЛЮБИМИ
var links = new Array(
" ",
"Песента успешно добавена.",
"Песента успешно изтрита.",
"За да добавите песента в Любими , трябва да <a href=\"LogIn.php\">Влезете в профила си. <b>Вход</b><\/a>",
"Песента е вече в любими",
"песента не е намерена в Любими"
);
function update_liubimi(show,id){
	$('#syob6tenie').html(links[show]);
	if( (show==1)||(show==4)) $('#liubimi').html("<a href=\"#\" onCLick=\"javascript:liubimi_add_remove('remove',"+id+");return false;\" title=\"Изтрий от Любими\">Изтрий от Любими</a>");
	else $('#liubimi').html("<a href=\"#\" onCLick=\"javascript:liubimi_add_remove('add',"+id+");return false;\" title=\"Добави към Любими\">Добави към Любими</a>");
	}


function liubimi_add_remove(actions,id){
    $("#syob6tenie").html("Зареждане ....");
    var deistvie="";
   if (actions=="add")	deistvie="add";
	else deistvie="remove";
            $.ajax(
    {   type: "GET",
        url: "liubimi.php",
        data: "id="+id+"&"+deistvie+"=1",
        cache: false,
        success: function(message)
        {
            update_liubimi(message,id);
        }
    });
}
//КРАЙ ЛЮБИМИ



function urlencode_po_taka(str) {
return encodeURIComponent(str);
}





// ----------------------- НАЧАЛО ГЛАСУВАНЕ

function glasuvai(id){
    $("#glasuvane").html="....";
            $.ajax(
    {   type: "GET",
        url: "browse_glasuvai.php",
        data: "id="+id,
        cache: false,
        success: function(message)
        {
            $("#glasuvane").html(message);
        }
    });

        }
//КРАЙ ГЛАСУВАНЕ


function album_vij_pokaji_video(video,koe){
	if(koe==1) var video = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="450" height="403"><param name="movie" value="http://i47.vbox7.com/player/ext.swf?vid='+video+'&autoplay=1"></param><param name="quality" value="high"></param><embed src="http://i47.vbox7.com/player/ext.swf?vid='+video+'&autoplay=1" quality="high"pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="403"></embed></object>';
	if(koe==2) var video = '<object width="425" height="355"><param name="movie" value="'+video+'&autoplay=1"></param><param name="wmode" value="transparent"></param><embed src="'+video+'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>';
	
	
	$("#ablbum_vij_pokaji_video").html (video);
	}



function cenzora_pokaji_browse(){
    $("#browse_tekst_buton").toggle();
    $("#browse_tekst").toggle(2500);
    }


function smeni_video(where){
    if(where == 1) {
        	$('#video').html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="450" height="403"><param name="movie" value="http://i47.vbox7.com/player/ext.swf?vid='+video_vbox+'&autoplay=1"><param name="quality" value="high"><embed src="http://i47.vbox7.com/player/ext.swf?vid='+video_vbox+'&autoplay=1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="403"></embed></object>');
    		}
	else if (where == 2 ){
        	$('#video').html('<object width="425" height="355"><param name="movie" value="'+video_youtube+'&autoplay=1"></param><param name="wmode" value="transparent"></param><embed src="'+video_youtube+'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>');
                }
 	else if(where == 3){
                $('#video').html(video_link);
			}
        else if(where == 4){
                $('#video').html('<embed flashVars="playerVars=showStats=no|autoPlay=yes|videoTitle="src="'+video_metacafe+'"width="498" height="423" wmode="transparent" allowFullScreen="true" allowScriptAccess="always"pluginspage="http://www.macromedia.com/go/getflashplayer"type="application/x-shockwave-flash"></embed>');
        }
	}



function  showHint(tyrsene,koe,stranica){
         $.ajax({
        url:"UploadLiryc_artists_filter_ajax.php",
        type:"GET",
        data:"filter="+urlencode_po_taka(tyrsene)+'&kyde='+koe+'&stranica='+urlencode_po_taka(stranica),
        success:function(msg){
        if(msg) $('#artist'+koe+'_ajax').html(msg);
        else $('#artist'+koe+'_ajax').html('<font color="red">Няма намерени резултати</font>');
        }
    });


}


function Izberi_Artist(id,kyde,name){
	if(kyde==1) {document.getElementById('artist_name').value=name;
		document.getElementById('artist').value=id;
		}
	else {
		document.getElementById('artist'+kyde+'_name').value=name;
		document.getElementById('artist'+kyde).value=id;				
		}
	document.getElementById('artist'+kyde+'_ajax').innerHTML='';
}


function Izberi_Artist_iztrii(kyde_iztrii){
	if(kyde_iztrii==1) {document.getElementById('artist').value='';document.getElementById('artist_name').value='';}
	else{document.getElementById('artist'+kyde_iztrii).value='';document.getElementById('artist'+kyde_iztrii+'_name').value='';}
	}


function browse_problem(a){
    if(a=='Видеото не работи'){
    if(video_vbox) smeni_video(1);
        else if(video_youtube) smeni_video(2);
            else if (video_metacafe) smeni_video(4);
    alert('Състемата ще пробва да оправи проблема автоматично, моля изчакайте 15 секунди преди да изпратите съобщението');
    }
    
    $('#browse_problemi').html('Подробности<br><textarea cols="10" rows="5" id="browse_problem"></textarea><br><input type="button" value="изпати" onclick="browse_problem_ajax(\''+a+'\');">');
    return false;
    }
function browse_problem_ajax(a){
    if( ! $('#browse_problem').val() ) { alert('Трябва да въведете какъв е проблема');}
    else {

     $.ajax({
        url:"browse_problem.php",
        type:"GET",
        data:"problem="+urlencode_po_taka(a + ' ' + $('#browse_problem').val())+'&url='+tekushta_stranica,
        success:function(){
        $('#browse_problemi').html('Благодарим, ще прегледаме за проблема');
        }
    });
    }
}


$(function (){
var bukvi=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
    'Z','1','2','3','4','5','6','7','8','9','А','Б','В','Г','Д','Е','Ж','З','И','Й','К','Л','М','Н','О','П',
    'Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ь','Ю','Я'];
var w='';

for(q=0;q<=25;q++){
    w += '<a href="browsepobukva.php?artistbrowsebukva='+bukvi[q]+'">&nbsp;'+bukvi[q]+'&nbsp;</a>&nbsp;';
    }

w += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="browsepobukva.php?artistbrowsebukva=10">&nbsp;0&nbsp;</a>&nbsp;';

for(q=26;q<=34;q++){
    w += '<a href="browsepobukva.php?artistbrowsebukva='+bukvi[q]+'">&nbsp;'+bukvi[q]+'&nbsp;</a>&nbsp;';
    }
w += '&nbsp;&nbsp;<a href="browsepobukva.php?artistbrowsebukva=11">&nbsp;#&nbsp;</a>&nbsp;<br>';
for(q=35;q<=64;q++){
    w += '<a href="browsepobukva.php?artistbrowsebukva='+bukvi[q]+'">&nbsp;'+bukvi[q]+'&nbsp;</a>&nbsp;';
    }

$('#bukvi_bg').html(w);
});

$(function (){
    $('#browse_problemi').html('<a href="#" onclick="browse_problem(\'Видеото не работи\');return false;">Видеото не работи ?</a><br><a href="#" onclick="browse_problem(\'Грешен текст\');return false;">Грешен текст</a><br><a href="#" onclick="browse_problem(\'Грешен превод\');return false;"> или грешен превод?</a>');


});