/* Copyright 2007 by ELONISAS */

var imageshow_images = new Array();
var imageshow_ids = new Array();
var imageshow_main_img_src = '';
var imageshow_cnt = 0;
var imageshow_image_cnt = 0;
var imageshow_dom_available = (document.getElementById);
var imageshow_iebrowser_used = document.all;

function imageshow_add( imagetag ) {

	if (imageshow_iebrowser_used&&imageshow_dom_available||imageshow_dom_available) { //if IE5+ or modern browsers (ie: Firefox)
		imageshow_image_cnt++;
		imageshow_images[imageshow_image_cnt] = imagetag;
		if ( imageshow_image_cnt==1 ) {
			imageshow_ids[imageshow_image_cnt] = "products_image"; 
		} else {
			imageshow_ids[imageshow_image_cnt] = "products_image_" + imageshow_image_cnt;
		}
	} else {
		alert('Browser not supported!');
	}
	
} // end function imageshow_add()

function imageshow_write() {
	if (imageshow_iebrowser_used&&imageshow_dom_available||imageshow_dom_available) { //if IE5+ or modern browsers (ie: Firefox)
		if ( imgobj = document.getElementById('imageshow') ) {
			imgobj.innerHTML = '';
			for (i=1;i<=imageshow_image_cnt;i++){
				imgobj.innerHTML += imageshow_images[i];
			}
		}
	} else {
		alert('Browser not supported!');
	}
	
} // end function imageshow_write()

function imageshow_show( imageid ) {

	if (imageshow_iebrowser_used&&imageshow_dom_available||imageshow_dom_available) { //if IE5+ or modern browsers (ie: Firefox)
		if ( imgobj = document.getElementById('products_image') ) {
			// The first time the original img.src must be remembered
			if ( imageshow_main_img_src == '' ) {
				imageshow_main_img_src = imgobj.src;
			}
			imgobj.src = imageid.src;
		}
	} else {
		alert('Browser not supported!');
	}
	
} // end function imageshow_show()

function imageshow_default() {

	if (imageshow_iebrowser_used&&imageshow_dom_available||imageshow_dom_available) { //if IE5+ or modern browsers (ie: Firefox)
		if ( imgobj = document.getElementById('products_image') ) {
			// The original img.src must be restored
			if ( imageshow_main_img_src != '' ) {
				imgobj.src = imageshow_main_img_src;
			}
		}
	} else {
		alert('Browser not supported!');
	}
	
} // end function imageshow_show()

function imageshow_init() {

	// The first time the original img.src must be remembered
	if ( imgobj_main = document.getElementById('products_image') ) {
		if ( imageshow_main_img_src == '' ) {
			imageshow_main_img_src = imgobj_main.src;
		}
	}
	
} // end function imageshow_init()

function imageshow_run() {

	// The first time the original img.src must be remembered
	if ( imgobj_main = document.getElementById('products_image') ) {
		imageshow_init()
		// Switch the image
		if ( imageshow_cnt == 1 ) {
			imgobj_main.src = imageshow_main_img_src;
		} else {
			if ( imgobj_show = document.getElementById('products_image_'+imageshow_cnt) ) {
				imgobj_main.src = imgobj_show.src;
			}
		}
		// Skip to the next image or reset to the first
		if ( imageshow_cnt < 4 ) imageshow_cnt++; else imageshow_cnt = 1;
	}
	
} // end function imageshow_run()

// Call imageshow_init to start after loading page
imageshow_timer = setInterval( imageshow_init, 1 );

// Enable imageshow_run to start auto-cycle through images
//imageshow_timer = setInterval( imageshow_run,  7000 );
