// 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(
// n=86
'image/cpon.gif',
'image/cpoff.gif',
'image/cwon.gif',
'image/cwoff.gif',
'image/jhon.gif',
'image/jhoff.gif',
'image/logo_core.gif',
'image/logo_cp.gif',
'image/logo_fs.gif',
'image/logo_moo.gif',
'image/logo_output.gif',
'image/logo_portal.gif',
'image/logo_shop.gif',
'image/logo_si.gif',
'image/logo_tutorial.gif',
'image/rnon.gif',
'image/rnoff.gif',
'image/shon.gif',
'image/shoff.gif',
'image/snon.gif',
'image/snoff.gif',
'image/vvon.gif',
'image/vvoff.gif',
'shop/image/boxers.gif',
'shop/image/cap.gif',
'shop/image/ls_tshirt.gif',
'shop/image/socks.gif',
'shop/image/ss_tshirt.gif',
'shop/image/sweat_pants.gif',
'tutorial/image/asteroids.gif',
'tutorial/image/battlezone.gif',
'tutorial/image/browse.gif',
'tutorial/image/browse_off.gif',
'tutorial/image/browse_on.gif',
'tutorial/image/cleansweep.gif',
'tutorial/image/cp_dialog.gif',
'tutorial/image/cp_phat.gif',
'tutorial/image/cp_viz.gif',
'tutorial/image/def_viz.gif',
'tutorial/image/describe.gif',
'tutorial/image/display_ascii.gif',
'tutorial/image/display_html.gif',
'tutorial/image/display_java.gif',
'tutorial/image/display_plugins.gif',
'tutorial/image/fs_viz.gif',
'tutorial/image/linkto.gif',
'tutorial/image/local_link.gif',
'tutorial/image/login.gif',
'tutorial/image/login_guest.gif',
'tutorial/image/main_interfaces.gif',
'tutorial/image/menu_viz.gif',
'tutorial/image/monitor.gif',
'tutorial/image/moo_mam_hilights.gif',
'tutorial/image/osx_phat.gif',
'tutorial/image/osx_phat_link.gif',
'tutorial/image/osx_phat_viz.gif',
'tutorial/image/phat.gif',
'tutorial/image/phat_agent.gif',
'tutorial/image/phat_options.gif',
'tutorial/image/phat_trans.gif',
'tutorial/image/results.gif',
'tutorial/image/search.gif',
'tutorial/image/si_dialog.gif',
'tutorial/image/si_viz.gif',
'tutorial/image/sun_phat.gif',
'tutorial/image/sun_phat_viz.gif',
'tutorial/image/asteroids.gif',
'tutorial/image/asteroids.gif',
'tutorial/image/asteroids.gif',
'tutorial/image/custom/phat_custom.gif',
'tutorial/image/custom/viz_custom.gif',
'tutorial/image/hacks/asteroids_expired.gif',
'tutorial/image/hacks/battlezone_expired.gif',
'tutorial/image/hacks/cleansweep_expired.gif',
'tutorial/image/hacks/def_viz_blue.gif',
'tutorial/image/hacks/def_viz_expired.gif',
'tutorial/image/hacks/def_viz_red.gif',
'tutorial/image/hacks/display_plugins_blue.gif',
'tutorial/image/hacks/display_plugins_expired.gif',
'tutorial/image/hacks/display_plugins_red.gif',
'tutorial/image/hacks/login_blue.gif',
'tutorial/image/hacks/login_expired.gif',
'tutorial/image/hacks/login_red.gif',
'tutorial/image/hacks/phat_blue.gif',
'tutorial/image/hacks/phat_expired.gif',
'tutorial/image/hacks/phat_red.gif'
);

var yposition=210;                      // POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var loadedcolor='#C0C0C0';              // PROGRESS BAR COLOR
var unloadedcolor='#FFFFFF';            // BGCOLOR OF UNLOADED AREA
var textloadcolor='#805050';            // BAR TEXT COLOR OF LOADED AREA
var textunloadcolor='#FF0000';          // BAR TEXT COLOR OF UNLOADED AREA
var barheight=25;                       // HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=375;                       // 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="'+textunloadcolor+'" size="2" face="verdana,arial,helvetica,sans-serif">Reconfiguring hard-drive -- please be patient...</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="'+textloadcolor+'" size="2" face="verdana,arial,helvetica,sans-serif">Reconfiguring hard-drive -- please be patient...</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*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";
	setTimeout('hidelocaldrive()', 10000);
	imagesdone=true;
}
function hidelocaldrive(){
	document.all.localDrive.style.visibility="hidden";
}
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;
