var ie4=document.all

function ChangeSize(ObjN,WS,HS,WE,HE,Time,NFrs,NextFunction,FrN){
  if(Debug == "On"){window.status = "ChangeSize: "+ObjN}
//  if(Bandwidth == "MODEM"  && ObjN.substr(0,3) == "Img" && ObjN.substr(3,1) != "1"){
//    ObjN = GetAlias(ObjN)
//  }
  Obj = document.getElementById(ObjN)
    if (FrN != null){
      W1 = parseInt(Obj.style.width)
      W2 = WS + (((WE - WS)/(NFrs-1)) * FrN)
      L1 = parseInt(Obj.style.left)
      XM = L1 + (W1/2)
      L2 = XM - (W2/2)
      H1 = parseInt(Obj.style.height)
      H2 = HS + (((HE - HS)/(NFrs-1)) * FrN)
      T1a = parseInt(Obj.style.top)
      YM = T1a + (H1/2)
      T2a = YM - (H2/2)
      Obj.style.height = Math.round(H2) + "px"
      Obj.style.width = Math.round(W2) + "px"
      Obj.style.left = Math.round(L2) + "px"
      Obj.style.top = Math.round(T2a) + "px"
      if (++FrN != NFrs){
        Start = setTimeout('ChangeSize("'+ObjN+'",'+WS+','+HS+','+WE+','+HE+','+Time+','+NFrs+',"'+NextFunction+'",'+FrN+')',Time);
      }
      else {
        CX = parseInt(Obj.style.left)
        CY = parseInt(Obj.style.top)
        if (NextFunction != null){
          eval(NextFunction)
        }
      }
    }
    else {
      Obj.style.width = WS
      Obj.style.height = HS
      Obj.style.visibility = "visible";
      Time = Time / NFrs;
      FrN = 1;
      Start = setTimeout('ChangeSize("'+ObjN+'",'+WS+','+HS+','+WE+','+HE+','+Time+','+NFrs+',"'+NextFunction+'",'+FrN+')',Time);
    }
}
function Date(ObjN){
  var months=new Array(12)
  months[0]="January"
  months[1]="February"
  months[2]="March"
  months[3]="April"
  months[4]="May"
  months[5]="June"
  months[6]="July"
  months[7]="August"
  months[8]="September"
  months[9]="October"
  months[10]="November"
  months[11]="December"
  var oDate=new Date()
  var Month=months[oDate.getMonth()]
  var Day=oDate.getDate()
  var Year=oDate.getYear()
  Year < 2000 ? Year += 1900 : {}
  DateStr = Month + "/" + Day + "/" + Year
  Obj = document.getElementById(ObjN)
  alert(Obj.innerHTML)
}
function Dec2Hex(DecNum){
  DecInt = Math.floor(DecNum)
  if (DecInt > 15) HexStr = DecInt.toString(16)
  else HexStr = "0" + DecInt.toString(16)
  return HexStr
}

function Delay(Time, FunctName, FirstTime){
  if (Debug == "on") {window.status = "Delay: "+FunctName}
  if (FirstTime != null && StopRGo != "Stop"){
//    if (SneakinAllow == "Yes"){
//      ContinuousActivityManager()      
//    }
    eval(FunctName)
  }
  else {
    FirstTime = 1
    if (Time > D4  && MovieActive == "Yes" && SneakinAllow == "No"){
      SneakinAllow = "Yes"
      Start = setTimeout('ContinuousActivityManager()',T3+300)      
    }
    Start = setTimeout('Delay('+Time+',"'+FunctName+'",'+FirstTime+')',Time)
  }
} 

