$(document).ready(function() {
if($('.slide').length>0){
$('.slide').css('background','url('+sliderdirectory+'/'+sliderimages[0]+') no-repeat');
var x=1;            
$('.control.right').click(function(){ 
x++;
if (x==4){
x=1;
}
  $('.slide').fadeOut('slow', function() {
    changePhoto (x)
  });


$('.slide').fadeIn();    
}



);
$('.control.left').click(function(){ 
x--;
if (x==0){
x=3;
}


  $('.slide').fadeOut('slow', function() {
    changePhoto (x)
  });


$('.slide').fadeIn();

}



);
}
 }); 





function changePhoto (x){
var currentimage=sliderimages[x-1];
$('.slide').css('background','url('+sliderdirectory+'/'+currentimage+') no-repeat');

}

$(document).ready(function() {
    $('body').click(function() {$('.values:visible').hide() } );
    $(".customSelect").hide();
    $(".customSelect").next().css ('display','block');
    $(".select").each(function (){
    var a=$(this).prev();
    $(a).addClass('currentselect');
    $(this).html($('.currentselect :selected').text());
    $(a).removeClass('currentselect');
    
    });
    $(".customSelect").each(function (){
    var selectvalue=$(this).val();
    $(this).find("option").each(function () {var pointer=$(this).parent().next();pointer.next().append("<a href='http://funsport.bg/services.php?id="+$(this).val()+"' value="+$(this).val()+">"+$(this).text()+"</a>")
    });
    $(".values a").click(function () { $(this).parent().prev().html($(this).html());$(this).parent().hide();
    var a=$(this).parent().prev().prev();
    $(a).addClass('currentselect');
    var currentvalue=$(this).attr('value');
    $(".currentselect option[value='"+currentvalue+"']").attr('selected', 'selected');
    $(a).removeClass('currentselect');
    });
    $(".select").click(function(event){
    $(".values").hide();
    var position = $(this).position();
    $(this).next().css('left',position.left+3);
    $(this).next().css('top',position.top+$(this).height()+5);
    $(this).next().show();
    event.stopPropagation();
    });
    });
    });
 /*$(document).ready(function() {
    $('.blueblock .hid').hide();
    $('.top.more').css ('height','37px');
    $('.top.more').css ('cursor','pointer')
    });
     $(document).ready(function() { 
    $('.top.more').eq(0).click(function(){
    var height=$('.top.more').eq(0).height();
    if(height==37){$('.top.more').eq(0).css ('height','61px');}
    if(height==61){$('.top.more').eq(0).css ('height','37px');}
    $('.hid').eq(0).slideToggle();
    
    }); 
    $('.top.more').eq(1).click(function(){
    var height=$('.top.more').eq(1).height();
    if(height==37){$('.top.more').eq(1).css ('height','61px');}
    if(height==61){$('.top.more').eq(1).css ('height','37px');}
    
    $('.hid').eq(1).slideToggle();}); 
    }); */
    
$(document).ready(function(){	
if($("#sliders").length>0){
		$("#sliders").easySlider({
			prevText: 'Previous',
			nextText: 'Next', 
			continuous: true 		
		});        }
	});

    $(document).ready(function(){	
	$(".block397.left .row:odd").addClass("second");
	$(".block397.right .row:odd").addClass("second");
});
   
