function toggle(link,obj,texts) { if($(obj).css('display') == 'none') { link.text(texts[0]); $(obj).show('slow'); } else {	link.text(texts[1]); $(obj).hide('slow');}}
function externalLinks(){if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++){var anchor = anchors[i]; if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") { anchor.target = "_blank"; }}}
function add_vote(id) { var optionId; $('div#sonda_cnt_'+id+' input[type=radio]').each(function() { if(this.checked==true) { optionId = this.value;}});$.post("add_vote.php", {poll_id: id,question_id:optionId}, function(data) { $('#sonda_cnt_'+id).empty(); $('#sonda_cnt_'+id).append(data); });}

var radios = 198;
var radios_to_check = 33;
//var current_id = parseInt($('#current_id').val());

function init_radio(current_id) {
    $('#test_cont_'+(current_id)+' .questions_count').html(radios);
    
    $('#test_cont_'+(current_id)+' input:radio:not(:checked)').click(function(){
        if($(this).attr('checked') == true) {
            $(this).unbind();

            if($(this).val() == 1) $(this).next(': radio').unbind();
            if($(this).val() == 0) $(this).prev(': radio').unbind();

            if(radios > 0) radios--;
            if(radios_to_check > 0) radios_to_check--;
            $('#test_cont_'+(current_id)+' .questions_count').html(radios);
            $('#error_info_num').html(radios);
            if(radios == 0) {
                $('#end_test').removeAttr('disabled').attr('class','subm');
                $('#error_info').hide();
            }
            if(radios_to_check == 0) {
                $('#test_cont_'+(current_id)+' .next_button').removeAttr('disabled').attr('class','next_button test_next top10');
                $('#test_cont_'+(current_id)+' .next_page_info').empty();
            }
        }
        //alert(radios_to_check);
    });
}