function Fade(ObjN, StartOpacity, EndOpacity, TotalTime, NFrs, FrN, OpacityInc){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  if (FrN > 0 ){
    SetOpacity(ObjN, Math.floor(StartOpacity + (OpacityInc * FrN)),"null")
      if (++FrN != NFrs+1){
        Start = setTimeout('Fade("'+ObjN+'",'+StartOpacity+','+EndOpacity+','+TotalTime+','+NFrs+','+FrN+','+OpacityInc+')',TotalTime);
      }
    }
    else {
      if (Obj.style.width == null){
        Obj.style.width = eval('document.'+ObjN+'.width')
        Obj.style.height = eval('document.'+ObjN+'.height')
      }
      SetOpacity(ObjN, StartOpacity,"null")
      Obj.style.visibility =  "visible"
      OpacityInc = (EndOpacity - StartOpacity) / NFrs
      TotalTime = TotalTime / NFrs
      FrN = 1
        Start = setTimeout('Fade("'+ObjN+'",'+StartOpacity+','+EndOpacity+','+TotalTime+','+NFrs+','+FrN+','+OpacityInc+')',TotalTime);
    }
  
}

function FadeTxtColor(ObjN, RS, RE, GS, GE, BS, BE, Time, NFrs, NSeq, FunctName, FrN){
  if(Debug == "On"){window.status = "FadeTxtColor: "+ObjN}
  Obj = document.getElementById(ObjN);
  if (FrN != null){
    RVal = Dec2Hex(RS - ((RS - RE) / (NFrs)) * FrN)
    GVal = Dec2Hex(GS - ((GS - GE) / (NFrs)) * FrN)
    BVal = Dec2Hex(BS - ((BS - BE) / (NFrs)) * FrN)
    color = RVal+GVal+BVal
    Obj.style.color = color
    FrN == 1 ? Obj.style.visibility = "visible" :{}
    if (++FrN < NFrs+1){
      Start = setTimeout('FadeTxtColor("'+ObjN+'",'+RS+','+RE+','+GS+','+GE+','+BS+','+BE+','+Time+','+NFrs+','+NSeq+',"'+FunctName+'",'+FrN+')',Time)
    }
    if (FrN == NFrs+1) {
      if (--NSeq == 0){
        eval(FunctName)
      }
      else {
        FrN = 1
        R = RS
        G = GS
        B = BS
        RS = RE
        GS = GE
        BS = BE
        RE = R
        GE = G
        BE = B
        Start = setTimeout('FadeTxtColor("'+ObjN+'",'+RS+','+RE+','+GS+','+GE+','+BS+','+BE+','+Time+','+NFrs+','+NSeq+',"'+FunctName+'",'+FrN+')',Time)
      }   
    }
  }
  else {
    FrN = 1
    Time = Time / (NFrs - 1)
    Start = setTimeout('FadeTxtColor("'+ObjN+'",'+RS+','+RE+','+GS+','+GE+','+BS+','+BE+','+Time+','+NFrs+','+NSeq+',"'+FunctName+'",'+FrN+')',Time)
  }
}
function SetOpacity(ObjN,Op,FunctName){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  if (Obj.filters){
    Obj.filters.alpha.opacity=Op
  }
  else{
    if (Obj.style.MozOpacity){
      Obj.style.MozOpacity=Op/101
    }
  }
  if (FunctName != "null"){
    eval(FunctName)
  }
}

function GetXPosYPos(ObjN, FunctName){
  if(Debug == "On"){window.status = "GetXPosYPos: "+ObjN}
//  if(Bandwidth == "MODEM"  && ObjN.substr(0,3) == "Img" && ObjN.substr(3,1) != "1"){
//    ObjN = GetAlias(ObjN)
//  }
  Obj = document.getElementById(ObjN)
  XPos = parseInt(Obj.style.left)
  YPos = parseInt(Obj.style.top)
  if (FunctName != null) {
    eval(FunctName)
  }
}
function Hide(ObjN){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  Obj.style.visibility = "hidden"
}
function Move(ObjN,X,Y,W,H,FunctName){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  Obj.style.left = X + "px"
  Obj.style.top = Y + "px"
  if (W > 0) {
    Obj.style.width = W + "px"
  }
  else {
    if (W != null){
      eval(W)
    }
  }
  if (H != null){
    Obj.style.height = H + "px"    
  }
  if (FunctName != "null") {
    eval(FunctName)
  }
}

