//=============================================================================
//Program:		South Mountain Community College Channel General Include File
//Version:		0.02
//Author:		Scott Cate, modified by Stephen Heitz, modified by CKubit
//Date:			04/06/2004
//Last Modified:	3/14/2011
//=============================================================================

// Image rollovers for small promo
if (document.images) {
    smallpromohomebuttonup       = new Image();
    smallpromohomebuttonup.src   = "http://www.southmountaincc.edu/SouthMountainCmsWeb/Shared/common/images/home/smallpromohomebutton.jpg" ;
    smallpromohomebuttondown     = new Image() ;
    smallpromohomebuttondown.src = "http://www.southmountaincc.edu/SouthMountainCmsWeb/Shared/common/images/home/smallpromohomebuttondown.jpg" ;
}
function buttondown( buttonname )
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "down.src" );
    }
}
function buttonup ( buttonname )
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "up.src" );
    }
}
// End Image rollovers


//Set on key event handler to the function that will force a search to occur.
document.onkeydown = function() { keyListen(event) };
// event.preventDefault();
// event.stopPropagation();

function keyListen(e) {
   var btn;   
   if (document.location.href.indexOf('www.southmountaincc.edu') > -1) {
		btn = document.getElementById('HomePageLeftNav1_TopSearch1_SearchButton');
   }
   else {
	   btn = document.getElementById('TopAndLeftNav1_TopSearch1_SearchButton');
   }

    var keycode = e.keyCode;
    if (btn != null)  
	{
        if(keycode == '13') {  // Enter Key
				btn.focus();
				btn.click();
				event.keyCode = 0;
				return true;
        }
	}
	return false;
}

function callkeydownhandler(evnt) {
   ev = (evnt) ? evnt : event;
   keyListen(ev);
}

if (window.document.addEventListener) {
   window.document.addEventListener("keydown", callkeydownhandler, false);
} else {
   window.document.attachEvent("onkeydown", callkeydownhandler);
}




function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

