function showImageSet1(){


var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = './img/photos/courses/padi/padi_elearning.gif'
theImages[1] = './img/photos/courses/padi/padi_elearning_openwater.gif'
theImages[2] = './img/photos/courses/padi/padi_erdpml.gif'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

document.write('<a href="http://www.padi.com" target="_blank"><img src="'+theImages[whichImage]+'" border="0" ></a>');
}

function showImageSet2(){


var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = './img/photos/courses/padi/padi_masterdiver.gif'
theImages[1] = './img/photos/courses/padi/padi_meritbadge.jpg'


var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

document.write('<a href="http://www.padi.com" target="_blank"><img src="'+theImages[whichImage]+'" border="0" ></a>');
}

function showImageSet3(){


var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = './img/photos/courses/padi/padi_godive.gif'
theImages[1] = './img/photos/courses/padi/padi_rescuediver.gif'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

document.write('<a href="http://www.padi.com" target="_blank"><img src="'+theImages[whichImage]+'" border="0" ></a>');
}

function showQuotation(){

var Quotation=new Array() // do not change this!

// Set up the quotations to be shown, below.
// To add more quotations, continue with the
// pattern, adding to the array.  Remember
// to increment the Quotation[x] index!

//Quotation[X] = "\"QUOTE\"<br/><br/>AUTHOR";
Quotation[0] = "\"Thank you so much for teaching the students...about scuba diving.It was a great experience for all of them.  One student summed up the trip when we got on the bus by asking if we could do this every day?\"<br/><br/>Connie Leverette from Wando High School on the Discover Scuba Program (January, 2010)";
Quotation[1] = "\"I guess it doesn't matter who gets this because you all ROCK!.... I wanted to let you know that your dive family has grown by 8.  They all learned a lot, felt very cared for and are looking forward to diving at the end of the month and beyond. Thanks for everything...\"<br/><br/>Jim Paczynski,  Adventure Scouts Group Aiken (May, 2009)";
Quotation[2] = "\"I am a 57 year old school teacher who has just completed my open water certification.  Sally Robinson, Jason and all the folks employed by Charleston Scuba were understanding, supportive and professional in all their classes and travel accommodations. Because of them, I was thrilled with my experience and proud of my accomplishments.  Without their humor, knowledge and expertise, I would not have been able to experience the underwater world of West Palm Beach, Fl.  My thanks to them for opening a new world to me.\"<br/><br/>A letter sent to PADI from Linda Bush (May, 2000)";
Quotation[3] = "\"I want to thank you for the wonderful diving  I experienced with Charleston Scuba on Sat., September 2007. Your entire operation is very professional and your crew was fun to be around.  I enjoyed meeting and being around everyone from Sally at the dive shop (early on a Sat. morning) to Captain Tom and Divemasters Katie and Matt. <br/><br/>Additionally, I met a wide variety of other divers on the boat who I enjoyed talking and diving with.  The diving was great, the crew was great and the weather was great.  I will recommend you to everyone I know and I look forward to diving again with you in the future.\"<br/><br/>Mark DeBrul, Mechanicsville, VA";
Quotation[4] = "\"Dear Michelle,<br/><br/>Thank you so much for spending hours digging through old records to find my PADI certification card; a random act of kindness that I will attempt to pass on.   Happy New Year and thanks,\"<br/><br/>Tomilee Hardy (January, 2010)";
Quotation[5] = "\"Dear Tom and Staff,<br/><br/>Officer John Lovett and myself were down for vacation in the first part of July.  We had the great opportunity to dive with your group.   The day was great and the shark was just a bonus.  In fact, the picture John took turned out great.<br/><br/>If everything works out, us Damn Yankees plan on coming back down to dive with your group.  It's nice to dive with professionals.\"<br/><br/>Ptlm. Patrick Kellogg, City of St. Mary's Police Dept. (July 24, 2000)";


var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));

document.write(Quotation[whichQuotation]);
}

function getHeader(){

var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = './img/header.jpg'
theImages[1] = './img/header1.jpg'
theImages[2] = './img/header2.jpg'
theImages[3] = './img/header3.jpg'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

document.write('<img class="img-header" src="'+theImages[whichImage]+'" alt="" border="0" />');
}


formatDate = function(incDate,format)
{
    var date = new Date(incDate);
    if (!format)
      format="MM/dd/yyyy";               
 
    var month = date.getMonth() + 1;
    var year = date.getFullYear();    
 
    format = format.replace("MM",month.toString().padL(2,"0"));        
 
    if (format.indexOf("yyyy") > -1)
        format = format.replace("yyyy",year.toString());
    else if (format.indexOf("yy") > -1)
        format = format.replace("yy",year.toString().substr(2,2));
 
    format = format.replace("dd",date.getDate().toString().padL(2,"0"));
 
    var hours = date.getHours();       
    if (format.indexOf("t") > -1)
    {
       if (hours > 11)
        format = format.replace("t","pm")
       else
        format = format.replace("t","am")
    }
    if (format.indexOf("HH") > -1)
        format = format.replace("HH",hours.toString().padL(2,"0"));
    if (format.indexOf("hh") > -1) {
        if (hours > 12) hours - 12;
        if (hours == 0) hours = 12;
        format = format.replace("hh",hours.toString().padL(2,"0"));        
    }
    if (format.indexOf("mm") > -1)
       format = format.replace("mm",date.getMinutes().toString().padL(2,"0"));
    if (format.indexOf("ss") > -1)
       format = format.replace("ss",date.getSeconds().toString().padL(2,"0"));
    return format;
}

String.repeat = function(chr,count)
{    
    var str = ""; 
    for(var x=0;x<count;x++) {str += chr}; 
    return str;
}
String.prototype.padL = function(width,pad)
{
    if (!width ||width<1)
        return this;   
 
    if (!pad) pad=" ";        
    var length = width - this.length
    if (length < 1) return this.substr(0,width);
 
    return (String.repeat(pad,length) + this).substr(0,width);    
}    
String.prototype.padR = function(width,pad)
{
    if (!width || width<1)
        return this;        
 
    if (!pad) pad=" ";
    var length = width - this.length
    if (length < 1) this.substr(0,width);
 
    return (this + String.repeat(pad,length)).substr(0,width);
} 
