if ('undefined' == typeof String.prototype.ltrim) {
  String.prototype.ltrim = function() {
    return this.replace(/^\s+/, '');
  }
}

if ('undefined' == typeof String.prototype.rtrim) {
  String.prototype.rtrim = function() {
    return this.replace(/\s+$/, '');
  }
}

if ('undefined' == typeof String.prototype.trim) {
  String.prototype.trim = function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  }
}

function OpenPhoto(img, w, h, title){
  if (w && h) {
    if (w > screen.availWidth || h > screen.availHeight) {
      if (w / screen.availWidth > h / screen.availHeight) {
        h *= screen.availWidth / w;
        w = screen.availWidth;
      }
      else {
        w *= screen.availHeight / h;
        h = screen.availHeight;
      }
    }
    if (!title) title = 'Просмотр фотографии';
    var win = window.open("", "_blank", "width="+w+", height="+h);
    win.document.write("<html><head>\n");
    win.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">\n");
    win.document.write("<title>"+title+"</title></head>\n");
    win.document.write("<body style=\"padding: 0; margin: 0; cursor: hand;\">\n");
    win.document.write("<img src=\""+img+"\" width=\""+w+"\" height=\""+h+"\" alt=\""+title+"\" title=\""+title+"\" onclick=\"window.close()\">\n");
    win.document.write("</body></html>");
    win.focus();
  }
}



function SetTime(){
  var vladtime = document.getElementById('vladtime');
  vladtime.innerHTML = GetTime(10);
  var tokiotime = document.getElementById('tokiotime');
  tokiotime .innerHTML = GetTime(9);
  var mosctime = document.getElementById('mosctime');
  mosctime.innerHTML = GetTime(3);

  var timer=setTimeout('SetTime()',1000);
}

function GetTime(GMT)  {
  dateObjectName = new Date();
  time = dateObjectName.toGMTString();
  time = time.split(' ');
  time = time[4].split(':');
  hours = time[0] - 1 + 1 + GMT;
  minutes = time[1];
  seconds = time[2];
  hours = (hours >= 24)? hours - 24: hours;
  return hours+':'+minutes+':'+seconds;
}











