// schooltripprice.js by frank thx to QuirksMode
window.onload = init;

function init()
{
	optionTest = true;
	if (!document.getElementById)
		{ 
		optionTest = false;
		return;
		}

	initeventhandlers();		
} //end init

function initeventhandlers ()
{
	if (!optionTest) return;
	
	//if detailbuttons available attach handler, after pricecalc they are not there
	if (document.getElementById('detailbuttons')) { document.getElementById('detailbuttons').onclick = function () {document.getElementById('detailhide').style.display = 'block';} }
	
	if (document.getElementById('gallery'))	//if gallery images available attach handler
		{
	 	var galleryimagesarray = document.getElementById('gallery').getElementsByTagName('IMG');//get all the images in the gallery
		for (var i=0;i<galleryimagesarray.length;i++)	//assign the handlers to all the images in the gallery
			{
			galleryimagesarray[i].onmouseover = function () {document.getElementById('bigpicture').src = '/pictures/'+this.id.substring(1,15)+'.jpg';};
		    galleryimagesarray[i].onclick = function () {document.getElementById('bigpicture').src = '/pictures/'+this.id.substring(1,15)+'.jpg';};
			}
		}

	//hide details onload
	if (document.getElementById('detailhide')) {document.getElementById('detailhide').style.display = 'none';}
} // end initeventhandlers

