

dim janela
dim janela_status
dim logo
dim t
dim t1
dim h
dim ano
dim mes
dim dia
dim hora
dim minuto
dim segundo
dim valor
dim dest
dim id 
dim parceiro
dim atributo
dim visibilidade
dim imagem
dim id_imagem
dim atributos
dim elemento

'***************************************************************************************** 
       



'*******************************************************************
Public Function mudaratributo(id,atributo,valor)
'alert(id & " " & atributo & " " & valor)
         set t = document.getElementById(id)
         call t.setAttribute(atributo,valor)
         set t=nothing
End Function
'*******************************************************************
Public Function valor_de_atributo(id,atributo)
 
         set t = document.getElementById(id)
             valor_de_atributo= t.atributo.value
         set t=nothing
End Function
'*******************************************************************

Public Function mostrar_esconder(id,id_imagem)

       set t1 = document.getElementById(id)

       set imagem=document.getElementById(id_imagem)

            visibilidade=t1.style.display

           

                if visibilidade="block" or visibilidade="" then
                  call mudaratributo(id_imagem,"src","/sistema/imagens/navegador/abrir.gif")
                  
                   valor="none"
                   else
                  call mudaratributo(id_imagem,"src","/sistema/imagens/navegador/fechar.gif") 
                 
                   valor="block"
                end if 

        
     '    call mudaratributo(id,"style.display",valor)        
                   t1.style.display=valor



     '  abrir linha seguinte quando atributos personalizados estiverem activos 2006-04-19

     '              call fixar_atributo_de_parceiro(f1.parceiro.value,id & ":style.display",valor) 
         set t1=nothing 
         set id_imagem=nothing
                
End Function 

'***********************************************************************

Public Function mostrar_janela(conteudo)


        
           set  janela=Window.createPopup()
                janela.document.write conteudo
         
                janela.show 700,-80,350,310  ' horizontal, vertical, largura e altura
                janela_status=true
            
         
End Function
'**************************************************************************  
Public Function data_completa(idioma)
       SetLocale(idioma)

       h8=""
       h8=FormatDateTime(now,1)
       dia=weekdayname(weekday(now))
     
  
document.write "<font class='data' ><b>" &  Ucase(left(h8,1))  & mid(h8,2) &  "</b></font>"
End Function
'**************************************************************************
'**************************************************************************  
Private Function data_passada(idioma,diasx)
       SetLocale(idioma)
       dim data_anterior 
       data_anterior=DateAdd("d",diasx,now)  

       h8=""

       h8=FormatDateTime(data_anterior,1)
       dia=weekdayname(weekday(data_anterior))
     
  
document.write "<font class='data' ><b>" &  Ucase(left(h8,1))  & mid(h8,2) &  "</b></font>"
End Function
'**************************************************************************
Public Function FormataData()
ano=""
ano=year(now)
mes=""
mes=month(now)
'
if len(mes)=1 then
   mes="0" & mes
end if
' 
dia=""
dia=day(now)

if len(dia)=1 then
   dia="0" & dia
end if
'
hora=""
hora=hour(now)
if len(hora)=1 then
   hora="0" & hora
end if
'
minuto=""
minuto=minute(now)
if len(minuto)=1 then
   minuto="0" & minuto
end if

segundo=second(now)
if len(segundo)=1 then
   segundo="0" & segundo
end if
end function
'***********************************************************************************  
Public Function mostrar_estilo()

estilo.href="/sistema/estilos/" & janela.document.opcoes.estilo_preferido.value
estilo_preferido_pasta=replace( janela.document.opcoes.estilo_preferido.value,".css","")

for each imagem in document.images
    
 caminho_actual=imagem.src
 if Instr(1,caminho_actual,"objecto")>0 then
  
  partes=split(caminho_actual,"/")
  caminho_novo="/sistema/estilos/" &  estilo_preferido_pasta & "/" & partes(ubound(partes))
  
  imagem.src=caminho_novo

end if

next

End Function  
'
'****************************************************************************************
Public Function mostrar_dispositivo()

estilo.media=janela.document.opcoes.dispositivo_preferido.value


End Function  

