// Progressbar - Version 2.0
// Author: Brian Gosselin of http://scriptasylum.com
// Featured on Dynamic Drive (http://www.dynamicdrive.com)
// PUT THE NAMES OF ALL YOUR IMAGES THAT NEED TO BE "CACHED" IN THE "imagenames" ARRAY.
// DONT FORGET THE COMMA BETWEEN EACH ENTRY, OR THE TICK MARKS AROUND EACH NAME.
// WHEN ALL THE IMAGES ARE DONE LOADING, THE "imagesdone" VARIABLE IS SET TO "TRUE"

var imagenames=new Array( './images/img01.jpg', './images/img02.jpg', './images/img03.jpg', './images/img04.jpg', './images/img05.jpg', './images/img06.jpg', './images/img07.jpg', './images/img08.jpg', './images/img09.jpg', './images/img10.jpg', 
'./images/img11.jpg', './images/img12.jpg', './images/img13.jpg', './images/img14.jpg', './images/img15.jpg', './images/img16.jpg', './images/img17.jpg', './images/img18.jpg', './images/img19.jpg', './images/img20.jpg', 
'./images/img21.jpg', './images/img22.jpg', './images/img23.jpg', './images/img24.jpg', './images/img25.jpg', './images/img26.jpg', './images/img27.jpg', './images/img28.jpg', './images/img29.jpg', './images/img30.jpg', 
'./images/img31.jpg', './images/img32.jpg', './images/img33.jpg', './images/img34.jpg', './images/img35.jpg', './images/img36.jpg', './images/img37.jpg', './images/img38.jpg', './images/img39.jpg', './images/img40.jpg', 
'./images/img41.jpg', './images/img42.jpg', './images/img43.jpg', './images/img44.jpg', './images/img45.jpg', './images/img46.jpg', './images/img47.jpg', './images/img48.jpg', './images/img49.jpg', './images/img50.jpg', 
'./images/img51.jpg', './images/img52.jpg', './images/img53.jpg', './images/img54.jpg', './images/img55.jpg', './images/img56.jpg', './images/img57.jpg', './images/img58.jpg', './images/img59.jpg', './images/img60.jpg',
'./subs/images/img10.jpg', './subs/images/img14.jpg', './subs/images/img15.jpg', './subs/images/img17.jpg', './subs/images/img18.jpg', './subs/images/img19.jpg', './subs/images/img22.jpg', './subs/images/img27.jpg', './subs/images/img32.jpg', './subs/images/img37.jpg', './subs/images/img42.jpg', './subs/images/img47.jpg', './subs/images/img52.jpg', './subs/images/img57.jpg', 
'./itens/artigos.gif', 
'./itens/clinica.gif', 
'./itens/consultas.gif', 
'./itens/contato.gif', 
'./itens/copyright.gif', 
'./itens/equipe.gif', 
'./itens/especializada.gif', 
'./itens/home.gif', 
'./itens/logo.gif', 
'./itens/tangram.gif', 
'./itens/tratamento.gif' );

var yposition=250;                                  //POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var loadedcolor='gray' ;                // PROGRESS BAR COLOR
var unloadedcolor='white';                   // BGCOLOR OF UNLOADED AREA
var barheight=15;                                 // HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=350;                                // WIDTH OF THE BAR IN PIXELS  
var bordercolor='black';                       // COLOR OF THE BORDER

//DO NOT EDIT BEYOND THIS POINT 
var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var imagesdone=false;
var blocksize=barwidth/(imagenames.length);
barheight=Math.max(barheight,25);
var loaded=0, perouter, perdone, images=new Array();
var txt=(NS4)?'<layer name="perouter" bgcolor="'+bordercolor+'" visibility="hide">' : '<div id="perouter" style="position:absolute; visibility:hidden; background-color:'+bordercolor+'">';
txt+='<table cellpadding="0" cellspacing="1" border="0"><tr><td width="'+barwidth+'" height="'+barheight+'" valign="center">';
if(NS4)txt+='<ilayer width="100%" height="100%"><layer width="100%" height="100%" bgcolor="'+unloadedcolor+'" top="0" left="0">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" bgcolor="'+unloadedcolor+'"><center><font color="'+loadedcolor+'" size="1" face="sans-serif">CLINICA DR. TOUFIK RAHD. Carregando site...</font></center></td></tr></table>';
if(NS4) txt+='</layer>';
txt+=(NS4)? '<layer name="perdone" width="100%" height="'+barheight+'" bgcolor="'+loadedcolor+'" top="0" left="0">' : '<div id="perdone" style="position:absolute; top:1px; left:1px; width:'+barwidth+'px; height:'+barheight+'px; background-color:'+loadedcolor+'; z-index:100">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" bgcolor="'+loadedcolor+'"><center><font color="'+unloadedcolor+'" size="1" face="sans-serif">CLINICA DR. TOUFIK RAHD. Carregando site...</font></center></td></tr></table>';
txt+=(NS4)? '</layer></ilayer>' : '</div>';
txt+='</td></tr></table>';
txt+=(NS4)?'</layer>' : '</div>';
document.write(txt);
function loadimages(){
if(NS4){
perouter=document.perouter;
perdone=document.perouter.document.layers[0].document.perdone;
}
if(NS6){
perouter=document.getElementById('perouter');
perdone=document.getElementById('perdone');
}
if(IE4){
perouter=document.all.perouter;
perdone=document.all.perdone;
}
cliplayer(perdone,0,0,barheight,0);
window.onresize=setouterpos;
setouterpos();
for(n=0;n<imagenames.length;n++){
images[n]=new Image();
images[n].src=imagenames[n];
setTimeout('checkload('+n+')' ,100);
}}
function setouterpos(){
var ww=(IE4)? document.body.clientWidth : window.innerWidth;
var x=(ww-barwidth)/2;
if(NS4){
perouter.moveTo(x,yposition);
perouter.visibility="show";
}
if(IE4||NS6){
perouter.style.left=x+'px';
perouter.style.top=yposition+'px';
perouter.style.visibility="visible";
}}
function dispbars(){
loaded++;
cliplayer(perdone, 0, blocksize*loaded, barheight, 0);
if(loaded>=imagenames.length)setTimeout('hideperouter()', 800);
}
function checkload(index){
(images[index].complete)? dispbars() : setTimeout('checkload('+index+')', 100);
}
function hideperouter(){
(NS4)? perouter.visibility="hide" : perouter.style.visibility="hidden";
imagesdone=true;
location.replace('./index2.htm')
}
function cliplayer(layer, ct, cr, cb, cl){
if(NS4){
layer.clip.left=cl;
layer.clip.top=ct;
layer.clip.right=cr;
layer.clip.bottom=cb;
}
if(IE4||NS6)layer.style.clip='rect('+ct+' '+cr+' '+cb+' '+cl+')';
}
window.onload=loadimages;
