// Default JavaScript file for site code

// Get the latest year

var today = new Date();
var thisYear = today.getFullYear();


// Random image selector (contact form)

var theImages = new Array()

theImages[0] = 'images/captcha_01.png'
theImages[1] = 'images/captcha_02.png'
theImages[2] = 'images/captcha_03.png'
theImages[3] = 'images/captcha_04.png'
theImages[4] = 'images/captcha_05.png'
theImages[5] = 'images/captcha_06.png'

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));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'" height="50" width="150" alt="Type the characters you see in this image into the box below" />');
}

// Random image selector (order form)

var theOrderImages = new Array()

theOrderImages[0] = '../images/captcha-order_01.png'
theOrderImages[1] = '../images/captcha-order_02.png'
theOrderImages[2] = '../images/captcha-order_03.png'
theOrderImages[3] = '../images/captcha-order_04.png'
theOrderImages[4] = '../images/captcha-order_05.png'
theOrderImages[5] = '../images/captcha-order_06.png'

var j = 0
var p = theOrderImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theOrderImages[i]
}
var whichOrderImage = Math.round(Math.random()*(p-1));
function showOrderImage(){
document.write('<img src="'+theOrderImages[whichOrderImage]+'" height="50" width="150" alt="Type the characters you see in this image into the box below" />');
}

// Open Pop-Up Windows Function
function open_win_welcomeemail()
{
window.open("../customer/resend-welcome-email.php","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=660, height=450")
}

// Bookmark script
function bookmark(url, title){

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
}
else if(document.all)// ie
    window.external.AddFavorite(url, title);
}