'*************************************************************************
Public Function aplicar_atributos_personalizados()
   atributos=split(atributos_personalizados.innerText,"*")
   
    for jy=1 to ubound(atributos)
        linha=atributos(jy)
      if len(linha)>0 then
               partes=split(linha,":")
               elemento=partes(0)
               partes1=split(partes(1),"=")

               atributo=partes1(0)
               valor=partes1(1)
   
                 
                   
                set t = document.getElementById(trim(elemento))
                
                      
                       
                     
 
                        if trim(atributo)="style.display" then
                           
                           't.style.display=valor
                         
                        end if        
                                     
                          
                        
                       '  call t. removeAttribute("style.display")
                       ' call t.setAttribute("style.display",valor)
 
                        'call mudaratributo(elemento,chr(34) & atributo & chr(34),valor)
                        ' call  t.setAttribute(chr(34) & style.display,valor)
                        '  t.atributo=valor 
                                  
                set t=nothing
                
              
      end if
   next    

End Function

'*************************************************************************
Public Function calendario()

h="<HTML XMLNS:IE>"
h=h & "<HEAD>"
h=h & "<STYLE>"
h=h & "@media all{"
h=h & "   IE\:Calendar{"
h=h & "      behavior: url(./sistema/behaviors/calendar/calendar.htc) ;"

h=h & "   }"
h=h & "}"
h=h & "</STYLE>"
h=h & "</HEAD>"
h=h & "<BODY bgcolor='yellow' >"
h=h & "<IE:Calendar"
h=h & "   ID = 'cal'"
h=h & "   STYLE = " & chr(34) & "width: 300; height: 275; border: '1px solid black';" & chr(34) & ">"
h=h & "</IE:Calendar>"
h=h & "</BODY>"
h=h & "</HTML>"

 
        
           set  janela=Window.createPopup()
                janela.document.write h & "<font color=red >Calendário de Gestão</font>"
         
                janela.show 700,-80,350,120  ' horizontal, vertical, largura e altura
                janela_status=true
            
             
End Function

'******************************************************************************************************

Public Function fixar_estilo_cliente()
' copiar e adaptar esta função para mudar outros atributos dos parceiros

dim estilo

dim cor 
dim mensagem
dim p
'
' 
window.status=""

parceiro=f1.parceiro.value
atributo="estilo" 
valor=janela.document.opcoes.estilo_preferido.value

if not (navigator.javaEnabled()) then

window.location = "/sistema/avisos/aviso_java.htm"


else 




on error resume next 
    'set  p =  RSGetASPObject("http://www.srsdocs.com:89/library.asp")
     set  p =  RSGetASPObject("library.asp")
on error goto 0

    set  cxx =  p.fixar_atributo_de_parceiro(parceiro,atributo,valor)
         if len(trim(cxx.return_value))=0 then 
                     window.status="Problema de comunicação. Neste momento não é possível aceitar o seu pedido."
            else 

                    window.status=cxx.return_value 
                     

          end if 
  set cxx=nothing
   set p=nothing  
end if   
End Function  
'******************************************************************************************* 
Public Function fixar_atributo_de_parceiro(parceiro,atributo,valor)
'
' 
window.status=""

if not (navigator.javaEnabled()) then

window.location = "/sistema/avisos/aviso_java.htm"


else 




on error resume next 
    'set  p =  RSGetASPObject("http://www.srsdocs.com:89/library.asp")
     set  p =  RSGetASPObject("library.asp")
on error goto 0

    set  cxx =  p.fixar_atributo_de_parceiro(parceiro,atributo,valor)
         if len(trim(cxx.return_value))=0 then 
                     window.status="Problema de comunicação. Neste momento não é possível aceitar o seu pedido."
            else 

                    window.status=cxx.return_value 
                     

          end if 
  set cxx=nothing
   set p=nothing  
end if 
   
End Function  
'******************************************************************************************* 

