function padZeros(value, strLength)
{
	var vStr = value.toString();
	
	while(vStr.length < strLength)
	{vStr= '0' + vStr;}
	
	return vStr;
}

function popUpWindow(URLStr, left, top, width, height)
{
  popUpWin = open(URLStr, '', 'toolbar=no,location=no,directories=no,statusbar=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function objById(objId)
{
	return document.getElementById(objId);
}

function loadStyleSheet (doc, sheetURL, mediaTypes) {
  var link;
  if (doc.createElement && (link = doc.createElement('link'))) {
    link.rel = 'stylesheet';
    link.href = sheetURL;
    link.type = 'text/css';
    if (mediaTypes) {
      link.media = mediaTypes;
    }
    var head = doc.getElementsByTagName('head')[0];
    if (head) {
      head.appendChild(link);
    }
  }
}

function perguntar(texto){
	return window.confirm(texto);
}

function browserSimpleDetection(){
	if(document.all) return 'ie'; //Internet Explorer
	if(document.layers) return 'ns'; //Netscape
	if(document.getElementById && !document.all) return 'ot'; //Other
}

function MousePos(x,y){this.x=x;this.y=y;}
function captureMousePosition() {
	var mouse = new MousePos(-5000,-5000);
	mouse.x   = window.event.x;
	mouse.y   = window.event.y;	
			
	return mouse;
}

function getRoundDec(decVal,precisionDigits){
	return decVal.toFixed(precisionDigits);
}

function toggleLayer(whichLayer)
{
	if(divSuffix == null){alert("'divSuffix' not initialized"); return;}
	if(imgSuffix == null){alert("'imgSuffix' not initialized"); return;}
	if(imgDirSuffix == null){alert("'imgDirSuffix' not initialized"); return;}
	
	var objDiv = divSuffix + whichLayer;
	var objImg = imgSuffix + whichLayer;
	var style2;
	if (document.getElementById){
		// this is the way the standards work
		style2 = document.getElementById(objDiv).style;
		style2.display = style2.display? "":"block";
		
	}else if (document.all){
		// this is the way old msie versions work
		style2 = document.all[objDiv].style;
		style2.display = style2.display? "":"block";
	
	}else if (document.layers){
		// this is the way nn4 works
		style2 = document.layers[objDiv].style;
		style2.display = style2.display? "":"block";
	}
	
	if(style2.display){
		document.getElementById(objImg).src = imgDirSuffix + "minusSign.gif";
	}else{
		document.getElementById(objImg).src = imgDirSuffix + "plusSign.gif";
	}
}
