// 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;
var yposition=441;                                  	//POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var loadedcolor='#2D3B55' ;                		// PROGRESS BAR COLOR
var unloadedcolor='white';                   		// BGCOLOR OF UNLOADED AREA
var barheight=5;                                 	// HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=240;                                	// WIDTH OF THE BAR IN PIXELS  
var bordercolor='#2D3B55';                       	// COLOR OF THE BORDER
var pg;

//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;
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">Loading Images...</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">Loading Images...</font></center></td></tr></table>';
txt+=(NS4)? '</layer></ilayer>' : '</div>';
txt+='</td></tr></table>';
txt+=(NS4)?'</layer>' : '</div>';
document.write(txt);


function loadimages(pg_from){
pg = pg_from;
/* BMW */
if (pg=="pg_bmw")
{
imagenames=new Array( 'images/fleet/executive/pg/740_2010_1.jpg' , 'images/fleet/executive/pg/740_2010_2.jpg' , 'images/fleet/executive/pg/740_2010_3.jpg' , 'images/fleet/executive/pg/740_2010_4.jpg', 'images/fleet/executive/pg/750_1.jpg' , 'images/fleet/executive/pg/750_2b.jpg' , 'images/fleet/executive/pg/750_3.jpg' , 'images/fleet/executive/pg/750_4.jpg' ,
'images/fleet/executive/pg/740_2010_1_t.jpg' , 'images/fleet/executive/pg/740_2010_2_t.jpg' , 'images/fleet/executive/pg/740_2010_3_t.jpg' , 'images/fleet/executive/pg/740_2010_4_t.jpg', 'images/fleet/executive/pg/750_1_t.jpg' , 'images/fleet/executive/pg/750_2b_t.jpg' , 'images/fleet/executive/pg/750_3_t.jpg' , 'images/fleet/executive/pg/750_4_t.jpg');
}
/* Mercedes Benz */
else if (pg=="pg_mb")
{
imagenames=new Array( 'images/fleet/executive/pg/s500L_2007_s2a.jpg' , 'images/fleet/executive/pg/s500L_2007_s2b.jpg' , 'images/fleet/executive/pg/s500L_2007_s2c.jpg' , 'images/fleet/executive/pg/s500L_2007_s2d.jpg' , 'images/fleet/executive/pg/s500L_2007_s1.jpg' , 'images/fleet/executive/pg/s500L_2007_b1.jpg',
'images/fleet/executive/pg/s500L_2007_s2a_t.jpg' , 'images/fleet/executive/pg/s500L_2007_s2b_t.jpg' , 'images/fleet/executive/pg/s500L_2007_s2c_t.jpg' , 'images/fleet/executive/pg/s500L_2007_s2d_t.jpg' , 'images/fleet/executive/pg/s500L_2007_s1_t.jpg' , 'images/fleet/executive/pg/s500L_2007_b1_t.jpg');
}
/* Stretch Limousine - Ford LTD */
else if (pg=="pg_sl")
{
imagenames=new Array( 'images/fleet/stretch/pg/lm_w1.jpg' , 'images/fleet/stretch/pg/lm_w2.jpg' , 'images/fleet/stretch/pg/lm_w3.jpg' , 'images/fleet/stretch/pg/lm_w4b.jpg',
'images/fleet/stretch/pg/lm_w1_t.jpg' , 'images/fleet/stretch/pg/lm_w2_t.jpg' , 'images/fleet/stretch/pg/lm_w3_t.jpg' , 'images/fleet/stretch/pg/lm_w4b_t.jpg');
}
/* Stretch Limousine - Chrysler */
else if (pg=="pg_slc")
{
imagenames=new Array( 'images/fleet/stretch/pg/lm_s1.jpg' , 'images/fleet/stretch/pg/lm_s2.jpg' , 'images/fleet/stretch/pg/lm_s3.jpg', 'images/fleet/stretch/pg/lm_s4.jpg',
'images/fleet/stretch/pg/lm_s1_t.jpg' , 'images/fleet/stretch/pg/lm_s2_t.jpg' , 'images/fleet/stretch/pg/lm_s3_t.jpg' , 'images/fleet/stretch/pg/lm_s4_t.jpg');
}
/* Holden Caprice */
else if (pg=="pg_hc")
{
imagenames=new Array( 'images/fleet/executive/pg/hc_dg1.jpg', 'images/fleet/executive/pg/hc_dg3.jpg', 'images/fleet/executive/pg/hc_dg4.jpg', 'images/fleet/executive/pg/hc_b1.jpg',
'images/fleet/executive/pg/hc_dg1_t.jpg', 'images/fleet/executive/pg/hc_dg3_t.jpg', 'images/fleet/executive/pg/hc_dg4_t.jpg','images/fleet/executive/pg/hc_b1_t.jpg');
}
/* Aston */
else if (pg=="pg_at")
{
imagenames=new Array( 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage_l.jpg' , 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage2_l.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage3_l.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage4_l.jpg',
'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage_t.jpg' , 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage2_t.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage3_t.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage4_t.jpg');
}
/* Mercedes Benz Convertible */
else if (pg=="pg_mbc")
{
imagenames=new Array( 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv2_l.jpg' , 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv3_l.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv4_l.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv5_l.jpg',
'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv2_t.jpg' , 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv3_t.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv4_t.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv5_t.jpg');
}
/* BMW Convertible */
else if (pg=="pg_bmwc")
{
imagenames=new Array( 'images/fleet/wedding/pg/img_BMW_335CI_Conv_l.jpg' , 'images/fleet/wedding/pg/img_BMW_335CI_Conv_2_l.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_3_l.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_4_l.jpg',
'images/fleet/wedding/pg/img_BMW_335CI_Conv_t.jpg' , 'images/fleet/wedding/pg/img_BMW_335CI_Conv_2_t.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_3_t.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_4_t.jpg');
}
/* Casino Transfers - Star Express bussing */
else if (pg=="pg_scb")
{
imagenames=new Array( 'images/fleet/sc_bus/pg/scb_1.jpg' , 'images/fleet/sc_bus/pg/scb_2.jpg' , 'images/fleet/sc_bus/pg/scb_3.jpg', 'images/fleet/sc_bus/pg/scb_4.jpg',
'images/fleet/sc_bus/pg/scb_1_t.jpg' , 'images/fleet/sc_bus/pg/scb_2_t.jpg' , 'images/fleet/sc_bus/pg/scb_3_t.jpg', 'images/fleet/sc_bus/pg/scb_4_t.jpg');
}
/* Wedding Packages */
else if (pg=="pg_wp")
{
imagenames=new Array( 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage2_l.jpg' , 'images/fleet/wedding/pg/img_BMW_7_l.jpg' , 'images/fleet/executive/pg/740_2010_1.jpg', 'images/fleet/executive/pg/740_2010_2.jpg', 'images/fleet/wedding/pg/img_Merc_S500L_2_l.jpg', 'images/fleet/executive/pg/s500L_2007_b1.jpg', 'images/fleet/executive/pg/s500L_2007_s2c.jpg', 'images/fleet/wedding/pg/img_Mas_l.jpg', 'images/fleet/wedding/pg/img_Chr_l.jpg','images/fleet/stretch/pg/lm_s2.jpg' , 'images/fleet/stretch/pg/lm_s3.jpg', 'images/fleet/wedding/pg/img_BMW_7_4_l.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_l.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv_l.jpg', 'images/fleet/wedding/pg/img_Chr2_l.jpg', 'images/fleet/wedding/pg/img_Chr3_l.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage3_l.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv2_l.jpg', 'images/fleet/wedding/pg/img_Ferrari_l.jpg', 'images/fleet/wedding/pg/img_LTD_Ford_l.jpg', 'images/fleet/wedding/pg/img_Chr4_l.jpg',
'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage2_t.jpg' , 'images/fleet/wedding/pg/img_BMW_7_t.jpg' , 'images/fleet/executive/pg/740_2010_1_t.jpg', 'images/fleet/executive/pg/750_3_t.jpg', 'images/fleet/wedding/pg/img_Merc_S500L_2_t.jpg', 'images/fleet/executive/pg/s500L_2007_b1_t.jpg', 'images/fleet/executive/pg/s500L_2007_s2c_t.jpg', 'images/fleet/wedding/pg/img_Mas_t.jpg', 'images/fleet/wedding/pg/img_Chr_t.jpg', 'images/fleet/stretch/pg/lm_s2_t.jpg' , 'images/fleet/stretch/pg/lm_s3_t.jpg', 'images/fleet/wedding/pg/img_BMW_7_4_t.jpg', 'images/fleet/wedding/pg/img_BMW_335CI_Conv_t.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv_t.jpg', 'images/fleet/wedding/pg/img_Chr2_t.jpg', 'images/fleet/wedding/pg/img_Chr3_t.jpg', 'images/fleet/wedding/pg/img_Aston_Martin_V8_Vantage3_t.jpg', 'images/fleet/wedding/pg/img_Mercedes-Benz-CLK-Conv2_t.jpg', 'images/fleet/wedding/pg/img_Ferrari_t.jpg', 'images/fleet/wedding/pg/img_LTD_Ford_t.jpg', 'images/fleet/wedding/pg/img_Chr4_t.jpg');
}
/* Club Royale */
else if (pg=="pg_cr")
{
imagenames=new Array( 'images/sydney_tours/pg/loft/loft_1.jpg' , 'images/sydney_tours/pg/loft/loft_2.jpg' , 'images/sydney_tours/pg/loft/loft_3.jpg', 'images/sydney_tours/pg/loft/loft_4.jpg', 'images/sydney_tours/pg/favela/favl_1.jpg', 'images/sydney_tours/pg/favela/favl_2.jpg', 'images/sydney_tours/pg/favela/favl_3.jpg', 'images/sydney_tours/pg/favela/favl_4.jpg', 'images/sydney_tours/pg/favela/favl_6.jpg', 'images/sydney_tours/pg/favela/favl_7.jpg', 'images/sydney_tours/pg/ruby_rabbit/dnom_1b.jpg', 'images/sydney_tours/pg/ruby_rabbit/dnom_2b.jpg',
'images/sydney_tours/pg/loft/loft_1_t.jpg' , 'images/sydney_tours/pg/loft/loft_2_t.jpg' , 'images/sydney_tours/pg/loft/loft_3_t.jpg', 'images/sydney_tours/pg/loft/loft_4_t.jpg', 'images/sydney_tours/pg/favela/favl_1_t.jpg', 'images/sydney_tours/pg/favela/favl_2_t.jpg', 'images/sydney_tours/pg/favela/favl_3_t.jpg', 'images/sydney_tours/pg/favela/favl_4_t.jpg', 'images/sydney_tours/pg/favela/favl_6_t.jpg', 'images/sydney_tours/pg/favela/favl_7_t.jpg', 'images/sydney_tours/pg/ruby_rabbit/dnom_1b_t.jpg', 'images/sydney_tours/pg/ruby_rabbit/dnom_2b_t.jpg');
}

if(NS4){
//alert("NS4");
perouter=document.perouter;
perdone=document.perouter.document.layers[0].document.perdone;
}
if(NS6){
//alert("NS6");
perouter=document.getElementById('perouter');
perdone=document.getElementById('perdone');
}
if(IE4){
//alert("IE4");
perouter=document.all.perouter;
perdone=document.all.perdone;
}

/* Do not show "Loading Images..." for Wedding Packages or Club Royale */
if ((pg != "pg_wp") && (pg != "pg_cr"))
{
        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];
//alert(images[n].src);
setTimeout('checkload('+n+')' ,n*100);
}
}


function setouterpos(){
var ww=(IE4)? document.body.clientWidth : window.innerWidth;
var x=(ww-barwidth)/2 - 238;

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(){
var blocksize=barwidth/(imagenames.length);
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;

// Images finished loading
setVehicleValues(pg);
}


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;