'***************************************************************************************
Public Function abrir_pagina_de_opcoes()

 h="<HTML xmlns:v='urn:schemas-microsoft-com:vml' XMLNS:IE  >" & vbcrlf
    h=h & "<head>" & vbcrlf
 
    h=h & "<LINK id='estilo' name='estilo' REL='StyleSheet' HREF='/sistema/estilos/opcoes.css'"
    h=h & " TITLE='Estilos' TYPE='text/css' >"
    h=h & "<title>Configurar as sua opções pessoais</title>" & vbcrlf
    h=h & "<STYLE>" & vbcrlf
    h=h & "<!--" & vbcrlf
    h=h & "v\:*" & vbcrlf
    h=h & "{" & vbcrlf
    h=h & "behavior:url(#default#VML);" & vbcrlf
    h=h & "}" & vbcrlf
    h=h & "A {behavior: url(#default#AnchorClick);}" & vbcrlf
    h=h & "-->" & vbcrlf
    h=h & "</STYLE>" & vbcrlf
    h=h & "<script id='scripts_cliente' language='vbscript' type='text/vbscript' src='http://www.srsdocs.com/sistema/scripts/index.vbs' >" & vbcrlf
    h=h & "</script>" & vbcrlf
 
    h=h & "</head><body  >" & vbcrlf
    
   op=h & "<font class='temas'>Escolha o seu estilo preferido.</font>"
   op=op & "<form name='opcoes' id='opcoes' >"  
   op=op & "<select name='estilo_preferido' id='estilo_preferido' onchange="
   op=op & chr(34) & "  parent.mostrar_estilo()"
   op=op & chr(34) & " >"
   op=op & "<option value='estilo_geral.css' >Estilo Geral</option>"
   op=op & "<option value='estilo_primavera.css' >Estilo Primavera</option>"
   op=op & "<option value='estilo_flores.css' >Estilo Flores</option>"
   op=op & "<option value='estilo_preto.css' >Estilo Preto</option>"
   op=op & "<option value='estilo_cinzentos.css' >Estilo Cinzentos</option>"
   op=op & "<option value='estilo_fruta.css' >Estilo Fruta</option>"
   op=op & "<option value='estilo_arvore.css' >Estilo Arvore </option>" 
   op=op & "<option value='estilo_azulado.css' >Estilo Azulado </option>"   
   op=op & "<option value='estilo_azulado1.css' >Estilo Azulado1 </option>"     
   op=op & "<option value='estilo_avermelhado.css' >Estilo Avermelhado </option>"
   op=op & "<option value='estilo_avermelhado1.css' >Estilo Avermelhado1 </option>" 
   op=op & "<option value='estilo_avermelhado2.css' >Estilo Avermelhado2 </option>"
   op=op & "<option value='estilo_primavera_apresentacao.css' >Estilo Primavera apresentação</option>"
   op=op & "<option value='estilo_verao.css' >Estilo Verão </option>"
   op=op & "<option value='estilo_outono.css' >Estilo Outono </option>"
   op=op & "<option value='estilo_inverno.css' >Estilo Inverno </option>"
   op=op & "<option value='estilo_contemporaneo.css' >Estilo Contemporâneo </option>"
   op=op & "<option value='estilo_natal.css' >Estilo Natal </option>"
   op=op & "<option value='estilo_fim_de_ano.css' >Fim de Ano</option>"
   op=op & "<option value='estilo_fim_de_ano2.css' >Fim de Ano2</option>"
   op=op & "</select><br><br>"
   op=op & "<button onclick='parent.fixar_estilo_cliente()'>Confirmar o seu estilo preferido</button><br><br><br>"
 

   op=op & "</form>"


   set  janela=Window.createPopup()
                janela.document.write op
         
                janela.show 800,110,300,240  ' horizontal, vertical, largura e altura
                janela_status=true
             
   
 
 
  
   
End Function 
'***********************************************************************************************
Public Function fechar_pagina_de_opcoes()
   op="<a href='' onclick="
   op=op & chr(34) & "call abrir_pagina_de_opcoes()"
   op=op & chr(34) & " >"
   op=op & "Opções</a>"
    pagina_de_opcoes.innerHTML=op


End Function
'****************************************************************************************** 

Private Function fontenoticia(texto)

Dim p1
Dim p2


p1=instr(1,texto," ")

if p1=0 then

   exit function

end if

p2=instr(p1+1,texto,",")

if p2=0 then

   exit function

end if


fontenoticia=mid(texto,p1+1,p2-p1-1)


end function

'**********************************************************************************************
Public Function mostrar_calendario()

   h="<HTML XMLNS:IE>"
h=h & "<HEAD>"
h=h & "<STYLE>"
h=h & "@media all{"
h=h & "   IE\:Calendar{"
h=h & "      behavior: url(./behaviors/calendar/calendar.htc) ;"

h=h & "   }"
h=h & "}"
h=h & "</STYLE>"
h=h & "</HEAD>"
h=h & "<BODY bgcolor='yellow' >"
h=h & "<IE:Calendar"
h=h & "   ID = 'cal'"
h=h & "   STYLE = " & chr(34) & "width: 300; height: 275; border: '1px solid black';" & chr(34) & ">"
h=h & "</IE:Calendar>"
h=h & "</BODY>"
h=h & "</HTML>"

     call mostrar_janela(h)

End Function    

'*********************************************************************************************
