var objBrow,LAST_ERR_VALUE="";
var ERRO=REPET_ERR=false;
var LAST_FIELD=CURRENT_FIELD=LAST_ERR_FIELD=null;
var SZ_DATE=8,
SZ_MONEY=10,
SZ_CONTACORRENTE=6,
SZ_AGENCIA=4,
SZ_FLOAT=10,
SZ_MONTH_YEAR=6,
SZ_TIME=4,
MAX_VALUE=9999999.99;



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// description: draggable modal windows
// coding: softcomplex.com
// data: 09/21/2007

var N_BASEZINDEX =10000;
var RE_PARAM = /^\s*(\w+)\s*\=\s*(.*)\s*$/;

// this function makes the document numb to the mouse events by placing the transparent layer over it
function f_putScreen (b_show) {

	if (b_show == null && !window.b_screenOn)
		return;

	if (!b_show) {
		//window.b_screenOn = false;
		if (e_screen) {
            e_screen.style.display = 'none';

            // attach event
            if (document.removeEventListener) {
                document.removeEventListener('mousemove', f_dragProgress, false);
                window.removeEventListener('resize', f_putScreen, false);
                window.removeEventListener('scroll', f_putScreen, false);
            }
            if (window.detachEvent) {
                document.detachEvent('onmousemove', f_dragProgress);
                window.detachEvent('onresize', f_putScreen);
                window.detachEvent('onscroll', f_putScreen);
            }
            else {
                document.onmousemove = undefined;
                window.onresize = undefined;
                window.onscroll = undefined;
            }
            document.body.removeChild(e_screen);
            window.e_screen = null;
        }
        return;
	}

	// create the layer if doesn't exist
	if (window.e_screen == null) {
        window.e_screen = document.createElement("div");
		e_screen.innerHTML = "&nbsp;";
		document.body.appendChild(e_screen);

		e_screen.style.position = 'absolute';
		e_screen.id = 'eScreen';

		// attach event
		if (document.addEventListener) {
			document.addEventListener('mousemove', f_dragProgress, false);
			window.addEventListener('resize', f_putScreen, false);
			window.addEventListener('scroll', f_putScreen, false);
		}
		if (window.attachEvent) {
			document.attachEvent('onmousemove', f_dragProgress);
			window.attachEvent('onresize', f_putScreen);
			window.attachEvent('onscroll', f_putScreen);
		}
		else {
			document.onmousemove = f_dragProgress;
			window.onresize = f_putScreen;
			window.onscroll = f_putScreen;
		}
	}

	// set properties
	var a_docSize = f_documentSize();
	e_screen.style.left = a_docSize[2] + 'px';
	e_screen.style.top = a_docSize[3] + 'px';
	e_screen.style.width = a_docSize[0] + 'px';
	e_screen.style.height = a_docSize[1] + 'px';
	e_screen.style.zIndex = N_BASEZINDEX + a_windows.length * 2 - 1;
	e_screen.style.display = 'block';
}

// returns the size of the document
function f_documentSize () {

var n_scrollX = 0,
	n_scrollY = 0;

	if (typeof(window.pageYOffset) == 'number') {
		n_scrollX = window.pageXOffset;
		n_scrollY = window.pageYOffset;
	}
	else if (document.body && (document.body.scrollLeft || document.body.scrollTop )) {
		n_scrollX = document.body.scrollLeft;
		n_scrollY = document.body.scrollTop;
	}
	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
		n_scrollX = document.documentElement.scrollLeft;
		n_scrollY = document.documentElement.scrollTop;
	}

	if (typeof(window.innerWidth) == 'number')
		return [window.innerWidth, window.innerHeight, n_scrollX, n_scrollY];
	if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		return [document.documentElement.clientWidth, document.documentElement.clientHeight, n_scrollX, n_scrollY];
	if (document.body && (document.body.clientWidth || document.body.clientHeight))
		return [document.body.clientWidth, document.body.clientHeight, n_scrollX, n_scrollY];
	return [0, 0];
}

