// FUNÇÃO RANDOM //
function random(r1,r2){return Math.round(Math.random()*(r2-r1))+ (r2>r1?r1:r2);}

//FUNÇÕES PARA SWAP DE IMAGENS
function swapImg(img,type){var o=document.images[img];o.src=o.src.replace(/_[^._]*.([^.]*)$/,'_'+type+'.$1');}
function preloadImg(){
	var lnk=document.links;
	for(var i in lnk){
		var res=/swapImg\(\\?['|"]([^'\\"]*)\\?['|"]\,\\?['|"]([^'\\"]*)\\?['|"]\)/.exec(lnk[i].onmouseover);
		if(res){var img=document.images[res[1]],x=new Image();x.src=img.src.replace(/_out.(.*$)/,'_'+res[2]+'.$1');} 
	}
}
//FUNÇÕES PARA ABERTURA DE LINKS
function Win(w,h){this.width=w;this.height=h;this.top=0;this.left=0;}
function openLink(parms){
	if(parms=='')return;
	var rnd='',aP=parms.split(';'),ftr='titlebar=yes';
	r=random(1,10000);
	if(parms.indexOf('?')==-1){j='?'}else{j='&'}
	if((/\..*htm.*/.test(aP[0])||/\..*cgi.*/.test(aP[0])||/.\/$/.test(aP[0]))&&!/#/.test(aP[0]))rnd=j+'rnd='+r;
	if(aP.length==1){location.href=parms+rnd;return;}
	var prm=aP[1].split(',');
	switch(prm[0]){
		case 'ib':
			var w=new Win(790,523);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';			
			r='';
			break;
		case 'app':
			var w=new Win(790,523);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';			
			break;
		case 'app_s':
			var w=new Win(790,535);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';	w.scrollbars='yes';
			break;
		case 'popup':
			w=new Win(prm[1],prm[2]);w.scrollbars='yes';
			w.resizable='yes';
			break;
		case 'opener':
			w=opener;
			w.location.replace(aP[0]+rnd);
			w.focus();
			return;
		case 'opener_f':
			w=parent.opener;
			w.location.replace(aP[0]+rnd);
			w.focus();
			return;
		case 'new':
			var w=new Win(790,400),rnd='';
			w.resizable='yes';w.menubar='yes';w.location='yes';w.scrollbars='yes';w.toolbar='yes';w.status='yes';
			break;
		case 'seguros':
			var w=new Win(797,414);
			w.location='no';w.status='yes';w.scrollbars='yes';w.resizable='yes';w.top='0';w.left='0';
			break;
		case 'hotsite':
			w=new Win(prm[1],prm[2]);
			break;
		case 'hotsite_st':
			w=new Win(prm[1],prm[2]);
			w.status='yes'
			break;
		case 'popup_st':
			w=new Win(prm[1],prm[2]);w.scrollbars='yes';w.status='yes';
			w.resizable='yes';
			break;
	}
	for(var i in w)ftr+=','+i+"="+ w[i];
	var jan=window.open(aP[0]+rnd,'HSBC'+r,ftr);
	return;
}
//criada para atender includes DocPost
function openDoc(url){openLink(url+';popup,640,480');return false;}

//CÓDIGO PARA CHAMADA DO IB
function validaTecla(campo,event){
	var BCK=8,ETR=13,key,tecla;CheckTAB=true;
	if(event.which)tecla=event.which;
	else tecla=event.keyCode;
	key=String.fromCharCode(tecla);
	if(tecla==ETR)return false;
	if(tecla==BCK)return true;
	return(/[0-9]/.test(key));
}

function startIB(endereco){
var f=document.forms.f_ib.CONTAHSBC,rsz='yes';
if(f.value.length!=11){
	alert("HSBC BANK BRASIL S.A. - BANCO MÚLTIPLO\n\nO campo Agência e Conta deve ser totalmente preenchido (11 dígitos).");
	return false;
}
openLink("/cgi-bin/cb_redirect.cgi?ID=IB&FROM="+endereco+"&PARMS="+escape('CONTAHSBC='+f.value)+"&CANAL=internet;ib");
f.value='';
}

function startConnect(){
var f=document.cb;
openLink("http://www.hsbc.com.br/cgi-bin/cb_redirect.cgi?ID=connect&PARMS=chempresa="+f.chemp.value+"%26choperador="+f.choper.value+";ib");
f.chemp.value="";
f.choper.value="";
}

// Meu HSBC
function startIBMeuHSBC(endereco){
var f=document.forms.f_ib.CONTAHSBC,rsz='yes';
if(f.value.length!=11){
        alert("HSBC BANK BRASIL S.A. - BANCO MÚLTIPLO\n\nO campo Agência e Conta deve ser totalmente preenchido (11 dígitos).");
        document.f_ib.CONTAHSBC.focus();
        return false;
}
var fr = document.getElementById("frame_i");
fr.src="/cgi-bin/cb_redirect.cgi?ID=MeuHSBC&PARMS="+escape('CONTAHSBC='+f.value)+"&CANAL=internet;ib";
f.value='';
document.f_ib.CONTAHSBC.focus();
}

// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	//alert(version)
	return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

var temFlash = DetectFlashVer(8, 0, 0);


/*FUNCOES PARA EXPANDIR O FLASH*/
_arrSel = document.getElementsByTagName("SELECT");
function _hidePredObj(ig,s){
_s=(s == false)?"hidden":"visible";
	for(i = 0; i < _arrSel.length; i++){
		try{
			if(!_arrSel[i].form.name.indexOf(ig)){
				_arrSel[i].style.visibility=_s;
				}
		}catch(e){
			_arrSel[i].style.visibility=_s
				}
	}
}
function _gOJ(s){if(document.layers){return document.layers[s];}else if(document.all && !document.getElementById) {return document.all[s];}else {return document.getElementById(s);}}
function _eXp(s,x,y,h){
_o = _gOJ(s);
_o.style.clip = 'rect(0px '+x+'px '+y+'px 0px)';
_hidePredObj('',h);
}
function _eXpDSec(s,dir,bot,h,esq,t,z,p){
_o = _gOJ(s);
document.getElementById(s).style.clip = 'rect('+t+'px '+dir+'px '+bot+'px '+esq+'px)';
document.getElementById(s).style.zIndex= z;
document.getElementById(p).style.zIndex= z;
_hidePredObj('',h);
}
function abreDiv(divName){
	document.getElementById(divName).className = 'abre';
}
function abreDivTempo(divName, tempo){
	document.getElementById(divName).className = 'abre';
	tempo_img = tempo*1000;
	setTimeout("tiraFloat('"+ divName +"');",tempo_img);
}
function tiraFloater(divName){
	document.getElementById(divName).className = 'fecha';
}
function tiraFloat(divName){
	document.getElementById(divName).className = 'fecha';
}
function montaFloaterPrinc(id,arrBase,varrandom,floater,zindex,flash_transp,classFlash,classImg){
linux = navigator.userAgent.indexOf("Linux")>-1;
ie = navigator.userAgent.indexOf("MSIE")>-1;
opera = navigator.userAgent.indexOf("Opera")>-1;
vFlash = true;
if(flash_transp=="S" && !ie) vFlash = false;
	if((flash())&&arrBase[varrandom][0]!=''&& !linux && vFlash && !opera){
		div = '<div id="'+ id +'" class="' + classFlash +'"';
		if(floater) div += ' style="position:absolute;left:'+ arrBase[varrandom][8] +'px;top:'+ arrBase[varrandom][9] +'px;width:'+ arrBase[varrandom][10] +'px;height:'+ arrBase[varrandom][11] +'px;z-index:'+ zindex +';';
		div += '">';
		document.writeln(div);
		document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+ arrBase[varrandom][10] + '" height="' + arrBase[varrandom][11] + '" id="'+ arrBase +'" align="middle">');
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
		document.writeln('<param name="movie" value="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" />');
		document.writeln('<param name="quality" value="high" />');
		document.writeln('<param name="wmode" value="transparent" />');
		document.writeln('<param name="bgcolor" value="#ffffff" />');
		document.writeln('<embed src="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" quality="high" bgcolor="#ffffff" width="'+ arrBase[varrandom][10] + '" height="' + arrBase[varrandom][11] + '" name="'+ arrBase +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
		document.writeln('</object>');
	}
	else{
		if(floater){
			tempo = arrBase[varrandom][16];
			tempo_img = tempo*1000;
			setTimeout("tiraFloater('"+ id +"');",tempo_img);
		}
		div = '<div id="'+ id +'" class="' + classImg +'"';
		if(floater) div += ' style="position:absolute;left:'+ arrBase[varrandom][12] +'px;top:'+ arrBase[varrandom][13] +'px;width:'+ arrBase[varrandom][14] +'px;height:'+ arrBase[varrandom][15] +'px;z-index:'+ zindex +';';
		div += '">';
		document.writeln(div);
		if(arrBase[varrandom][6]=="S"){
			document.writeln('<img src="'+ arrBase[varrandom][3] +'" usemap="#'+ arrBase[varrandom][7] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" />');
		}
		else{
			if(arrBase[varrandom][4]!=""){
				img = '<a href="'+ arrBase[varrandom][4] +'"><img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" alt="'+ arrBase[varrandom][5] +'" /></a>';
				document.writeln(img);
			}
			else{
				document.writeln('<img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" alt="'+ arrBase[varrandom][5] +'" />');
			}
		}
	}
	document.writeln('</div>');
}
function montaFloaterSecPrinc(id,arrBase,varrandom,floater,zindex,flash_transp,classFlash,classImg,usaTempo){
linux  = navigator.userAgent.indexOf("Linux")>-1;
ie     = navigator.userAgent.indexOf("MSIE")>-1;
opera  = navigator.userAgent.indexOf("Opera")>-1;
vFlash = true;

	if(flash_transp=="S" && !ie) vFlash = false;
	if ( (flash()) && arrBase[varrandom][0]!='' && !linux && vFlash && !opera)
	{
  		div = '<div id="'+ id +'" class="' + classFlash +'"';
		if (floater) 
			div += ' style="position:absolute;left:'+ arrBase[varrandom][8] +'px;top:'+ arrBase[varrandom][9] +'px;width:'+ 
					arrBase[varrandom][10] +'px;height:'+ arrBase[varrandom][11] +'px;z-index:'+ zindex +';';
		div += '">';
		document.writeln(div);
		document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+   arrBase[varrandom][10] + '" height="' + arrBase[varrandom][11] + '" id="'+id+'" align="middle">');
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />\n');
		document.writeln('<param name="movie" value="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" />\n');
		document.writeln('<param name="quality" value="high" />\n');
		document.writeln('<param name="wmode" value="transparent" />\n');
		document.writeln('<param name="bgcolor" value="#ffffff" />\n');
		document.writeln('<embed src="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'"'); 
		document.writeln('quality="high" bgcolor="#ffffff" width="'+ arrBase[varrandom][10] + '\n" height="' + arrBase[varrandom][11] + '"');
		document.writeln('name="'+id+'" swLiveConnect="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />\n');
		document.writeln('</object>');
	}
	else{
		if(floater && usaTempo){
			tempo = arrBase[varrandom][16];
			tempo_img = tempo*1000;
			setTimeout("tiraFloater('"+ id +"','');",tempo_img);
		}
		div = '<div id="'+ id +'" class="' + classImg +'"';
		if(floater) div += ' style="position:absolute;left:'+ arrBase[varrandom][12] +'px;top:'+ arrBase[varrandom][13] +'px;width:'+ arrBase[varrandom][14] +'px;height:'+ arrBase[varrandom][15] +'px;z-index:'+ zindex +';';
		div += '">';
		document.writeln(div);
		if(arrBase[varrandom][6]=="S"){
			
			document.writeln('<img src="'+ arrBase[varrandom][3] +'" usemap="#'+ arrBase[varrandom][7] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" />');
		}
		else{
			if(arrBase[varrandom][4]!=""){
				img = '<a href="'+ arrBase[varrandom][4] +'"><img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" alt="'+ arrBase[varrandom][5] +'" /></a>';
				document.writeln(img);
			}
			else{
				document.writeln('<img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][14] + '" height="' + arrBase[varrandom][15] + '" border="0" alt="'+ arrBase[varrandom][5] +'" />');
			}
		}
	}
	document.writeln('</div>');
}
function montaDestSec(id,arrBase,varrandom,classFlash,classImg){
linux = navigator.userAgent.indexOf("Linux")>-1;
ie = navigator.userAgent.indexOf("MSIE")>-1;
opera = navigator.userAgent.indexOf("Opera")>-1;
	if((flash())&&arrBase[varrandom][0]!=''&& !linux && !opera){
		div = '<div id="'+id+'" class="'+classFlash+'">';
		document.writeln(div);
		document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+ arrBase[varrandom][6] + '" height="' + arrBase[varrandom][7] + '" id="'+ arrBase +'" align="middle">');
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
		document.writeln('<param name="movie" value="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" />');
		document.writeln('<param name="quality" value="high" />');
		document.writeln('<param name="wmode" value="transparent" />');
		document.writeln('<param name="bgcolor" value="#ffffff" />');
		document.writeln('<embed src="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" quality="high" bgcolor="#ffffff" width="'+ arrBase[varrandom][6] + '" height="' + arrBase[varrandom][7] + '" name="'+ arrBase +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
		document.writeln('</object>');
		document.writeln('</div>');
	}
	else{
			if(arrBase[varrandom][4]!=""){
				img = '<a href="'+ arrBase[varrandom][4] +'"><img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][8] + '" height="' + arrBase[varrandom][9] + '" border="0" alt="'+ arrBase[varrandom][5] +'" /></a>';
				document.writeln(img);
			}
			else{
				document.writeln('<img src="'+ arrBase[varrandom][3] +'" width="'+ arrBase[varrandom][8] + '" height="' + arrBase[varrandom][9] + '" border="0" alt="'+ arrBase[varrandom][5] +'" />');
			}
		}
}

function montaFlash(arrBase, varrandom, w, h, id, bg, wmode, classFlash, classImg){
	if((flash())&&arrBase[varrandom][0]!=''){
		if(classFlash) document.writeln('<div class="' + classFlash + '">');
		document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+ w + '" height="' + h + '" id="' + id + '" align="middle">');
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
		document.writeln('<param name="movie" value="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" />');
		document.writeln('<param name="quality" value="high" />');
		document.writeln('<param name="wmode" value="'+ wmode +'" />');
		document.writeln('<param name="bgcolor" value="'+ bg + '" />');
		document.writeln('<embed src="'+ arrBase[varrandom][0] +'?link1='+ arrBase[varrandom][1] +'&link2='+ arrBase[varrandom][2] +'" quality="high" bgcolor="' + bg + '" width="'+ w + '" height="' + h + '" name="' + id + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="'+ wmode +'" />');
		document.writeln('</object>');
		if(classFlash) document.writeln('</div>');
		}
	else{
		if(arrBase[varrandom][6]=="S"){
			if(classImg) document.writeln('<div class="' + classImg + '">');
			document.writeln('<img src="'+ arrBase[varrandom][3] +'" usemap="#'+ arrBase[varrandom][7] +'" width="'+ w + '" height="' + h + '" border="0" />');
			if(classImg) document.writeln('</div>');
		}
		else{
			if(arrBase[varrandom][4]!=""){
				if(classImg) document.writeln('<div class="' + classImg + '">');
				document.writeln('<a class="linkImagem" href="'+ arrBase[varrandom][4] +'"><img src="'+ arrBase[varrandom][3] +'" width="'+ w + '" height="' + h + '" border="0" alt="'+ arrBase[varrandom][5] +'" /></a>');
				if(classImg) document.writeln('</div>');
			}
			else{
				if(classImg) document.writeln('<div class="' + classImg + '">');
				document.writeln('<img src="'+ arrBase[varrandom][3] +'" width="'+ w + '" height="' + h + '" border="0" alt="'+ arrBase[varrandom][5] +'" />');
				if(classImg) document.writeln('</div>');
			}
		}
	}
}

// FUNÇÃO PARA SWAP DE IMAGEM //
function wImg(dirImg,img,alt,map,link,dirSwf,swf,w,h){
var wImg=dirImg+img,wSwf=dirSwf+swf;
if(link!=""){document.write("<a href=javascript:void(openLink('"+link+"'))><img src='"+wImg+"' width='"+w+"' height='"+h+"' "+(map!=""?"usemap='"+map+"'":"")+" border='0' alt='"+alt+"'></a>");
}else{document.write("<img src='"+wImg+"' width='"+w+"' height='"+h+"' "+(map!=""?"usemap='"+map+"'":"")+" border='0' alt='"+alt+"'>");}
}

// FUNÇÕES DAS FERRAMENTAS ÚTEIS DA HOME //
function makeHome(url){var o=document.body;o.style.behavior="url(#default#homePage)";o.setHomePage(url);}
function addFavorite(url,name){window.external.AddFavorite(url,name);}

// FUNÇÕES PARA AUMENTAR E DIMINUIR FONTE //
var fontSize = 16;
var fMax = 18;
var fMin = 16;
var inc = 1;

function setFontSize() {
	var tempSize = getCookie("fontSize");
	if((tempSize != null) && (tempSize >= fMin) && (tempSize <= fMax)) {
		fontSize = tempSize;
	} else {
		setCookie("fontSize", fontSize, "", "/");
	}
	document.body.style.fontSize = fontSize + "px";
}

function changeFontSize(increment) {
	if(increment) {
		fontSize=parseInt(fontSize) + parseInt(inc);
	} else {
		fontSize=parseInt(fontSize) - parseInt(inc);
	}

	if(fontSize > fMax) {
		fontSize = fMax;
	}
	if(fontSize < fMin) {
		fontSize = fMin;
	}
	document.body.style.fontSize = fontSize + "px";
	setCookie('fontSize', fontSize, "", "/");
}

function incrementFontSize() {
	changeFontSize(true);
}

function decrementFontSize() {
	changeFontSize(false);
}

// FUNÇÕES PARA LER E GRAVAR COOKIE //
//  $Header: /aplic/ITED/src/repository/aplic/ITED/www/htdocs/common/scripts/cookie.js,v 1.4 2003-01-30 09:21:32-02 e007413 EP $
function setCookie(name,value,dexp,path,domain,secure){
var expires=dexp;
if(typeof expires=="number"){expires=new Date();fixDate(expires);expires.setTime(expires.getTime()+dexp*60*60*1000);}
var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");
document.cookie=curCookie;
}
function getCookie(name){
var dc=document.cookie,prefix=name+"=",begin=dc.indexOf(prefix);
if(begin==-1)return null;
var end=document.cookie.indexOf(";",begin);
if(end==-1)end=dc.length;
return unescape(dc.substring(begin+prefix.length,end));
}
function deleteCookie(name,path,domain){
if(getCookie(name)){document.cookie=name+"="+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}
}
function verifyCookie(){
var valor,flag=0,nomeCookie="STCV";
setCookie(nomeCookie,"ligado");
if(getCookie(nomeCookie)!=null){flag=0;valor=1;deleteCookie(nomeCookie);
}else{if(!flag){flag=1;deleteCookie(nomeCookie);valor=0;}}
return valor;
}
function fixDate(date){
var base=new Date(0),skew=base.getTime();
if(skew>0)date.setTime(date.getTime()-skew);
}


// FUNCOES PARA TROCAR TEXTO DO IB POR IMAGEM
function MM_findObj(n, d) {
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function modo(e, sinal) {
	resp = MM_findObj(e);
	if(sinal) {
		resp.className = "abre";
	} else {
		resp.className = "fecha";
	}
}

function swap(conta, e01, e02, maxSz) {

	if((conta.value.length!=maxSz)) {
		modo(e01, true);
		modo(e02, false);
	} else {
		modo(e01, false);
		modo(e02, true);
	}
}
function flashMe(id,src,width,height,wmode){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" height="'+height+'" width="'+width+'" name="'+id+'" id="'+id+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+src+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="" />');
	document.write('<param name="wmode" value="'+wmode+'" />');
	document.write('<embed src="'+src+'" height="'+height+'" width="'+width+'" name="'+id+'" id="'+id+'" align="middle" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="'+wmode+'" />');
	document.write('</object>');
}