

var mar,gome;var torr,cielmk;var ctorr,ccielmk,comerkg,prunkg;

var stop=1;
function detener()
{
	stop=0;
}



function Minutes(data) {
for(var i=0;i<data.length;i++) 
if(data.substring(i,i+1)==":") 
break;  
return(data.substring(0,i)); 
}
function Seconds(data) {        
for(var i=0;i<data.length;i++) 
if(data.substring(i,i+1)==":") 
break;  
return(data.substring(i+1,data.length)); 
}
function Display(min,sec) {     
var disp;       
if(min<=9) disp=" 0";   
else disp=" ";  
disp+=min+":";  
if(sec<=9) disp+="0"+sec;       
else disp+=sec; 
return(disp); 
}
function Up() { 
ctorr=0;        
ccielmk=0;        
UpRepeat(); 
}
function UpRepeat() {   
ccielmk++;        
if(ccielmk==60) {
ccielmk=0; ctorr++; 
}
document.sw.disp1.value=Display(ctorr,ccielmk);   
if((ctorr==torr)&&(ccielmk==cielmk)) 
alert("Stopwatch Stopped");     
else mar=setTimeout("UpRepeat()",1000); 
}
function Down() {       
  
DownRepeat(); 
}
function DownRepeat() { 
prunkg--;        
if(prunkg==-1) { 
prunkg=59; comerkg--; 
}       
document.sw.disp2.value=Display(comerkg,prunkg);   
if((comerkg==0)&&(prunkg==0)) 
alert("Countgome Stopped");     
else gome=setTimeout("DownRepeat()",1000); 
}

function UpRepeat()
{   
	var total;
	ccielmk++;        
	if(ccielmk==60)
	{
		ccielmk=0;
		ctorr++; 
	}
	document.sw.disp1.value=Display(ctorr,ccielmk);   
	if(stop==0) 
	{
   		document.sw.disp2.value=Display(ctorr,ccielmk); 
		document.sw.disp3.value=Math.round(290*60/(ctorr*60+ccielmk));   
   		stop=1;
	}
	else 
	{
		mar=setTimeout("UpRepeat()",1000);   
	}
}


