// JavaScript Document

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 voltar() {
	history.go(-1);
};

function imprimir() {
	window.print();
};


// window open
var url;
function abre(url,w,h,scr) {
	window.open(url,'comentarios','width='+w+',height='+h+',directories=0,location=0,menubar=0,resizable=1,scrollbars='+scr+',status=0,toolbar=0,marginleft=0,margintop=0,left=25,top=25');
};

// retira espaços em branco
function retiraEspacos(string) {
    var i = 0;
    var final = '';
    while (i < string.length) {
        if (string.charAt(i) == ' ') {
            final += string.substr(0, i);
            string = string.substr(i+1, string.length - (i+1));
            i = 0;
        }
        else {
            i++;
        }
    }
    return final + string;
};

/**
  * Opens a popup window
  *
  * @param string url
  * @param int width
  * @param int height
  * @param boolean scroll
  * @param string name
  */
function hrefPopup(url, width, height, scroll, name) {

   var win  = null;
   var winl = (screen.width - width)/2;
   var wint = (screen.height - height)/2;

   settings = 'height='+height+',width='+width+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=yes'

   if (name == '') {
      name = '_window';
   }

   win = window.open (''+url+'', ''+name+'', settings);
   if (parseInt(navigator.appVersion) >= 4) {
      win.window.focus();
   }
};

b_versao = parseInt(navigator.appVersion);
var win = null;
function NewWindow(mypage,myname,w,h,scroll,size)
{
	if (b_versao >= 4)
	{
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	}
	else
	{
		LeftPosition = 100;
		TopPosition = 100;
	}
	var settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+size+'';
	var win = window.open(mypage,myname,settings);
	if(win.window.focus){win.window.focus();}
};