﻿// JScript File

// this function open the URL passed by parameter 
//on the same page or another

function openPage(url,self){
    if (url.length > 0 ){
        if (self){
            document.location.href=url;
        }
        else {
            window.open(url);
        }
    }
}

function enterKeyAsSubmit(buttonClientId){
    try {
        if(event.which || event.keyCode){
            if ((event.which == 13) || (event.keyCode == 13)) {
                    document.getElementById('" + buttonClientId + "').click();
                    return false;
            }
        } else {return true}; 
    }
    catch(e){}
}

function displayOrNot(id) { 
  aValue=document.getElementById(id).style.display;
  if (aValue !="block") {aValue="block";} else {aValue="none";}
  document.getElementById(id).style.display=aValue;
}

function changeTitleBasedOn(idDivToTest, IdToChange,textWhenHide,textWhenShow) { 
  aValue=document.getElementById(idDivToTest).style.display;
  if (aValue =="block") {document.getElementById(IdToChange).innerHTML=textWhenShow;} 
  if (aValue =="none") {document.getElementById(IdToChange).innerHTML=textWhenHide;} 

}
