﻿ var addthis_pub = "fiap";
 var addthis_options = 'email, favorites, print, delicious, linkedin, google, myspace, live, facebook, yahoobkm, twitter, more';
 
function configurar_share(url)
{
    addthis_offset_top = 0;
    addthis_offset_left = 0;
    addthis_brand = 'FIAP';
    addthis_logo = url + 'imagens/layout/logo_fiap.jpg';
    addthis_logo_background = '666666';
    addthis_logo_color = 'CBCBCB';
    addthis_hide_embed = false;
}

function imprimir()
{
    document.getElementById($('.lblAddiImpressao')[0].id).innerHTML = '<img src="' + document.getElementById($('.hiAddiUrlImpressao')[0].id).value + '" height="0" width="0">';
    window.print();
}

function EnviarParaAmigo(url)
{
   showModalPopupViaClientIndique(url);
}

function showModalPopupViaClientIndique(url) 
{
    var lista = $('div.divFormIndiqueAmigo');
    for(i=0; i<lista.length; i++)
        document.getElementById(lista[i].id).style.display = '';
    lista = $('div.divMensagemIndiqueAmigo');
    for(i=0; i<lista.length; i++)
        document.getElementById(lista[i].id).style.display = 'none';
    
    if(url == '')
        url = window.location.href;
    $('.hiIndiqueAmigo').val(url);
    document.getElementById($('.lblAddiIndiqueAmigo')[0].id).innerHTML = '<img src="' + document.getElementById($('.hiAddiUrlIndiqueAmigo')[0].id).value + '" height="0" width="0">';
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorIndique');
    modalPopupBehavior.show();
}

function hideModalPopupViaClientIndique() {
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorIndique');
    modalPopupBehavior.hide();
}

function showModalPopupViaClientFotos(id) 
{
    document.getElementById('iMaisFotos').src="/Portal/maisFotos.aspx?id="+ id;
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorFotos');
    modalPopupBehavior.show();
}

function hideModalPopupViaClientFotos() {
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorFotos');
    modalPopupBehavior.hide();
}

function CadastrarFicha(url)
{
   showModalPopupViaClientFicha(url);
}

function showModalPopupViaClientFicha(url) 
{
   
    var lista = $('div.divFormFichaCadastral');
    for(i=0; i<lista.length; i++)
        document.getElementById(lista[i].id).style.display = '';

    lista = $('div.divMensagemFichaCadastral');
    for(i=0; i<lista.length; i++)
        document.getElementById(lista[i].id).style.display = 'none';
             
    if(url == '')
        url = window.location.href;
    $('.hiFichaCadastral').val(url);
    document.getElementById($('.lblAddiFichaCadastral')[0].id).innerHTML = '<img src="' + document.getElementById($('.hiAddiUrlFichaCadastral')[0].id).value + '" height="0" width="0">';
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorFicha');
    modalPopupBehavior.show();
}

function hideModalPopupViaClientFicha() {
    var modalPopupBehavior = $find('programmaticModalPopupBehaviorFicha');
    modalPopupBehavior.hide();
}

function salvaConfig(urlHome)
{
    var spanSubcanal = $('span.hiSubcanalID');
    var subcanalID = spanSubcanal[0].innerHTML;
    var lista = $('span.checked');
    var str = '';
    for(i=0; i<lista.length; i++)
    {
        if (str != '')
            str = str + '&';
        str = str + "col0[]=PortLets" + ($(lista[i]).attr('secao_id'));
    }
    if (str == '')
        str = '*';

    $.cookie("personalizacaoHome"+ subcanalID, str, { path: '/', expires: 365 });
    //$.cookie("personalizacaoHome", str, { path: '/', expires: 365 });
    window.location.href = urlHome;
}

/*function salvaConfig(urlHome)
{
    var spanSubcanal = $('span.hiSubcanalID');
    var subcanalID = spanSubcanal[0].innerHTML;
    var lista = $('a.checked');
    var str = '';
    for(i=0; i<lista.length; i++)
    {
        if (str != '')
            str = str + '&';
        str = str + "col0[]=PortLets" + ($(lista[i]).attr('secao_id'));
    }
    if (str == '')
        str = '*';
    $.cookie("personalizacaoHome"+ subcanalID, str, { path: '/', expires: 365 });
    window.location.href = urlHome;
}*/

function AtualizaFundo(campo)
{
    if(campo.className == "unchecked")
        campo.className = "checked";
    else
        campo.className = "unchecked";
    obterMarcados();
}




    
function obterMarcados() 
{  
    /*cont = 0;
    var listaMarcados = document.getElementsByTagName("INPUT");  
    for (loop = 0; loop < listaMarcados.length; loop++) 
    {  
        var item = listaMarcados[loop];  
        if (item.type == "checkbox" && item.checked) 
        {  
            cont++;
        }  
    }  */
    /*if(cont > 9)
        alert('Atenção: apenas 9 itens podem ser exibidos na página.')*/
 } 
 
/*function PersonalizarHome(strMenu)
{
    if(strMenu == 'menuPrincipal')
        document.getElementById('customizar').style.display = 'none';
    else
        document.getElementById('menuPrincipal').style.display = 'none';
    
    if(document.getElementById(strMenu).style.display == 'none' )
        document.getElementById(strMenu).style.display = 'block';
    else
        document.getElementById(strMenu).style.display = 'none';
}*/

function PersonalizarHome(strMenu)
{
    if(strMenu == 'menuPrincipal' || strMenu == 'menuPrincipalEsconde')
        document.getElementById('customizar').style.display = 'none';
    else
        document.getElementById('menuPrincipal').style.display = 'none';
    
    if(strMenu == 'menuPrincipal')
        document.getElementById(strMenu).style.display = 'block';
    else if(strMenu == 'menuPrincipalEsconde')
        document.getElementById('menuPrincipal').style.display = 'none';
    else if(strMenu == 'customizar' && document.getElementById('customizar').style.display == 'none')
        document.getElementById(strMenu).style.display = 'block';
    else if(strMenu == 'customizar' && document.getElementById('customizar').style.display == 'block')
        document.getElementById(strMenu).style.display = 'none';
}

$(function(){
    $("a:first", ".menuv li.submenu_principal", ".menuh li.submenu_principal").addClass("seta");
    
    $(".menuv li.submenu_principal, .menuh li.subv").each(function(){
        var el = $('#' + $(this).attr('id') + ' ul:eq(0)');
        
        $(this).hover(function(){
            el.show();
        }, function(){
            el.hide();
        });
    });
});




