/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function ajaxReq(div,params,actionPage) {
    var url = actionPage;
    var ajax = new Ajax.Updater
    (
        {success: div},
        url,{method: 'post', parameters: params}
    );
}

function ConfirmDeleteMessage(URL)
{
   if (confirm("Confirmez-vous la suppression ?"))
   {
       window.location = URL;
   }
}

function changeView(id)
{
    $(id).toggle();
}

function ashow(id)
{
    document.getElementById(id).style.display='block'
}

function ahide(id) {
    document.getElementById(id).style.display='none'
}

function select_text(form_name, field_name)
{
    var content=eval("document."+form_name+"."+field_name);
    content.focus();
    content.select();
}

function voteForURL(id, type)
{
    var url = '/annuaire/cmd/vote';
    var ajax = new Ajax.Updater
    (
        {success: 'vote_block'},
        url,{ method: 'post', parameters: '&site_id='+id+'&vote='+type }
    );
}

function tab_show(id, n)
{
    for(i=1; i<=n; i=i+1)
    {
        var contentid = 't_content_' + i;
        var tabid = 't_tab_' + i;

        if(i == id)
        {
            $(tabid).addClassName('active');

            $(contentid).removeClassName('tab_hide');
            $(contentid).addClassName('tab_show');
        }
        else
        {
            $(tabid).removeClassName('active');

            $(contentid).removeClassName('tab_show');
            $(contentid).addClassName('tab_hide');
        }
    }
}
