//Funciones comunes de Diselo a un amigo
function showDiselo(id, prod, pgneta)
{
    $('diselo_lista').innerHTML="<img src='/images_new/tellafriend/cargando.gif' alt='Cargando' />";
    try
    {
        var load_url = '/tellafriend/index.php';
        var post='pg='+pgneta+'&id_prod='+id+'&prod='+prod;
        YAHOO.util.Connect.asyncRequest("post",load_url, { success: function(o) { if(!o.responseText.match('error')) { $('diselo_lista').innerHTML = o.responseText; } } },post);
    }catch(err){
        new Ajax.Request('/tellafriend/index.php', {
            method:'post',
            parameters:'pg='+pgneta+'&id_prod='+id+'&prod='+prod,
            onSuccess: function (response)
            {
                html=response.responseText;
                $('diselo_lista').innerHTML = html;
            }
        });
    }
    $('popupD').style.display='block';
    $('popupX').style.display='block';
}


function showDicho()
{
    result = comprobar_taf();
    if (result)
    {
        var pg = $F('pg_2');
        var id = $F('id_prod');
        var prod = $F('prod');
        var nom = $F('nombre');
        var com = $F('comentario');
        var em1 = ($('e1'))?$F('e1'):'';
        var em2 = ($('e2'))?$F('e2'):'';
        var em3 = ($('e3'))?$F('e3'):'';
        var em4 = ($('e4'))?$F('e4'):'';

        var pars = 'pg='+ pg +'&id_prod='+ id +'&prod='+ prod;
        pars += '&nombre='+ nom +'&comentario='+ com +'&e1='+ em1 +'&e2='+ em2 +'&e3='+ em3 +'&e4='+ em4;
        try
        {
           var load_url = '/tellafriend/index.php';
           YAHOO.util.Connect.asyncRequest("post",load_url, { success: function(o) { if(!o.responseText.match('error')) { $('diselo_lista').innerHTML = o.responseText; }}},pars);
        }catch(err){
        new Ajax.Request('/tellafriend/index.php', {
            method:'post',
            parameters: pars,
            onSuccess: function (response)
            {
                html = response.responseText;

                $('diselo_lista').innerHTML=html;
            }
        });
        }

    }
    else
    {
        errores.show();
    }
        $('popupD').style.display='block';
        $('popupX').style.display='block';
 }


function comprobar_taf()
{
    var result = true;

    if (($F('nombre') == '') )
    {
        errores.push(new Error('38','001','001','',"setErrorBackColor($('nombre'));"));
        result = false;
    }
    if ($F('e1') == '' && $F('e2') == '' && $F('e3') == '' && $F('e4') == '')
    {
        errores.push(new Error('38','001','002','',"setErrorBackColor($('e1'));"));
        result = false;
    }
    for(i=1;i<5;i++)
    {
        if ($F('e'+i) != '' && !isEmail($F('e'+i)))
        {
            errores.push(new Error('38','001','003','',"setErrorBackColor($('e"+i+"'));"));
            result = false;
        }
    }

    return result;
}
