function popUp(doc, height, width)
{
	var top = (screen.height - height - 30) / 2;
	var left = (screen.width - width) / 2;
	
	var janela = window.open(doc, height + width,
		 		 "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left +
				 ",scrollbars");
	janela.moveTo(left, top);
	janela.focus();	
}

function popUpConteudo(doc)
{
	popUp(doc, 380, 600);
}

function popUpExplicacao(doc)
{
	popUp(doc, 500, 720);
}

function popUpAvisos(doc)
{
	popUp(doc, 280, 650);
}

function popUpSistemas(doc)
{
	popUp(doc, 500, 700);
}

function obterParametro(name)
{
	var argsArray = location.search.substr(1).split('&');
	var pos;

	for(i = 0;i < argsArray.length; i++) {
		pos = argsArray[i].indexOf("=");
		if(argsArray[i].substr(0, pos) == name) {
			return argsArray[i].substr(pos+1);
		}
	}
	
	return "";
}

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  if(foundObj)
  {
    if(foundObj.toString().indexOf("Flash") == -1) {
  	  if(foundObj.style == null)
  	    foundObj.style = foundObj;
    }
  }

  if(!foundObj)
  {
    if(theDoc.all)
      foundObj = theDoc.all[theObj];
    else
      foundObj = theDoc[theObj];
  }

  return foundObj;
}

// Layers
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_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_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 swapImage(index, newImage, newText) {
function swapImage(index, newImage, defaultImage)
{
	var imgHolderID = 'image'+index;
	var img 		= document.getElementById(imgHolderID);

	if (img==null)
	{
		//	alert('unknow "'+imgHolderID+'" HTML image id');
	}
	else
	{
		img.src = newImage;
	}

}	

//-->
