function doLogin(myForm){  
	
	var janela = window.open("","janela","width=100,height=60");
	
	janela.moveTo(((screen.width)/2)-200,((screen.height)/2)-120);
	
	myForm.target="janela";
	myForm.submit();                  
}

function addCell_rs_cs(row,content,align,rowspan,colspan){
	var myCell = document.createElement("td"); 
	row.appendChild(myCell);
	
	myCell.style.padding="2px";
	
	if(rowspan!=0)
	myCell.rowSpan=rowspan;

	if(colspan!=0)
	myCell.colSpan=colspan;
					
	if(align!="")
	myCell.align=align;

	
	if((content=="null")||(content=="")){
		myCell.innerHTML="&nbsp;";
	} else {
		myCell.innerHTML=content;
	}
}

function addCell(row,content,align){
	var myCell = document.createElement("td"); 
	row.appendChild(myCell);
	
	myCell.style.padding="2px";
					
	if(align!="")
	myCell.align=align;

	
	if((content=="null")||(content=="")){
		myCell.innerHTML="&nbsp;";
	} else {
		myCell.innerHTML=content;
	}
}

function formataMoeda(num){
	x = 0;if(num<0){num = Math.abs(num);x = 1;} if(isNaN(num)) num = "0"; cents = Math.floor((num*100+0.5)%100);
	num = Math.floor((num*100+0.5)/100).toString();
	
	if(cents < 10) cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+'.'+num.substring(num.length-(4*i+3));
	ret = num + ',' + cents;
	if (x == 1) ret = ' -' + ret;return ret;
	
}			

function posicionaDiv(pdiv,w,h){
	document.getElementById(pdiv).style.left=((getWidth()/2)-(w/2))+'px';
	document.getElementById(pdiv).style.top=((getHeight()/2)-(h/2))+'px';
}

function dimIFrame(){
	document.getElementById('divPrincipal').style.width=(getWidth()-10)+'px';
	document.getElementById('divPrincipal').style.height=(getHeight()-105)+'px';
}
  
 function getWidth()  
 {  
	  return window.innerWidth ? window.innerWidth : /* For non-IE */  
			 document.documentElement ? document.documentElement.clientWidth : /* IE 6+ (Standards Compilant Mode) */  
			 document.body ? document.body.clientWidth : /* IE 4 Compatible */  
			 window.screen.width; /* Others (It is not browser window size, but screen size) */  
 }  
  
 function getHeight()  
 {  
	  return window.innerHeight ? window.innerHeight : /* For non-IE */  
			 document.documentElement ? document.documentElement.clientHeight : /* IE 6+ (Standards Compilant Mode) */  
			 document.body ? document.body.clientHeight : /* IE 4 Compatible */  
			 window.screen.height; /* Others (It is not browser window size, but screen size) */  
 }  	
 
 function addHtmlEmIFrame(html){
	var io = document.getElementsByTagName('iframe')[0];
		if(io.contentWindow) {
			io.contentWindow.document.body.innerHTML=html;
		} else if(io.contentDocument){
			io.contentDocument.document.body.innerHTML=html;
		}			 			 
 }
 
 function dimWindow(){
	this.moveTo(0,0);
	this.resizeTo(screen.width,screen.height);
 }

 function mascaraData(cpo, event){
		
	mascara = '__/__/____';
			
	c=cpo.value.length;
	
	if(((cpo.value.substr(0,c+1).length==2)||(cpo.value.substr(0,c+1).length==5))&&(event.keyCode!=8)){
		cpo.value+='/';
		c++;
	}
	c=cpo.value.length;
				
}