﻿window.status = 'GALENA - Química e Farmacêutica ltda';

// JScript File
function ConfirmaExclusao(pMsg){
    return confirm(pMsg);
}

function MenuRolloverOn(pObjeto, pOpcao) {
    window.document[pObjeto].src = '/img/menu/' + pOpcao + 'On.jpg';
}

function MenuRolloverOff(pObjeto) {
    window.document[pObjeto].src = '/img/layout/pixel.gif';
}

function SubMenuRolloverOn(pObjeto, pObjetoPai, pOpcao, pOpcaoPai) {
    window.document[pObjeto].src = '/img/menu/' + pOpcao + 'On.jpg';
    window.document[pObjetoPai].src = '/img/menu/' + pOpcaoPai + 'On.jpg';
}

function SubMenuRolloverOff(pObjeto, pObjetoPai, pOpcao, pOpcaoPai) {
    window.document[pObjeto].src = '/img/menu/' + pOpcao + 'Off.jpg';
    window.document[pObjetoPai].src = '/img/layout/pixel.gif';
}


function MenuAdminFilhos(idPai)
{
  var oTr   = document.getElementById('tr_' + idPai);
  var oImg  = document.getElementById('img_' + idPai);
  if(oImg.src.toString().indexOf('IcoAbre') != -1)
  {
    oTr.style.display = '';
    oImg.src = '/Admin/img/layout/IcoFecha.jpg';
  }else{
    oTr.style.display = 'none';
    oImg.src = '/Admin/img/layout/IcoAbre.jpg';
  } 
}
  
function MostraMeses(pAno, pAnoMax, pAnoMin)
{
    var d = document.getElementById(pAno);
  
    if (d.style.display == '')
    {
      	for (var i = pAnoMax; i >= pAnoMin; i--) {
		if (document.getElementById(i)) {document.getElementById(i).style.display='none';}
        }
    }
    else
    {
        for (var i = pAnoMax; i >= pAnoMin; i--) {
		if (document.getElementById(i)) {document.getElementById(i).style.display='none';}
        }
        d.style.display='';
    }
}

function DetalheCaminho(pCaminho)
{
    var d = document.getElementById(pCaminho);
  
    if (d.style.display == '')
    {
      	for (var i = 1; i <= 4; i++) {
		if (document.getElementById(i)) {document.getElementById(i).style.display='none';}
        }
    }
    else
    {
        for (var i = 1; i <= 4; i++) {
		if (document.getElementById(i)) {document.getElementById(i).style.display='none';}
        }
        d.style.display='';
    }
}


function validacpf()
{  
    var i;       
    s = document.getElementById('ctl00_cphConteudo_txtCPF').value;       
    var c = s.substr(0,9);       
    var dv = s.substr(9,2);       
    var d1 = 0;       
    for (i = 0; i < 9; i++)       
    {       
        d1 += c.charAt(i)*(10-i);      
    } 
      
    if (d1 == 0)
    {       
        alert("CPF Inválido");       
        return false;       
    } 
      
    d1 = 11 - (d1 % 11);      
    if (d1 > 9) d1 = 0;       
    if (dv.charAt(0) != d1)      
    {       
        alert("CPF Inválido");      
        return false;      
    }      
      
    d1 *= 2;       
    for (i = 0; i < 9; i++)       
    {       
        d1 += c.charAt(i)*(11-i);       
    } 
      
    d1 = 11 - (d1 % 11);       
    if (d1 > 9) d1 = 0;       
    if (dv.charAt(1) != d1)      
    {       
        alert("CPF Inválido");      
        return false;      
    }       
    return true;   
} 


function FichaDivulgacao(pWidth, pHeight, CodConteudo) {

var width =pWidth;
var height =pHeight;

var left = ((screen.width)/2)-(pWidth/2);
var top = ((screen.height)/2)-(pHeight/2);
window.open('MagistralDocumentCenterFDUploadLogo.aspx' + '?cod=' + CodConteudo,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+' status=yes,toolbar=no,location=no,titlebar=no,directories=no,menubar=no,resizable=no');
}

function VideoTreinamento(pWidth, pHeight, CodConteudo) {

var width =pWidth;
var height =pHeight;

var left = ((screen.width)/2)-(pWidth/2);
var top = ((screen.height)/2)-(pHeight/2);
window.open('MagistralDocumentCenterExibeVideo.aspx' + '?cod=' + CodConteudo,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+' status=yes,toolbar=no,location=no,titlebar=no,directories=no,menubar=no,resizable=yes');
}

function fAbreVideoEnglish(pWidth, pHeight){
var width =pWidth;
var height =pHeight;

var left = ((screen.width)/2)-(pWidth/2);
var top = ((screen.height)/2)-(pHeight/2);
window.open('EnglishGetVideo.aspx','video', 'width='+width+', height='+height+', top='+top+', left='+left+' status=yes,toolbar=no,location=no,titlebar=no,directories=no,menubar=no,resizable=yes');

}


