
function debug_alert() { }

function callFunction(img, x, y, triggerBackground, dsx, dsy) {

    debug_alert('Entered callFunction for ' + img + ' with ' + x + 'x' + y
	  + ' and triggerBackground=' + triggerBackground 
	  + ' dsx=' + dsx + ' dsy=' + dsy);

    if (!document.getElementById) {
	debug_alert('Sorry, document.getElementById isn\'t supported.');
	return;
    }

	var o = document.getElementById('display_imageHolder');

	var action = 'url(' + img + ')';

	var new_x = Math.round ( (dsy / y) * x );

	if (triggerBackground)
		document.body.style.backgroundImage = action;

	if (!o) return;

	debug_alert('Setting o.src to ' + img);

	o.src = img;
	o.width = new_x;

	}

function show_and_scale(img, x, y, final_width, sitePrefs) {

	var str = '';

	var final_height = Math.round( (final_width / x) * y );

	str += '<div class="thumb"><a href="#" title="">'
	+ '<img '
	+ 'onMouseOver=\'callFunction("' + img + '", "' + x + '", "' + y + '", ' + sitePrefs.triggerBackground + ', ' + sitePrefs.displaySet.x + ', ' + sitePrefs.displaySet.y + ')\' src="' + img + '" width="' + final_width
	+ '" height="' + final_height + '"></a></div>';

	return str;

	}


function row_scale(base_pth, irows, final_width, extension, sitePrefs) {

	var str = '';

	var row, count;

	var items = irows.length;

	for (count = 0; count < items; count++) {

	row = irows[count];

	str += show_and_scale(base_pth + row.filename + extension, row.x, row.y, final_width, sitePrefs);	

	}

	return str;

	}


