// progressbar.js :: pre-loads images and displays status bar.
// author         :: Brian Gosselin, www.scriptasylum.com

var imagenames=new Array('common/arrow.gif','common/b_mid.gif','common/b_y.gif','common/barcode.gif','common/contactinfo.gif','common/copyright.gif','common/divider1.gif','common/divider2.gif','common/m_approach.gif','common/m_bottom.gif','common/m_clients.gif','common/m_experience.gif','common/m_icons.gif','common/m_identity.gif','common/m_fonts.gif','common/m_awards.gif','common/m_skills.gif','common/m_top.gif','common/m_web.gif','common/mb_dd.gif','common/menudesign.gif','common/menudesign_up.gif','common/menuprofile.gif','common/menuprofile_up.gif','common/n_div.gif','common/n_next.gif','common/n_prev.gif','common/side1.jpg','common/side2.jpg','common/side3.jpg','common/spacer.gif','common/t_approach.gif','common/t_clients.gif','common/t_experience.gif','common/t_icons.gif','common/t_identity_banners.gif','common/t_identity_art.gif','common/t_identity_logos.gif','common/t_main.gif','common/t_skills.gif','common/t_ui.gif','common/t_web_medddavi.gif','common/t_web_intelware.gif','common/t_web_med.gif','common/t_web_imlek.gif','common/t_web_amn.gif','common/t_main2.gif','common/host.gif','icons/16.gif','icons/32.gif','identity/intelware.gif','identity/art1.jpg','identity/art2.jpg','identity/awa.gif','identity/davi.gif','identity/amn.gif','identity/soccer.gif','identity/idea.gif','identity/med_am.jpg','identity/webdesign.gif','identity/circle_orang.gif','identity/arm.gif','identity/circle_reit.gif','identity/ddavi.png','identity/dental_3.gif','identity/pics_am.gif','identity/chuvixa.jpg','fonts/1.gif','sites/intelware1.jpg','sites/intelware2.jpg','sites/medddavi1.jpg','sites/med.jpg','sites/imlek1.jpg','sites/imlek2.jpg','sites/amn_1.gif','sites/amn_2a.gif','sites/amn_2b.gif','sites/amn_2c.gif','sites/soccer1.jpg','sites/soccer2.jpg','common/t_web_soccer.gif');

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 yposition=120;
var loadedcolor='#236947';
var unloadedcolor='#33CC99';
if (NS4) var barheight=20;
else var barheight=15;
var barwidth=230;
var bordercolor='#000000';

var imagesdone=false;
var blocksize=barwidth/(imagenames.length);
barheight=Math.max(barheight,15);
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="#000000" size="1" face="arial">Loading Content...</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="#33CC99" size="1" face="arial">Loading Content...</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+')' ,n*50);
}}
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()', 200);
}
function checkload(index){
(images[index].complete)? dispbars() : setTimeout('checkload('+index+')', 50);
}
function hideperouter(){
(NS4)? perouter.visibility="hide" : perouter.style.visibility="hidden";
imagesdone=true;
var now = new Date(); fixDate(now);
now.setTime(now.getTime() + 24 * 60 * 60 * 1000);
setCookie("ddaviportfolio","set", now);
location.replace('index2.html');
//init();
}
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;

