function _() {
}

//----

function startScrollDiv(scrDiv, viewDiv, dirn) {
	this.scrollingDiv = this[scrDiv];
	this.scrollViewDiv = this[viewDiv];
	this.scrollDivSpeed = dirn * 8;
	this.scrollDivMaxY = 0;
	this.scrollDivMinY = -parseInt(this.scrollingDiv.offsetHeight) + parseInt(this.scrollViewDiv.offsetHeight) - 30;
	
	setTimeout("this._scrollDiv();", 100);
}

function stopScrollDiv() {
	this.scrollDivSpeed = 0;
}

function _scrollDiv() {
	if (!Math.abs(this.scrollDivSpeed)) return;

	var y = parseInt(this.scrollingDiv.style.top) + this.scrollDivSpeed;
	if (y > this.scrollDivMaxY) {
		y = this.scrollDivMaxY;
		this.scrollDivSpeed = 0;
	} else if (y < this.scrollDivMinY) {
		y = this.scrollDivMinY;
		this.scrollDivSpeed = 0;
	}
	
	this.scrollingDiv.style.top = y;
	
	setTimeout("this._scrollDiv();", 100);
}

//----

function truncateTextarea(textarea, maxLength) {
	if (textarea.value.length > maxLength) textarea.value = textarea.value.slice(0, maxLength);
}

//----

function initSnippet(parentDiv, iniScrTop) {
	//this.forceIntoFrame("/novanet/");
	
	if (this.CtrlDiv)
		if (parseInt(this.ScrDiv.offsetHeight) >  parseInt(this.ScrPaneDiv.offsetHeight))
			this.CtrlDiv.style.visibility = "visible";
	
	if (this.ScrDiv)
		this.ScrDiv.style.top = (iniScrTop == "") ? 0 : iniScrTop;
	
	setTimeout("this.parent['" + parentDiv + "']" + ".style.visibility = 'visible';", 100);
}

function openURL(url) {
	window.open("/novanet/link.php?url=" + url, "aaa", "toolbar=1, menubar=1, location=1, status=1, scrollbars=1, resizable=1");
}

//----


//----

function changeColor(link, color) {
	link.style.color = color;
}

function changeCellColor(cell, color) {
	cell.style.background = color;
	cell.style.cursor = "arrow";
}

//----

function debugAtStatus(_str) {
  window.status = _str;
  
  var _task = "debugAtStatus('" + _str + "');";
  setTimeout(_task, 500);
}

function keepOutOfFrame() {
  if (window.top.location != window.self.location) window.top.location = window.self.location;
}

function forceIntoFrame(_fileFrameset) {
  if (window.top.location == window.self.location) window.top.location.href = _fileFrameset;
}

function getPlatform() {
  if (navigator.platform.indexOf("Win") >= 0) return "win";
  else if (navigator.platform.indexOf("Mac") >= 0) return "mac";
  else return "";
}

function getBrowserType() {
  if (navigator.appName.indexOf("Explorer") >= 0) return "ie";
  else if (navigator.appName.indexOf("Netscape") >= 0) return "nn";
  else return "";
}

function getBrowserVer() {
  return parseInt(navigator.appVersion);
}

function preloadImgs(dir, names, ext) {
  var namesArr = names.split();
  var objsArr = new Array();
  
  for (i = 0; i < namesArr.length; i++) {
    objsArr[i] = new Image();
    objsArr[i].src = dir + namesArr[i] + "." + ext;
  }
}

//---- Flash Player

function detectFlash(ver) {
  var is = false;

  if (getBrowserType() == "nn") {
    is = detectFlashJs(ver);
  } else if (getBrowserType() == "ie") {
    if (getPlatform() == "win") {
      is = detectFlashVb(ver);
    } else if (getPlatform() == "mac") {
      if (ver >= 4) is = detectFlashJs(ver);
    }
  }
  
  return is;
}

function detectFlashJs(ver) {
  var is = false;
  for (var i = 0; i < navigator.plugins.length; i++) {
  	if (navigator.plugins[i].name.indexOf("Shockwave Flash") >= 0)  {
      if (parseInt(navigator.plugins[i].description.substr(16, 1)) >= ver) is = true;
  	}
  }
  return is;
}

function detectFlashVb(ver) {
  gIs = false;
  
  document.writeln('<script language=VBScript>');
  document.writeln('  On Error Resume Next');
  document.writeln('  If Not IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + ver + '")) Then');
  document.writeln('    gIs = false');
  document.writeln('  Else');
  document.writeln('    gIs = true');
  document.writeln('  End If');
  document.writeln('</scr' + 'ipt>');
  
  return gIs;
}


//---- Windows Media Player

function detectWmpJs() {
  var is = false;
  for (var i = 0; i < navigator.plugins.length; i++) {
  	if (navigator.plugins[i].name.indexOf("Windows Media") >= 0) is = true;
  }
  return is;
}

function detectWmpVb() {
  gIs = false;

  document.writeln('<script language=VBScript>');
  document.writeln('  On Error Resume Next');
  document.writeln('  If  IsObject(CreateObject("MediaPlayer.MediaPlayer.1")) Then');
  document.writeln('    gIs = true');
  document.writeln('  End If');
  document.writeln('</scr' + 'ipt>');

  return gIs;
}