function f_dialogOpenDiv (divToShow, s_title, s_features) {
    if (!window.a_windows)
		window.a_windows = [];

	// parse parameters
	var a_featuresStrings = s_features.split(',');
	var a_features = [];
	for (var i = 0; i < a_featuresStrings.length; i++)
		if (a_featuresStrings[i].match(RE_PARAM))
			a_features[String(RegExp.$1).toLowerCase()] = RegExp.$2;

	// create element for window
	var n_nesting = a_windows.length;

	var e_window = document.createElement("div");
	e_window.style.position = 'absolute';
	var n_width  = a_features.width  ? parseInt(a_features.width)  : 300;
	var n_height = a_features.height ? parseInt(a_features.height) : 200;
	var a_docSize = f_documentSize ();
	e_window.style.left = (a_features.left ? parseInt(a_features.left) : ((a_docSize[0] - n_width)  / 2) + a_docSize[2]) + 'px';
	e_window.style.top  = (a_features.top  ? parseInt(a_features.top)  : ((a_docSize[1] - n_height) / 2) + a_docSize[3]) + 'px';
	e_window.style.zIndex = N_BASEZINDEX + a_windows.length * 2 + 2;

      var flashes = [];
    flashes = document.getElementsByTagName("object");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "hidden";
    }

    var select = [];
    flashes = document.getElementsByTagName("select");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "hidden";
    }

    e_window.innerHTML = divToShow.innerHTML;
	document.body.appendChild(e_window);
	a_windows[n_nesting] = e_window;

    // put the screen
	f_putScreen(true);
}

function f_dialogOpen (s_url, s_title, s_features) {
	if (!window.a_windows)
		window.a_windows = [];

	// parse parameters
	var a_featuresStrings = s_features.split(',');
	var a_features = [];
	for (var i = 0; i < a_featuresStrings.length; i++)
		if (a_featuresStrings[i].match(RE_PARAM))
			a_features[String(RegExp.$1).toLowerCase()] = RegExp.$2;

	// create element for window
	var n_nesting = a_windows.length;

	var e_window = document.createElement("div");
	e_window.style.position = 'absolute';
	var n_width  = a_features.width  ? parseInt(a_features.width)  : 300;
	var n_height = a_features.height ? parseInt(a_features.height) : 200;
	var a_docSize = f_documentSize ();
	e_window.style.left = (a_features.left ? parseInt(a_features.left) : ((a_docSize[0] - n_width)  / 2) + a_docSize[2]) + 'px';
	e_window.style.top  = (a_features.top  ? parseInt(a_features.top)  : ((a_docSize[1] - n_height) / 2) + a_docSize[3]) + 'px';
	e_window.style.zIndex = N_BASEZINDEX + a_windows.length * 2 + 2;

      var flashes = [];
    flashes = document.getElementsByTagName("object");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "hidden";
    }

    var select = [];
    flashes = document.getElementsByTagName("select");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "hidden";
    }

    e_window.innerHTML =
		'<table border="0" class="' +
		(a_features.css ? a_features.css : 'dialogWindow') +
		'" style="z-index:10;"><tr><td><iframe frameBorder="0" name="'+s_title+'" style = "border:0 solid black" scrolling="' + (a_features.scrollbars ? a_features.scrollbars : "no")  + '" width="' + n_width +
		'" height="' + n_height +
		(s_url!=''?'" src="' + s_url + '"':'')+'>  </iframe></td></tr></table>';
//    alert(e_window.innerHTML);
	document.body.appendChild(e_window);
    var txt = document.createTextNode(" ");
    document.body.appendChild(txt);

    a_windows[n_nesting] = e_window;

    // put the screen
	f_putScreen(true);
}

function f_dialogClose () {

	var n_nesting = a_windows.length - 1;
	// destroy element
	if (a_windows[n_nesting].removeNode)
		a_windows[n_nesting].removeNode(true);
	else if (document.body.removeChild)
		document.body.removeChild(a_windows[n_nesting]);
	a_windows[n_nesting] = null;
	a_windows.length = n_nesting;

    var flashes = [];
    flashes = document.getElementsByTagName("object");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "visible";
    }

    var select = [];
    flashes = document.getElementsByTagName("select");
    for (var f=0; f < flashes.length; f++){
        flashes[f].style.visibility = "visible";
    }
    // move the screen

    f_putScreen(n_nesting);

}


// drag'n'drop functions
function f_dragStart (s_name, e_event) {
	if (!e_event && window.event) e_event = window.event;

	// save mouse coordinates
	window.n_mouseX = e_event.clientX;
	window.n_mouseY = e_event.clientY;
	window.e_draggedWindow = window.a_windows[s_name];
	return false;
}
function f_dragProgress (e_event) {
	if (!e_event && window.event) e_event = window.event;
	if (!e_event || window.e_draggedWindow == null) return;

	var n_newMouseX = e_event.clientX;
	var n_newMouseY = e_event.clientY;

	window.e_draggedWindow.style.left = (parseInt(window.e_draggedWindow.style.left) - window.n_mouseX + n_newMouseX) + 'px';
	window.e_draggedWindow.style.top  = (parseInt(window.e_draggedWindow.style.top)  - window.n_mouseY + n_newMouseY) + 'px';

	window.n_mouseX = n_newMouseX;
	window.n_mouseY = n_newMouseY;
}

