﻿// JScript File

/*	Since the left and right columns have had their CSS "position" attributes set to "absolute"
	(left and right "floats" would interfere with the ability to use floats within the various
	content areas across all browsers), the "resizeElements" function has been added to assure
	that the document body will always be tall enough to accomodate all content vertically.
	
	The real, rendered height of each of the left, middle, and right columns is compared. Since
	the middle column is the only one not set to absolute positioning and therefore the only one
	capable of affecting the overall height of the document, its minimum height is set to 
	greatest rendered height of the three columns.
*/
function resizeElements() {
    var leftColumn = document.getElementById("leftColumn");
    var middleColumn = document.getElementById("middleColumn");
    var rightColumn = document.getElementById("rightColumn");
	
	try {
		var minColHeight = Math.max(leftColumn.offsetHeight, Math.max(middleColumn.offsetHeight,rightColumn.offsetHeight));
		
		// don't do anything if the middle column is already tall enough, since this action will
		// flicker on some browsers			
		if(minColHeight > middleColumn.offsetHeight) {
			// technically, "height" is for IE and "minimumHeight" is for all other browsers...
			// but these don't conflict for our purposes here, so there's no need to 'browser sniff'
			middleColumn.style.height = minColHeight + "px";
			middleColumn.minimumHeight = minColHeight + "px";
		}
	} catch(ex) {}
}

if(window.attachEvent) {
    window.attachEvent("onload",resizeElements);
	/*
		"resizeElements" can also be attached to the window's "onresize" event handler...
		There's no need to do so now (+ it causes flicker on redraw) since each
		of the elements under consideration has a fixed width. HOWEVER, should any of the
		elements be modified to dyamically resize in the future, uncomment the following line.
	*/
    //window.attachEvent("onresize",resizeElements);
} else if(window.addEventListener) {
    window.addEventListener("load",resizeElements,false);
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

MM_preloadImages(
'images/logo/3rd-party/bmw_sm.gif',
'images/logo/3rd-party/mastercard_sm.gif',
'images/logo/3rd-party/molson_canadian_sm.gif',
'images/logo/3rd-party/pepsi_sm.gif',
'images/logo/3rd-party/penfolds_sm.gif',
'images/logo/3rd-party/extra_sm.gif',
'images/logo/3rd-party/407_etr_sm.gif',
'images/logo/3rd-party/woodbine_sm.gif'
);
