/*

        script.js - Javascript functions

                   Client: Fastener Unlimited, Inc.
                   Author: Steven Dahlman, DCM Software
               Start date: 07-12-04
        Last modification: 10-08-07

*/

//
// Function:    openwindow()
//
// Description: Open document in new window
//
// Input:
// sURL    = Document URL (e.g., "about.htm")
// wwidth  = window width (pixels)
// wheight = window height (pixels)
// sbars   = "yes" to display scroll bars or "no" to not display scroll bars
//
// Return code:
//  0 = Successful
//
// -Center new window on screen
// -Do not display directory buttons, location field, menu bar, status bar, or toolbar
// -Window is resizable
//
function openwindow (sURL, wwidth, wheight, sbars) {

	var wleft = (screen.width - wwidth) / 2;
	var wtop = (screen.height - wheight) / 2;

	var sFeatures = 'top=' + wtop + ',left=' + wleft + ',height=' + wheight + ',width=' + wwidth + ',scrollbars=' + sbars + ',directories=no,location=no,menubar=no,resizable=yes,status=no,toolbar=no';

	window.open(sURL,'_blank',sFeatures);

	return(0);

}

//
// Function:    slideshow()
//
// Description: Display images as slideshow
//
// Input:
// imgno = Image number (1-4) to display
//
// -Display in "slide" SPAN id on home page
// -To call, place in BODY tag: onload="slideshow(1);"
//
// Return code:
//  0 = Successful
//
function slideshow (imgno) {

	if ( imgno == 1 ) {
		//
		// Preload images
		//
		img1 = new Image(150,150);
		img2 = new Image(150,150);
		img3 = new Image(150,150);
		img4 = new Image(150,150);

		img1.src = "image/keylock_install_1.jpg";
		img2.src = "image/keylock_install_2.jpg";
		img3.src = "image/keylock_install_3.jpg";
		img4.src = "image/keylock_install_4.jpg";
	}

	document.getElementById('slide').innerHTML = '<IMG src="image/keylock_install_' + imgno + '.jpg"></IMG>';

	if ( imgno == 4 ) {
		imgno = 1;
	} else {
		imgno = imgno + 1;
	}

	// After duration, call this function again and display next image
	setTimeout('slideshow(' + imgno + ')', 2500);

	return(0);

}
