/**************************************/
/***Abre uma janela de browser comum***/
/**************************************/
function openWindow(width, height, url, name){
	/*
	Obs.:
	O valor mínimo para width é 100 pixels
	O valor mínimo para height é 100 pixels
	*/
	vLeft = centerSeg(width,800)
	vTop = centerSeg(height,600)
	sFeatures = "width=" + width + ",height=" + height 
	sFeatures = sFeatures + ",left=" + vLeft + ",top=" + vTop + ",fullscreen=no,resizeble=no"
	sFeatures = sFeatures + ",location=no,menubar=no,scrollbars=no,status=yes,toolbar=no"
	window.open(url,name,sFeatures)
}
/**************************************************/
/***Abre uma janela de browser comum com rolagem***/
/**************************************************/
function openWindowScr(width, height, url, name){
	/*
	Obs.:
	O valor mínimo para width é 100 pixels
	O valor mínimo para height é 100 pixels
	*/
	vLeft = centerSeg(width,800)
	vTop = centerSeg(height,600)
	sFeatures = "width=" + width + ",height=" + height 
	sFeatures = sFeatures + ",left=" + vLeft + ",top=" + vTop + ",fullscreen=no,resizeble=no"
	sFeatures = sFeatures + ",location=no,menubar=no,scrollbars=yes,status=no,toolbar=no"
	window.open(url,name,sFeatures)
}
/*****************************************************/
/***Abre uma janela de browser que não perde o foco***/
/*****************************************************/
function openModal(width, height, url){
	/*
	Obs.:
	Para retirar a scrollbar da página, atribuir o valor "false" para a propriedade "scroll" no elemento "<body>" da página
	*/	
	sFeatures = "dialogWidth=" + width + "px,dialogHeight=" + height + "px"
	sFeatures = sFeatures + ",center=yes,help=yes,resizable=no"
	sFeatures = sFeatures + "status=no"
	windowValue = window.showModalDialog(url,null,sFeatures)			
	return windowValue	
}
/***********************************************************************/
/***Abre uma janela de browser que perde o foco mas não fica por trás***/
/***********************************************************************/
function openModeless(width, height, url){
	/*
	Obs.:
	Para retirar a scrollbar da página, atribuir o valor "false" para a propriedade "scroll" no elemento "<body>" da página
	*/
	sFeatures = "dialogWidth=" + width + "px,dialogHeight=" + height + "px"
	sFeatures = sFeatures + ",center=yes,help=yes,resizable=no,scroolbars=no"
	sFeatures = sFeatures + "status=no"
	window.showModelessDialog(url,null,sFeatures)
}
/************************************************************************/
/********Calcula a margem anterior para centralizar um seguimento********/
/************************************************************************/
function centerSeg(segSize, spaceSize){
	if(segSize >= spaceSize){
		margin = 0
	} else {
		margin = parseInt(( (spaceSize - segSize) / 2) - 1)
	}
	return margin
}
/**************************************/
/***Cria Botão Padrão do Sistema	***/
/**************************************/
function newButton(type,name,value,click){
	document.write("<table cellpadding=0 cellspacing=0 border=0 height=18 class=button>")
	document.write("<tr><td height=18>")
	document.write("<img src='http://www.abf.com.br/adm/img/btgbL.gif'>")
	document.write("</td>")
	document.write("<td background='http://www.abf.com.br/adm/img/btgb.gif'>")
	document.write("<input type='" + type + "' name='" + name + "' value='" + value + "' onclick=" + click + ">")
	document.write("</td>")
	document.write("<td>")
	document.write("<img src='http://www.abf.com.br/adm/img/btgbR.gif'>")
	document.write("</td>")
	document.write("</tr>")
	document.write("</table>")
}
/**************************************/
/***Prompt de Confirmação 			***/
/**************************************/
function conf(cnfText,cnfUrl){
	resp = window.confirm(cnfText)
	if(resp){
		window.navigate(cnfUrl)
	}
}

/**************************************/
/***Primir                			***/
/**************************************/
function imprimir()
{
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (NS)
  {
    window.print() ;
  }
  else

  {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);
    WebBrowser1.outerHTML = "";
  }
}


/**************************************/
/***Primir                			***/
/**************************************/
function favoritos(Nome,Url)
{
  window.external.AddFavorite(Url,Nome);
 };
 
 
/**************************************/
/***data               			***/
/**************************************/
 function data()

{
  day = new Date()
  num_dia = day.getDate()
  dia = day.getDay()+1
  mes = day.getMonth()+1
  ano = day.getYear()
  if (dia ==1)
    document.write("Domingo, ")
  if (dia ==2)
    document.write("Segunda-feira, ")
  if (dia ==3)
    document.write("Terça-feira, ")
  if (dia ==4)
    document.write("Quarta-feira, ")
  if (dia ==5)
    document.write("Quinta-feira, ")
  if (dia ==6)
    document.write("Sexta-feira, ")
  if (dia ==7)
    document.write("Sábado, ")

  document.write(num_dia," de ")
  if (mes ==1)
    document.write("janeiro")
  if (mes ==2)
    document.write("fevereiro")
  if (mes ==3)
    document.write("março")
  if (mes ==4)
    document.write("abril")
  if (mes ==5)
    document.write("maio")
  if (mes ==6)
    document.write("junho")
  if (mes ==7)
    document.write("julho")
  if (mes ==8)
    document.write("agosto")
  if (mes ==9)
    document.write("setembro")
  if (mes ==10)
    document.write("outubro")
  if (mes ==11)
    document.write("novembro")
  if (mes ==12)
    document.write("dezembro")

  document.write(" de ",ano)

 };
 
 
 function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);




/**************************************/
/***no Clik na imagem              			***/
/**************************************/

var clickmessage="Imagem não disponivel para cópia"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()


