/****************************************************
This JS library holds the various functions used through
out the site. 

****************************************************/

//this function takes the key press
//event and triggers the click 
//event for the passed-in element
function EnterKeyToOnlick(strObjId, e)
{
	if(!e)
	{
		e = window.event;		
	}
	
	if((e.keyCode && e.keyCode == 13) || 
		(e.which && e.which == 13))
	{
		document.getElementById(strObjId).click();
		return false; 
	}	
	else
		return true;
}



//checks the selected value for the passed-in drop-down
//if it equals testValue parm, then it show
//the element with the matching strID, else
//it hides the element with the matching strID
function DropDown_ShowHideArea(targetStrID, testValue, strID, endStrID)
{
   
    var dropdown = document.getElementById(targetStrID)
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
    
    //alert("id is " + strID);
    
    if(SelValue == testValue)
    {
		showSubMenu(strID);
		showSubMenu(endStrID);
    }
    else if(SelValue == "")
    {
		hideSubMenu(strID);
		hideSubMenu(endStrID);
    }
    else
    {
		showSubMenu(strID);
		hideSubMenu(endStrID);
	}
    
    return false;
}


//this function takes the key press
//event and triggers the click 
//event for the passed-in element
function ExecDoPostBack(strObjId, e)
{
	if(!e)
	{
		e = window.event;		
	}
	
	if((e.keyCode && e.keyCode == 13) || 
		(e.which && e.which == 13))
	{
		__doPostBack(strObjId,'');
		return false; 
	}	
	else
		return true;
}



function ReplaceClass(obj, clss) {
   obj.className = clss;
}

function Dropdownmenu(item, x, y) {
  // Hide all dropdown menus and display the selected one
  //
  for(i=0;i<2;i++) {
     if(i == item) {
        eval('dropdown'+i+'.Drop('+x+','+y+');');
     }else {
        eval('dropdown'+i+'.Collapse();');
     }
  }
}

function showSubMenu(strID) {
    document.getElementById(strID).style.display = 'block';    
}

function hideSubMenu(strID) {
    document.getElementById(strID).style.display = 'none';
}


//sets focus on the passed-in object
function setFocus(strID)
{
		document.getElementById(strID).focus();
}