function MoveL(ObjN,XS,YS,XE,YE,Time,NFrs,FunctName,FrN,XI,YI){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
    if (FrN != -1){
      Obj.style.visibility = "visible"
      Obj.style.left = Math.floor(XS + (XI * FrN)) + "px";
      Obj.style.top = Math.floor(YS + (YI * FrN)) + "px";
      if (++FrN < NFrs){
        Start = setTimeout('MoveL("'+ObjN+'",'+XS+','+YS+','+XE+','+YE+','+Time+','+NFrs+',"'+FunctName+'",'+FrN+','+XI+','+YI+')',Time);
      }
      else {
        if (FunctName != "null"){
            eval(FunctName)
        }
      }
    }
    else {
      Obj.style.visibility = "hidden"
      Time = Time / (NFrs - 1);
      FrN = 0;
      XI = (XE - XS)/(NFrs - 1)
      YI = (YE - YS)/(NFrs - 1)
      Start = setTimeout('MoveL("'+ObjN+'",'+XS+','+YS+','+XE+','+YE+','+Time+','+NFrs+',"'+FunctName+'",'+FrN+','+XI+','+YI+')',Time);
    }
}
function Next(){
  eval(NextFunct)
}
function NextStep() {
  eval(NextRoutine)
}

function SetSize(ObjN,XW,YW,FunctName){
  if(Debug == "On"){window.status = "SetSize: "+ObjN}
//  if(Bandwidth == "MODEM"  && ObjN.substr(0,3) == "Img" && ObjN.substr(3,1) != "1"){
//    ObjN = GetAlias(ObjN)
//  }
  Obj = document.getElementById(ObjN);
  Obj.style.width = XW + 'px'
  Obj.style.height = YW + 'px'
  if (FunctName != null){
    eval(FunctName)
  }
}
function SetTxtColor(ObjN, HexColor){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  Obj.style.color = HexColor
}

function SetTxtSize(ObjN, Size,FunctName){
  if(Debug == "On"){window.status = "SetTxtSize: "+ObjN}
  Obj = document.getElementById(ObjN);
  Obj.style.fontSize = Size + "px"
  if (FunctName != null){
    eval(FunctName)
  }
}
function SetupNext(ObjN){
  NextRoutine = ObjN
}
function Show(ObjN){
	var Obj=ie4? eval("document.all." + ObjN) : document.getElementById(ObjN)
  Obj.style.visibility = "visible"
}
function ToggleDebug(){
  Debug == "On" ? Debug = "Off" : Debug = "On"
  Debug == "On" ? SetSpeed("Fast") : SetSpeed("Normal")
}
// extract front part of string prior to searchString
function StrGetFront(mainStr,searchStr){
foundOffset = mainStr.indexOf(searchStr)
if (foundOffset == -1) {
return null
}
return mainStr.substring(0,foundOffset)
}
// extract back end of string after searchString
function StrGetEnd(mainStr,searchStr) {
foundOffset = mainStr.indexOf(searchStr)
if (foundOffset == -1) {
return null
}
return mainStr.substring(foundOffset+searchStr.length,mainStr.length)
}
// insert insertString immediately before searchString
function StrInsertString(mainStr,searchStr,insertStr) {
var front = getFront(mainStr,searchStr)
var end = getEnd(mainStr,searchStr)
if (front != null && end != null) {
return front + insertStr + searchStr + end
}
return null
}
// remove deleteString
function StrDeleteString(mainStr,deleteStr) {
return replaceString(mainStr,deleteStr,"")
}
// replace searchString with replaceString
function StrReplaceString(mainStr,searchStr,replaceStr) {
var front = StrGetFront(mainStr,searchStr)
var end = StrGetEnd(mainStr,searchStr)
if (front != null && end != null) {
return front + replaceStr + end
}
return null
}
