function TypeOf(x)
{
  var t = typeof(x);
  if (t == "object" && x != null)
  {
    if (typeof(x.constructor) != "undefined")
    {
      var ctor = new String(x.constructor);
      var chStart = ctor.indexOf("function");
      var chEnd = ctor.indexOf("(");
      if (chStart != -1 && chEnd != -1)
      {
        ctor = ctor.substring(chStart+9,chEnd);
        if (ctor == "Array" || ctor == "Date" || ctor == "String" || ctor == "Number" || ctor == "Boolean")
          t = ctor.toLowerCase();
      }
    }
  }
  return t;
}
function SetDate(Name, Value){
  var f = GetFormOf(Name);
  if (!f) {
    return;
  }
  var d,m,y, theDatel
  if (TypeOf(Value)=='date') {
    theDate = Value;
  }
  else {
    if (typeof(Value) == 'String') {
      theDate = Date.parse(Value);
      if ( isNaN(theDate)) {
        theDate = new Date();
      }
    }
    else {
       theDate = new Date();
    }
  }
  d = theDate.getDate();
  m = theDate.getMonth();
  y = theDate.getFullYear();
  f[Name+"_Date"].value = d;
  f[Name+"_Year"].value = y;
  f[Name+"_Month"].options[m].selected = true;
}
function GetFormOf(CtrlName){
  var i, j, l;
  l = CtrlName.length
  for (i = 0; i<document.forms.length ; i++){
    for (j = 0; j<document.forms[i].length ; j++){
    if ( document.forms[i][j].name.substring(0,l) == CtrlName){
      return (document.forms[i]);
      }
  }
  }
  return null;
}
function OnInfoCenter(TopicsID){
  win = window.open("http://icenter.sbank.ru/topics.asp?TopicsID="+TopicsID, "Info", "width=462,height=480,toolbar=yes,status=no,location=no,menu=no,scrollbars")
  win.focus()
}

function CheckSign(){
  if (typeof(Obj.KeyPath)=="undefined") {
    document.all['sign'].innerHTML='<table width="100%"><tr bgcolor="FFCC66" ><td width="100%" align="center">'+
            '<img border=0 align=absMiddle src="images/alert.gif" width=19 height=17>'+'Для работы с' +
            ' подсистемой документы вам необходимо установить программу генерации<br>' +
            '&nbsp;электронной подписи. Для установки программы нажмите <a href="downAX.asp?Src=welcome.asp">здесь.</a></td></tr></table>'
  }
}
