

// Timer Bar - Version 1.0
// Author: Brian Gosselin of http://scriptasylum.com
// Script featured on http://www.dynamicdrive.com

var loadedcolor='#FFEB99' ;       // PROGRESS BAR COLOR
var unloadedcolor='#EEEEEE';     // COLOR OF UNLOADED AREA
var bordercolor='#CECECE';            // COLOR OF THE BORDER
var barheight=17;                  // HEIGHT OF PROGRESS BAR IN PIXELS
var barwidth=400;                  // WIDTH OF THE BAR IN PIXELS
var waitTime=25;                   // NUMBER OF SECONDS FOR PROGRESSBAR

var textColor='FBA603';            // COLOR OF TEXT IN LOADING BAR
var textSize='10px';              // SIZE OF TEXT IN LOADING BAR
var textFont='verdana';           // FONT FAMILY OF TEXT IN LOADING BAR

var ns4=(document.layers)?true:false;
var ie4=(document.all)?true:false;
var blocksize=(barwidth-2)/waitTime/10;
var loaded=0;
var PBouter;
var PBdone;
var PBbckgnd;
var Pid=0;
var txt2='';

function escribeBarra(){

	if (idioma_web=="es"){
			if(ns4){
				txt2+='<table border=0 cellpadding=0 cellspacing=0><tr><td>';
				txt2+='<ilayer name="PBouter" visibility="hidden" height="'+barheight+'" width="'+barwidth+'" >';
				txt2+='<layer width="'+barwidth+'" height="'+barheight+'" top="0" left="0">Realizando cálculo, espere unos segundos.</layer>';
				txt2+='<layer width="'+barwidth+'" height="'+barheight+'" bgcolor="'+bordercolor+'" top="0" left="0"></layer>';
				txt2+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+unloadedcolor+'" top="1" left="1"></layer>';
				txt2+='<layer name="PBdone" width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+loadedcolor+'" top="1" left="1"></layer>';
			
			txt+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" top="1" left="1">';
			txt+='<table cellpadding=0 cellspacing=0 border=0 width="'+(barwidth-2)+'" height="'+(barheight-2)+'"><tr><td align="center" valign="middle">';
			txt+='<span style="color:'+textColor+'; font-size:'+textSize+'; font-family:'+textFont+'">Calculando, espere unos segundos por favor...</span>';
			txt+='</td></tr></table>';
			txt+='</layer>';
				
				
				txt2+='</ilayer>';
				txt2+='</td></tr></table>';
			}else{
				txt2+='<div id="PBouter" style="position:relative; left:8px;visibility:hidden; background-color:'+bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;display:none">';
				txt2+='<div style="position:absolute; top:1px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; font-size:1px;"></div>';
				txt2+='<div id="PBdone" style="position:absolute; top:1px; left:1px; width:0px; height:'+(barheight-2)+'px; background-color:'+loadedcolor+'; font-size:1px;"></div>';
			    txt2+='<div style="position:absolute; top:2px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; color:'+textColor+'; font-size:'+textSize+'; font-family:'+textFont+'; text-align:center; cursor:default">Calculando, espere unos segundos por favor...</div>';
				txt2+='</div>';
			}
	}
	if (idioma_web=="en"){
			if(ns4){
				txt2+='<table border=0 cellpadding=0 cellspacing=0><tr><td>';
				txt2+='<ilayer name="PBouter" visibility="hidden" height="'+barheight+'" width="'+barwidth+'" >';
				txt2+='<layer width="'+barwidth+'" height="'+barheight+'" top="0" left="0">Calculating, wait a few seconds please...</layer>';
				txt2+='<layer width="'+barwidth+'" height="'+barheight+'" bgcolor="'+bordercolor+'" top="0" left="0"></layer>';
				txt2+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+unloadedcolor+'" top="1" left="1"></layer>';
				txt2+='<layer name="PBdone" width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+loadedcolor+'" top="1" left="1"></layer>';
			
			txt+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" top="1" left="1">';
			txt+='<table cellpadding=0 cellspacing=0 border=0 width="'+(barwidth-2)+'" height="'+(barheight-2)+'"><tr><td align="center" valign="middle">';
			txt+='<span style="color:'+textColor+'; font-size:'+textSize+'; font-family:'+textFont+'">Calculating, wait a few seconds please...</span>';
			txt+='</td></tr></table>';
			txt+='</layer>';
				
				
				txt2+='</ilayer>';
				txt2+='</td></tr></table>';
			}else{
				txt2+='<div id="PBouter" style="position:relative; left:8px;visibility:hidden; background-color:'+bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;display:none">';
				txt2+='<div style="position:absolute; top:1px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; font-size:1px;"></div>';
				txt2+='<div id="PBdone" style="position:absolute; top:1px; left:1px; width:0px; height:'+(barheight-2)+'px; background-color:'+loadedcolor+'; font-size:1px;"></div>';
			    txt2+='<div style="position:absolute; top:2px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; color:'+textColor+'; font-size:'+textSize+'; font-family:'+textFont+'; text-align:center; cursor:default">Calculating, wait a few seconds please...</div>';
				txt2+='</div>';
			}
	}	
document.write(txt2);
}

