var cor=new Array(2)
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
var timerID = 0;
var tStart  = null;
var winW = 630, winH = 460;
var mostra=true;


function loadwindow(url,width,height,win){
	if (!ie5&&!ns6){
		window.open(url,"#","width=width,height=height,scrollbars=1")

	}else{
		document.getElementById(win).style.display=''
		document.getElementById(win).style.width=initialwidth=width+"px"
		document.getElementById(win).style.height=initialheight=height+"px"
		document.getElementById(win).style.left = ((winW/2) - 265) +"px";
		document.getElementById(win).style.top =  212 + "px"; //cor[1]
	}

}

function closeit(){
   document.getElementById('quadro1').style.display = "none";
   document.getElementById('quadro2').style.display = "none";
   document.getElementById('quadro3').style.display = "none";
   document.getElementById('quadro4').style.display = "none";
   mostra = true;
}

function doSomething(e){
	var posx = 0;
	var posy = 0;

	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX + document.body.scrollLeft;
		posy = e.clientY + document.body.scrollTop;
	}
	cor[0] = posx;
	cor[1] = posy;
	document.onclick = null;
}

function UpdateTimer() {
   	if(timerID) {
      	clearTimeout(timerID);
		clockID  = 0;
   	}

   	if(!tStart)
      	tStart = new Date();

   	var tDate = new Date();
   	var tDiff = tDate.getTime() - tStart.getTime();
	var valor=0;
   	tDate.setTime(tDiff);

   	valor =  (tDate.getMinutes() * 3600) + (tDate.getSeconds()*60) +  tDate.getMilliseconds();
   	document.getElementById("dwindow").style.height = (valor+2) + "px";
   	document.getElementById("ifrm").style.height = (valor-13) + "px";

	
	if(valor <= 341)
   		timerID = setTimeout("UpdateTimer()", 1);
	else{
		Reset();
	}
	
}

function Start() {
	document.getElementById("ifrm").style.height = "0px";
   document.getElementById("ifrm").style.width = "0px";
   tStart   = new Date();
   timerID  = setTimeout("UpdateTimer()", 1);
}

function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }
   tStart = null;
}

function Reset() {
   tStart = null;
}

function Dimensoes(){
	if (parseInt(navigator.appVersion)>3) {
	 	if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	 	}
	 	if (navigator.appName.indexOf("Microsoft")!=-1) {
	 		winW = document.body.offsetWidth;
	 		winH = document.body.offsetHeight;
	 }
	}
}


