var w2=w1=0;
function wfit(end,wd,hg,nm,cfg,f) {
	if(typeof(end)!="string")end=end.href;
	if(end.indexOf('/')!=-1)end=(end.substring(end.lastIndexOf("/")+1,end.indexOf(".asp")+4))
	
	var nome=end.substring(0,end.length<7?end.length:6)
	nome=nome.replace('.','')
	nome=nome.replace('_','')+"3333"

	if(cfg==null)cfg=',menubar=no,scrollbars=no,resizable=no,status=yes,location=no,tollbar=no';
	w1=window.open(end,nome,'width='+wd+',height='+hg+',top='+
		((screen.height/2)-(hg/2)-35)+',left='+((screen.width/2)-(wd/2)-15)+cfg);
	if(w1!=0)setTimeout(function(){ w1.focus();}, 600);
	w1.focus();

/*	w1.onbeforeunload=function(){	window.opener.zera();	}*/
	if(f!=0){
	document.onmousemove= function(){
		if(w1!=0)if(w1!=null && w1!=undefined)if(!w1.closed)if(document.hasFocus()){w1.focus();return false;}
	}
	}
}
exec_aofechar=0;
function wb(end,wd,hg,cfg) {
	if(typeof(end)!="string")end=end.href;
	if(end.indexOf('/')!=-1)end=(end.substring(end.lastIndexOf("/")+1,end.indexOf(".asp")+4))
	
	var nome=end.substring(0,end.length<15?end.length:14)
	nome=nome.replace('.','')
	nome=nome.replace('=','')
	nome=nome.replace('?','')

	if(cfg==null)cfg=',menubar=no,scrollbars=yes,resizable=yes,status=yes,location=no,tollbar=no';
	var lg="";
	if(wd!=null && hg!=null)lg='width='+wd+',height='+hg+',top='+
		((screen.height/2)-(hg/2)-40)+',left='+((screen.width/2)-(wd/2)-15);

	w2=window.open(end,nome,lg+cfg);
	if(w2!=0)setTimeout(function(){ w2.focus();}, 600);
	w2.focus();
}
function onready(func){
	if(!(document.getElementById("ok")==null)){
		func();
	}else{
		var func_rep = func;
		setTimeout(function(){ onready(func_rep) },100);
	}
}

