
// Code to handle popup messages and floating graphics

function showImage(ref) 
{
	var img = obj(ref);
	img.style.display = 'inline';
	img.src = img.src;						// reload
}

function hideImage(ref) 
{
	obj(ref).style.display = 'none';
}

function showLayer(ref) 
{
	obj(ref).style.display = 'block';
}

function hideLayer(ref) 
{
	obj(ref).style.display = 'none';
}

function showPopup(ref) 
{
	window.scroll(0,0);
	showLayer(ref + '_popup');
	showLayer('overlay');
	showLayer('overlay_dark');
}

function hidePopup(ref) 
{
	hideLayer(ref + '_popup');
	hideLayer('overlay');
	hideLayer('overlay_dark');
}

// writes or changes a general message
function msg(text)
{
	setText('msg',text);
	showLayer('msg');
	window.scroll(0,0);
}

// writes or changes an error message
function err(text)
{
	setText('err',text);
	showLayer('err');
	window.scroll(0,0);
}

/* CATALOGUE FUNCTIONS */
/* Titles and messages for popup help dialog */
var titles = new Array();
titles[0] = 'STEP 1';
titles[1] = 'STEP 2';
titles[2] = 'STEP 3';
titles[3] = 'STEP 4';

var messages = new Array();
messages[0] = 'To browse the top selling products in each category, click the appropriate button to the left.<br><b>Or</b><br>For an all inclusive search, select "View Full List" from the product categories below. Alternatively, select a product category from the search bar. For a more specific search, type a key word before clicking the arrow.';
messages[1] = 'Click button titled "More Info", or product name, to view additional detail on the product of choice.';
messages[2] = 'Click button titled "Add to Quote" to add a product to your list and then choose the desired quantity.';
messages[3] = 'Click button titled "Request Quote" to finalise details of your order/quote.<br> <br><b>NOTE:</b> You will be asked to supply a password. This can be obtained at any stage by filling out our contact form. Select "password" from the supplied list and STM will email the password to you.';

function dispMe(msgIndex) {
	setText('overTitle',titles[msgIndex]);
	setText('overMessage',messages[msgIndex]);
	showLayer('overDiv');
}
function closeIt() {
	hideLayer('overDiv');
}

/* Store for testing
	<a href="javascript://" onclick="showLayer('error')">SHOW ERRORS</a>
			<a href="javascript://" onclick="hideLayer('error')">HIDE ERRORS</a>
			<a href="javascript://" onclick="showLayer('msg');">SHOW MSG</a>
			<a href="javascript://" onclick="hideLayer('msg');">HIDE MSG</a>
			<a href="javascript://" onclick="err('Oops, an error!');">SHORT ERROR</a>
			<a href="javascript://" onclick="err('errorjk asdkj dhsakd kjhd kja djksah dkjsa hdj sahkjd hsakjh  djksah dkj sahdkjsah djksah jdh sajkd hsajkd j jksh djksh djksh dkjs hdjksa hdkjash dkjsah jh jdha sjdh ');">LONG ERROR</a>
			<a href="javascript://" onclick="msg('Oops, an error!');">SHORT MSG</a>
			<a href="javascript://" onclick="msg('errorjk asdkj dhsakd kjhd kja djksah dkjsa hdj sahkjd hsakjh  djksah dkj sahdkjsah djksah jdh sajkd hsajkd j jksh djksh djksh dkjs hdjksa hdkjash dkjsah jh jdha sjdh ');">LONG MSG</a>			
*/