
var sInfinate="false";
var sKillAll="false";
var totalSec=1200;
var minSec=60;

//'--------------------------------------------------------------------
//' startTimer()
//'--------------------------------------------------------------------
function startTimer(objElementName,strAction){
 if(initiate_ajax(0)==false){
  //Browser does not support ajax
  document.getElementById('sessionTimerControls').style.display="none";
  document.getElementById(""+objElementName+"").style.cursor="pointer";
  document.getElementById(""+objElementName+"").onmouseover="alert();";
  strShowTip = '"<b>Browser Not Supported</b><br>Your internet browser does not meet the necessary requirements to support all features of the hh2 Project Center. Some features may not work properly."';
  document.getElementById(""+objElementName+"").innerHTML="<span onmouseover='showtip("+strShowTip+",200);' onmouseout='hidetip();'><img src='http://images.hh2.com/Legacy/warning.gif' style='vertical-align:middle;'>&nbsp;<font color='#7E1F1F'><b>WARNING!</b></font></span>";
 }
 else{
  updateSessionTimer(objElementName,strAction);
 }
}

//'--------------------------------------------------------------------
//' updateSessionTimer()
//'--------------------------------------------------------------------
function updateSessionTimer(objElementName,strAction){

 if(isObject(document.getElementById(""+objElementName+""))==false){
  return false;
 }

 //Infinate Keep-Alive
 if(strAction=="keepAlive"){
  keepAlive("action=keepAlive");
  setTimeout("updateSessionTimer('"+objElementName+"','keepAlive');",60000);
  return false;
 }

 if(totalSec<=0){
  terminateSession(strAction);
  return true;
 }
 else{
  totalSec = (totalSec - 1);
  minSec = (minSec-1);
  var sMin = parseInt(totalSec/60);
   if(sMin<=9){
    sMin="0"+sMin;
   }
  if(minSec==0){
   sSec="00";
   minSec=60;
   keepAlive("action=keepAlive");
  }
  else{
   if(minSec<=9){
    sSec="0"+minSec;
   }
   else{
    sSec=minSec;
   }
  }
  if(sInfinate=="false"){
   if(totalSec<=180){
    document.getElementById(""+objElementName+"").innerHTML="<font color='#7E1F1F'><b>"+sMin+":"+sSec+"</b></font>";
   }
   else{
    document.getElementById(""+objElementName+"").innerHTML=sMin+":"+sSec;
   }
  }
  else{
   return false;
  }
  setTimeout("updateSessionTimer('"+objElementName+"','"+strAction+"');",1000);
 }
}

//'--------------------------------------------------------------------
//' terminateSession()
//'--------------------------------------------------------------------
function terminateSession(strAction){
 //Fade Out Window
 var intZIndex = getZMax();
 document.getElementById('sessionTimeoutScreenDiv').style.width=document.body.clientWidth+document.body.scrollLeft;
 document.getElementById('sessionTimeoutScreenDiv').style.height=document.body.clientHeight+document.body.scrollTop;
 document.getElementById('sessionTimeoutScreenDiv').style.left="0px";
 document.getElementById('sessionTimeoutScreenDiv').style.top="0px";
 document.getElementById('sessionTimeoutScreenFrame').style.width=document.body.clientWidth+document.body.scrollLeft;
 document.getElementById('sessionTimeoutScreenFrame').style.height=document.body.clientHeight+document.body.scrollTop;
 document.getElementById('sessionTimeoutScreenFrame').style.left="0px";
 document.getElementById('sessionTimeoutScreenFrame').style.top="0px";
 document.getElementById('sessionTimeoutScreenDiv').style.display="block";
 document.getElementById('sessionTimeoutScreenFrame').style.display="block";

 document.getElementById('sessionTimeoutBoxDiv').style.width = "375px";
 document.getElementById('sessionTimeoutBoxFrame').style.width = "375px";
 document.getElementById('sessionTimeoutBoxDiv').style.height = "275px";
 document.getElementById('sessionTimeoutBoxFrame').style.height = "275px";
 document.getElementById('sessionTimeoutBoxFrame').style.zIndex = intZIndex;
 document.getElementById('sessionTimeoutBoxDiv').style.zIndex = (intZIndex + 1);
 document.getElementById('sessionTimeoutBoxFrame').style.display = "block";
 document.getElementById('sessionTimeoutBoxDiv').style.display = "block";
 document.getElementById('sessionTimeoutBoxDiv').style.left = ((document.body.clientWidth/2)-187)+document.body.scrollLeft+"px";
 document.getElementById('sessionTimeoutBoxFrame').style.left = ((document.body.clientWidth/2)-187)+document.body.scrollLeft+"px";
 document.getElementById('sessionTimeoutBoxDiv').style.top = ((document.body.clientHeight/2)-137)+document.body.scrollTop+"px";
 document.getElementById('sessionTimeoutBoxFrame').style.top = ((document.body.clientHeight/2)-137)+document.body.scrollTop+"px";
 getContent("/ajax/keep_alive.asp", document.getElementById('sessionTimeoutBoxDivContents'), 1, "status=wait&action="+strAction);
}