// JavaScript Document


// Macromedia functions:
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];}
}


// match css column heights:
function fixColumnHeights()
{
		var heightContent = 0;
		var leftHeight = 0;
		var rightHeight = 0;

		leftHeight = document.getElementById('leftMain').offsetHeight;				// Get initial height of left column
		rightHeight = document.getElementById('rightMain').offsetHeight;			// Get initial height of right column
		
				
		// Get tallest column height by checking left and right column		
		if ((rightHeight) > (leftHeight)) {
			heightContent = document.getElementById('rightMain').offsetHeight;	// Set new height to tallest column
		} else {
			heightContent = document.getElementById('leftMain').offsetHeight;		// Set new height to tallest column
		}
		
		// IE or not IE?
		if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0) // if IE then:
		{
				document.getElementById('leftMain').style.setAttribute('height', heightContent + 'px');		// set the new height
				document.getElementById('rightMain').style.setAttribute('height', heightContent + 'px');	// set the new height
				document.getElementById('content').style.setAttribute('height', heightContent + 'px');		// set the new height
				document.getElementById('rightContainer').style.setAttribute('height', heightContent + 'px'); // set the new height
		}
		else // if not IE then:
		{
				document.getElementById('leftMain').style.setProperty('height', heightContent + 'px', null); // set the new height
				document.getElementById('rightMain').style.setProperty('height', heightContent + 'px', null); // set the new height
				document.getElementById('content').style.setProperty('height', heightContent + 'px', null); // set the new height
				document.getElementById('rightContainer').style.setProperty('height', heightContent + 'px', null); // set the new height
				
				/*//msg1 = 'left: ' + document.getElementById('leftMain').offsetHeight + ', right: ' + document.getElementById('rightMain').offsetHeight + ', newheight: ' + heightContent;
				msg2 = 'left: ' + document.getElementById('leftMain').style.getPropertyValue('height') + ', right: ' + document.getElementById('rightMain').style.getPropertyValue('height') + ', newheight: ' + heightContent;
				//alert(msg1);
				alert(msg2);*/
		}
}


function alternateRowColors() {
	var classNameOne = 'tableBasic';
	var rowcolor = '#e1e7eb';
	var rows, arow;
	var tables = document.getElementsByTagName("table");
	var rowCount = 2; // how many rows to skip

	
	for(var kk=0; kk<tables.length; kk++) {
		//dump(tables.item(i).className + " " + tables.item(i).nodeName + "\n");
		if(tables.item(kk).className == classNameOne) {
			atable = tables.item(kk);
			rows = atable.getElementsByTagName("tr");
			for(var jj=0;jj<rows.length;jj++) {
				arow = rows.item(jj);
				if(arow.nodeName == "TR") {
					if(rowCount % 2) {
						arow.style.backgroundColor = rowcolor;
					} else {
						// default case
					}
					rowCount++;
				}
			}
			rowCount = 0;
		}
		
	} //end main For Loop
	
}


function firstLoad() {
	MM_preloadImages('../images/nav/nav_home_f2.gif','../images/nav/nav_company_f2.gif','../images/nav/nav_products_f2.gif','../images/nav/nav_employment_f2.gif','../images/nav/nav_reps_f2.gif','../images/nav/nav_r1_c5_f2.gif','../images/nav/nav_contact_f2.gif');
	fixColumnHeights();
	alternateRowColors();
}
