﻿// This code is needed for every page driven by the cms.dwt template.
// The code executes upon page load to initialize dynamic behaviors of the site,
// including the top menu and the Apply Now button.

// jQuery must be loaded before this code runs.

$(document).ready(function() {
	// Fix the top menu for IE6
  if (CMS.isIE6() === true) {
   	document.getElementById('mainmenu-top').innerHTML = 
  	  document.getElementById('mainmenu-top').innerHTML.replace (/<ul/gi,"<table><tr><td><ul").replace (/<\/ul>/gi,"</ul></td></tr></table></a>");
  	for (i=0;i<document.getElementsByTagName("li").length; i++) {
  		if (document.getElementsByTagName("li").item(i).className == "hasdropdown") {
  			document.getElementsByTagName("li").item(i).innerHTML = document.getElementsByTagName("li").item(i).innerHTML.replace(/<\/a>/i,"");
  		};
  	};
  };
	// -- end top menu fix
	
  // Make the Apply Now button change img upon hover
	$("#applynow img").hover(
	  function() { this.src = this.src.replace( /_default\.gif$/, '_hover.gif' ); },
	  function() { this.src = this.src.replace( /_hover\.gif$/, '_default.gif' ); }
	);
	// -- end Apply Now hover behavior
});