function f_dragEnd () {
	window.e_draggedWindow = null;
}

// end draggable modal windows


function _has(s,a){
s=String(s);
if(typeof(a)=="string")return s.indexOf(a)!=-1;
else{
	for(var i=0;i<a.length;i++)if(s.indexOf(a[i])!=-1)return true;
	return false;
}
}


function brow(){if(typeof objBrow!="object")objBrow=new Browser();return objBrow;}

function Browser(){
this.name=this.platform="Unknown";
this.majorver=this.version=this.minorver="";
this.mozilla=false;
this.init=_Init;
this.getName=function(){return this.name};
this.getMinorver=function(){return this.minorver};
this.getMajorver=function(){return this.majorver};
this.getVersion=function(){return parseFloat(this.version,10)};
this.getPlatform=function(){return this.platform}; 
this.isIE=function(){return(this.name=="IE")};
this.isNetscape=function(){return(this.name=="Netscape")};
this.isMozilla=function(){return this.mozilla};
this.isWindows=function(){return _has(this.platform,["Windows","WinNT"])};
this.isWinNT=function(){return _has(this.platform,["WinNT","Windows NT"])};
this.isWin95=function(){return _has(this.platform,["Win95","Windows 95"])};
this.isWin98=function(){return _has(this.platform,["Win98","Windows 98"])};
this.isLinux=function(){return _has(this.platform,"Unix")};
this.isMac=function(){return _has(this.platform,"Mac");};
this.init();
}
function _Init(){
var ua=navigator.userAgent,t="",ts="",i,bv;
bv=ua.slice(0,ua.indexOf("("));
ts=ua.slice(ua.indexOf("(")+1,ua.indexOf(")")).split(";");
for(i=0;i<ts.length;i++){
	t=ts[i].trim();
	if(_has(t,["MSIE","Opera"]))bv=t;
	else if(_has(t,["X11","SunOS","Linux"]))this.platform="Unix";
	else if(_has(t,["Mac","PPC","Win"]))this.platform=t;
}
var idx=bv.indexOf("MSIE"),lo="";
if(idx>=0)bv=bv.slice(idx);
if(bv.slice(0,7)=="Mozilla"){
	lo="";
	this.name="Netscape";
	if(ua.indexOf("Gecko/")!=-1){
		if(/Netscape/.test(ua)){
			var v=/([^\/]+)\s*$/.exec(ua);
			if(v&&v.length>1)lo=v[1]+" ";
		}else{
			this.mozilla=true;
			var v=/rv:([^\)]+)\)/.exec(ua);
			if(v&&v.length>1)lo=v[1]+" ";
		}
	}
	if(lo=="")lo=bv.slice(8);
}else if (bv.slice(0,4)=="MSIE"){
	this.name="IE";lo=bv.slice(5);
}else if (bv.slice(0,27)=="Microsoft Internet Explorer"){
	this.name="IE";lo=bv.slice(28);
}else if (bv.slice(0,5)=="Opera"){
	this.name="Opera";lo=bv.slice(6);
}
lo=lo.trim();
i=lo.indexOf(" ");
if(i>=0)this.version=lo.slice(0,i);
else this.version=lo;
j=this.version.indexOf(".");
if(j>=0){
	this.majorver=this.version.slice(0,j);
	this.minorver=this.version.slice(j+1);
}else this.majorver=this.version;
}

function fazercomentario(idblog,idmensagem){
	f_dialogOpen("fazercomentario.asp?idblog="+idblog+"&idmsg="+idmensagem,"Comentário","width=410,height=310,scrollbars=no");
}
function esqueci_minha_senha(){
	f_dialogOpen("esquecisenha.asp","Senha","width=400,height=200,scrollbars=no");
}
function logarsistema(idblog,idmensagem){
	f_dialogOpen("logarnosistema.asp","Login","width=410,height=310,scrollbars=no");
}
function fazercomentariocoluna(idcoluna){
	f_dialogOpen("fazercomentariocoluna.asp?idcoluna="+idcoluna,"Comentário","width=410,height=310,scrollbars=no");
}

