function addEvent(elm, evType, fn, useCapture)
	{
	if (elm.addEventListener)
		{
		elm.addEventListener(evType, fn, useCapture);
		return true;
		}
	else
		if (elm.attachEvent)
			{
			var r = elm.attachEvent('on' + evType, fn);
			return r;
			}
		else
			elm['on' + evType] = fn;
	}

function setTall()
	{
	if (document.getElementById)
		{
		var divs = new Array(document.getElementById('content'), document.getElementById('features'), document.getElementById('leftbar'));
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++)
			if (divs[i] != null)
				if (divs[i].offsetHeight > maxHeight)
					maxHeight = divs[i].offsetHeight;
		var otherHeights = 322 + document.getElementById('footer').offsetHeight;
		maxHeight = Math.max(maxHeight, document.documentElement.clientHeight - otherHeights);
		for (var i = 0; i < divs.length; i++)
			{
			if (divs[i] == null)
				continue;
			divs[i].style.height = maxHeight + 'px';
			if (divs[i].offsetHeight > maxHeight)
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	posImage();
	}

addEvent(window, 'load', setTall, false);
//addEvent(window, 'resize', setTall, false);

function posImage()
	{
	if (document.getElementById)
		{
		var el = document.getElementById('headerimage');
		if (document.body.clientWidth > 1024)
			{
			el.style.left = '';
			el.style.right = '20px';
			}
		else
			{
			el.style.left = '797px';
			el.style.right = '';
			}
		}
	} 
function showOrder()
	{
	window.name='origin';
	var w = window.open('','order',
		'width=500,height=400,resizable,scrollbars,status,top=10,left=10');
	w.document.clear();
	w.focus();
	return true;
	}
function showProduct(pic)
	{
	var w = window.open('', 'product', 'width=350,height=400,resizable,scrollbars,top=20,left=30');
	var d = w.document;
	d.write('<html><head><title>Simplycrafts close up</title></head><body bgcolor="white" leftmargin="6" topmargin="6">');
	d.write('<center><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center">');
	d.write('<img src="/products/largeimages/' + pic + '">');
	d.write('</td></tr><tr><td align="center"><form>');
	d.write('<input type="button" value="Close this window" onClick="window.close();">');
	d.write('</form></td></tr></table></center></body></html>');
	d.close();
	w.focus();
	return false;
	}
function showPic()
  {
	var w = window.open('','gallery',
	    'width=700,height=700,resizable,scrollbars,status,left=0,top=0');
	w.document.clear();
	w.focus();
	return true;
	}
function showWin()
  {
  var w = window.open('','popup',
      'width=500,height=400,resizable,scrollbars,status,left=80,top=80');
  w.document.clear();
  w.focus();
  return true;
  }
function adjustLayout()
	{
posImage();
	var hHeight = 322;
	var cHeight = xHeight("content");
	var fHeight = xHeight("footer");
	var lHeight = xHeight("leftbar");
	var rHeight = xHeight("features");
	var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
	maxHeight = Math.max(maxHeight, document.body.clientHeight - hHeight - fHeight) - 1;
	xHeight("content", maxHeight);
	xHeight("leftbar", maxHeight);
	xHeight("features", maxHeight);
	}
// end x.js
function showWin()
  {
	var w = window.open('','popup',
	    'width=500,height=550,resizable,scrollbars,status,left=20,top=20');
	w.document.clear();
	w.focus();
	return true;
	}
function mailIt()
	{
  var contact = "Holiday Haven";
  var email = "info";
  var emailHost = "holidayhaven.com.au";
  document.write('<a class="email" href="' + 'mail' + 'to:' + email + '@' + emailHost + '">' + contact + '</a>');
	}