function incrCount(){
loaded++;
if(loaded<0)loaded=0;
if(loaded>=waitTime*10){
clearInterval(Pid);
loaded=waitTime*10;
//setTimeout('hidebar()',100);
}
resizeEl(PBdone, 0, blocksize*loaded, barheight-2, 0);
}

function findlayer(name,doc){
	var i,layer;
	for(i=0;i<doc.layers.length;i++){
		layer=doc.layers[i];
		if(layer.name==name)return layer;
		if(layer.document.layers.length>0)
		if((layer=findlayer(name,layer.document))!=null)
		return layer;
	}
	return null;
}

function progressBarInit(){
	
	PBouter=(ns4)?findlayer('PBouter',document):(ie4)?document.all['PBouter']:document.getElementById('PBouter');
	PBdone=(ns4)?PBouter.document.layers['PBdone']:(ie4)?document.all['PBdone']:document.getElementById('PBdone');
	resizeEl(PBdone,0,0,barheight-2,0);
	if(ns4)
		PBouter.visibility="show";
	else 
		PBouter.style.visibility="visible";
	Pid=setInterval('incrCount()',95);
	//PBouter.style.visibility='visible';
	if (typeof document.images['calcula'] != 'undefined') 			document.images['calcula'].style.display 		= 'none';
	if (typeof document.images['contratar'] != 'undefined') 		document.images['contratar'].style.display 		= 'none';
	if (typeof document.images['botonConfirmar'] != 'undefined') 	document.images['botonConfirmar'].style.display = 'none';	
	if (typeof document.images['nuevocalculo'] != 'undefined') 		document.images['nuevocalculo'].style.display	= 'none';	
	if (typeof document.images['volver'] != 'undefined') 			document.images['volver'].style.display			= 'none';		
	if (document.getElementById("btSubmit")) {  document.getElementById("btSubmit").style.display="none";}
	if (document.getElementById("btNuevoCalculo")) {  document.getElementById("btNuevoCalculo").style.display="none";}
	if (document.getElementById("btContratar")) {  document.getElementById("btContratar").style.display="none";}		
	if (document.getElementById("btVolver")) {  document.getElementById("btVolver").style.display="none";}
	if (document.getElementById("btContinuar")) {  document.getElementById("btContinuar").style.display="none";}		
	
	PBouter.style.display='block';

}

function resizeEl(id,t,r,b,l){
	if(ns4){
		id.clip.left=l;
		id.clip.top=t;
		id.clip.right=r;
		id.clip.bottom=b;
	}else id.style.width=r+'px';
}

