function selectVideo(el){
    $.get(el.href, function(data) { $('.tabbed div#videos').html(data); });
    return false;
}


function get_offers(monthly){
    if($('.operators input[name=n]:visible').is(':not(:checked)')){
        $('#toggle_networks').attr('checked',false);
    }else{
        $('#toggle_networks').attr('checked',true);
    }
    //alert('zxcv');
    var options = {
        target: '#results_box',
        url: monthly?'monthly_offers_ajax':'prepaid_offers_ajax',
        success: function(){ 
            $('#offers_count').text($('#offers_count_hidden').text());
            //alert('ok'); 
        }
    };
    $('#offers_form').ajaxSubmit(options);
}

function toggle_all(){
    if($('#toggle_networks:visible').is(':checked')){
        $('.operators input:visible').attr('checked',true);
    }else{
        $('.operators input:visible').attr('checked',false);
    }
    get_offers();
}

function select_country(code){
    $('#searchForm .flags img[@title!='+code+']').each(function(item){
        $(this).attr('src',$(this).attr('src').replace('1','0'));
    });
    $('#searchForm .flags img[@title='+code+']').each(function(item){
        $(this).attr('src',$(this).attr('src').replace('0','1'));
    });
    $('#searchForm .flags input[@value='+code+']').select().click();
}
