function ChangeInnerText(ths,nTxt) {
	var obj = document.getElementById(ths);
	var old1 = obj.firstChild;
	var txt1 = document.createTextNode(nTxt);
	obj.replaceChild(txt1, old1);
}

function navigate2(url) {
  document.location.href=url;
}

function PopUpAnket(url,wid,hgt){
  window.showModalDialog(url, "window", "resizable:no; help:no; status:no; edge:sunken; dialogWidth:" + wid + "px; dialogHeight:" + hgt + "px; center:yes; scroll:no;");
}

function PopUp(url) {
  window.open(url,"ppp","");
}

function PopUpGo(url){
  window.open(url, "helper", "width=600, height=200, top=50,left=50, status=0, toolbar=0, menubar=0, scrollbars=yes, resizable=1");
}

function PopUpGo2(url){
  window.open(url, "forum", "width=600, height=430, top=50,left=50, status=0, toolbar=0, menubar=0, scrollbars=yes, resizable=1");
}

function PopUpSize(url,wid,hgt,nm){
  if (nm == null) nm = "_blank";
  window.open(url, nm, "width=" + wid + ", height=" + hgt + ", top=50,left=50, status=0, toolbar=0, menubar=0, scrollbars=1, resizable=1");
}

function PopUpSizeStatus(url,wid,hgt,nm){
  if (nm == null) nm = "_blank";
  window.open(url, nm, "width=" + wid + ", height=" + hgt + ", top=50,left=50, status=1, toolbar=0, menubar=0, scrollbars=1, resizable=1");
}

function PopUpSizeStatusTB(url,wid,hgt,nm){
  if (nm == null) nm = "_blank";
  window.open(url, nm, "width=" + wid + ", height=" + hgt + ", top=50,left=50, status=1, toolbar=1, menubar=0, scrollbars=1, resizable=1");
}

function PopUpNormal(url,wid,hgt,nm){
  if (nm == null) nm = "_blank";
  window.open(url, nm, "width=" + wid + ", height=" + hgt + ", top=50,left=50, status=1, toolbar=1, menubar=1, scrollbars=1, resizable=1");
}

function popupModal(url, width, height, params) {
  return showModalDialog(url, params, "resizable:no; help:no; status:no; edge:sunken; dialogWidth:" + width + "px; dialogHeight:" + height + "px; center:yes; scroll:no;");
}

function popupModalScroll(url, width, height, params) {
  return showModalDialog(url, params, "resizable:no; help:no; status:no; edge:sunken; dialogWidth:" + width + "px; dialogHeight:" + height + "px; center:yes; scroll:yes;");
}

function popupModalResizable(url, width, height, params) {
  return showModalDialog(url, params, "resizable:yes; help:no; status:yes; edge:sunken; dialogWidth:" + width + "px; dialogHeight:" + height + "px; center:yes; scroll:yes;");
}

function closeM() {
	window.close();
}

function eventTarget(e) {
  if (!e) e=window.event;
  return (e.target)?e.target:e.srcElement;
}

function table_visibility_classic(tbl) {
  if (tbl.style.display=="")
    tbl.style.display = "none";
  else
    tbl.style.display = "";
}

function hexDigit(d){
  return (d < 10) ? (d + "") : String.fromCharCode(55 + d);
}

function halftone(color) {
  if (color == "") return "808080";

  if (color.substr(0,1) == "#") color = color.substr(1);
  var col = parseInt("0x" + color);
  col = ((col & 0xFEFEFE) >> 1) + 0x808080;

  col =
    hexDigit((col & 0xF00000) >> 20) +
    hexDigit((col & 0xF0000) >> 16) +
    hexDigit((col & 0xF000) >> 12) +
    hexDigit((col & 0xF00) >> 8) +
    hexDigit((col & 0xF0) >> 4) +
    hexDigit((col & 0xF));

  return col;
}

function BodyBGColorFromPcid(boldcolor, pc_id) {
  if (pc_id == 1 || pc_id == 2)
    return "#FFFFFF";
  else if (pc_id == 3)
    return "#" + halftone(boldcolor);
  else if (pc_id == 4)
    return boldcolor;
  else if (pc_id == 5)
    return "#000000";
}

function make_numeric(ctrl) {
  ctrl.onkeypress = numeric_key;
//  ctrl.onchange = numeric_change;
}

function numeric_key() {
  var ch = String.fromCharCode(event.keyCode);
  return (ch >= '0' && ch <= '9');
}

function numeric_change() {
/*  var valid = "0123456789"; */
  var val = event.srcElement.value;
}

function getitemdata(list) {
  if (list.selectedIndex < 0) {
    return 0;
  } else {
    return list.options(list.selectedIndex).value;
  }
}

function getitemtext(list) {
  if (list.selectedIndex < 0) {
    return null;
  } else {
    return list.options(list.selectedIndex).text;
  }
}

/********** horizontal menubar object ********/
function MenuBar(objname,height,numEntries,popupClass,hovercolor) {
  var ths = new Object();
  ths.objname = objname;
  ths.selmenu = -1;
  ths.popupClass = popupClass;
  ths.hovercolor = hovercolor;
  ths.menu_div = document.getElementById(objname + "_div");
  ths.menu_table = document.getElementById(objname + "_tbl");
  ths.timer = null; //menu timer
  ths.Menus = new Array();
  ths.Menus.length = numEntries;

  for (var i=0;i<numEntries;i++) {
    ths.Menus[i] = new Object();
    ths.Menus[i].table = null;
  }

  return ths;
}

//creates the data of a menu
function SubMenu(ths,ind) {
  var menu = ths.Menus[ind];
  if (!menu) return;

  menu.table = null;
  if (arguments.length <= 2) return;

  menu.table=document.createElement("TABLE");
  menu.table.border=0;
  menu.table.cellPadding=2;
  menu.table.cellSpacing=0;
  menu.table.className=ths.popupClass;

  for(i=2; i<arguments.length; i+=2) {
    var tr=menu.table.insertRow(-1);
    tr.height=14;
    var td=tr.insertCell(-1);
    td.align="center";
    td.noWrap=true;
    td.appendChild(document.createTextNode(arguments[i+1]));

    if (arguments[i] != "") {
      td.style.cursor="pointer";
      td.setAttribute("hoverColor", ths.hovercolor);
      td.setAttribute("href", arguments[i]);
      td.onclick=function(e) {
        var el=eventTarget(e);
        navigate2(el.getAttribute("href"));
      }
      td.onmouseover=function(e) {
				HideForm();
        var el=eventTarget(e);
        el.style.backgroundColor=el.getAttribute("hoverColor");
      }
      td.onmouseout=function(e) {
        var el=eventTarget(e);
        el.style.backgroundColor='';
      }
    }
  }
}

//creates all menus
function CreateSubMenus(ths) {
  var No3 = (parseInt(navigator.appVersion) > 3) ? 1:0;
  if (!No3) return;
  var i;
  var rw=ths.menu_table.rows[0];

  for(i=0; i<ths.Menus.length; i++) {
    var menu = ths.Menus[i];
    if (menu.table==null) continue;

   /* var tp=ths.menu_table.offsetTop + ths.menu_table.offsetHeight;
    var lt=ths.menu_table.offsetLeft + rw.cells[i].offsetLeft;*/

    var divSubMenu = document.createElement("DIV");
    divSubMenu.id=ths.objname+i;
    divSubMenu.onmouseover=function() {clearTimeout(ths.timer);}
    divSubMenu.onmouseout=function() {HideMenu(ths);}
    divSubMenu.appendChild(menu.table);
    divSubMenu.style.position="absolute";
    divSubMenu.style.display="none";
    divSubMenu.style.top="0px";
    divSubMenu.style.left="0px";
    ths.menu_div.appendChild(divSubMenu);
  }
}

function ShowMenu(ths,ind) {
  var l;
  var rw=ths.menu_table.rows[0];

  if (ths.timer!=null) clearTimeout(ths.timer);
  if (ind == ths.selmenu) return;

  if (ths.selmenu >= 0) {
    l=document.getElementById(ths.objname+ths.selmenu);
    if (l) {
      l.style.display = "none";
			ShowForm(ind);
    }
  }
  ths.selmenu = ind;
  if (ths.selmenu >= 0) {
    if (ths.Menus[ths.selmenu].info == "") {ths.selmenu=-1;return;}
    l=document.getElementById(ths.objname+ths.selmenu);
    if (l) {
      l.style.top = ths.menu_table.offsetTop + ths.menu_table.offsetHeight;
      l.style.left = ths.menu_table.offsetLeft + rw.cells[ind].offsetLeft;
      l.style.display = "";
			HideForm();
		}
  }
}

function HideForm() {
 	var oF = document.getElementById('nFrmEJ');
 	if (oF) {
 		var selects = oF.getElementsByTagName('SELECT');
		for (var i = 0; i < selects.length; i++) {
 			selects[i].style.visibility = "hidden";
 		}
 	}
}

function ShowForm(ind) {
  if (ind < 0) {
		var oF = document.getElementById('nFrmEJ');
		if (oF) {
 			var selects = oF.getElementsByTagName('SELECT');
			for (var i = 0; i < selects.length; i++) {
 				selects[i].style.visibility = "visible";
 			}
 		}
 	 	var oH = document.getElementById('nHelp');
 		if (oH) {
      oH.style.display = 'none';
 		}
 	 	var oS = document.getElementById('fxDesc');
 		if (oS) {
      oS.style.display = 'none';
 		}
  }
}

function HideMenu(ths) {
  if (ths.timer!=null) clearTimeout(ths.timer);
  ths.timer = setTimeout("ShowMenu("+ths.objname+",-1)", 500);
}

function MenuFlash(width,height,movie) {
  this.width = width;
  this.height = height;
  this.movie = movie;
  // this.movie = 'https://www.e-jett.com/getl.axd?f=ej06btn.swf';

  this.render = function (title,url2,url3) {
  var vars="title="+title+"&amp;url2="+escape(url2)+"&amp;url3="+escape(url3);

  var ht = "<object width=\""+this.width+"\" height=\""+this.height+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">"+
    "<param name=\"Movie\" value=\""+this.movie+"\" />"+
		"<param name=\"FlashVars\" value=\""+vars+"\" />"+
		"<param name=\"BGColor\" value=\"#FFFFFF\" />"+
		"<param name=\"Menu\" value=\"False\" />"+
		"<param name=\"WMode\" value=\"transparent\" />"+
		"<param name=\"Quality\" value=\"High\" />"+
		"<param name=\"Scale\" value=\"exactfit\" />"+
		"<embed src=\""+this.movie+"\" type=\"application/x-shockwave-flash\" bgcolor=\"#FFFFFF\" width=\""+this.width+"\" height=\""+this.height+"\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" FlashVars=\""+vars+"\" Menu=\"False\" Quality=\"High\" WMode=\"transparent\" Scale=\"exactfit\" />"+
		"</object>";
    document.write(ht);
	}
}

function RenderFlash(movie,width,height,params,id,stp) {
  this.width = width;
  this.height = height;
  this.movie = movie;
  this.params = params;
  this.id = id;
  this.stp = stp;
	var flr = "<object "
	if (this.id == 'btn') {
		flr += " width=\""+this.width+"\" height=\""+this.height+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">"
  } else {
		flr += " id=\""+this.id+"\" width=\""+this.width+"\" height=\""+this.height+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">"
	}
	//name=\""+this.id+"\"
  flr += "<param name=\"Movie\" value=\""+this.movie+"\" />"+
		"<param name=\"FlashVars\" value=\""+this.params+"\" />"+
		"<param name=\"BGColor\" value=\"#FFFFFF\" />"+
		"<param name=\"Menu\" value=\"False\" />"+
		"<param name=\"allowscriptaccess\" value=\"always\" />"+
		"<param name=\"allowfullscreen\" value=\"True\" />"+
		"<param name=\"WMode\" value=\"transparent\" />"+
		"<param name=\"Quality\" value=\"High\" />"+
		"<param name=\"Scale\" value=\"exactfit\" />";

  if (this.stp == '1') {
    flr += "<param name=\"play\" value=\"false\" />"+
    "<embed play=false swliveconnect=\"true\" ";
	} else {
    flr += "<embed ";
	}
	if (this.id == 'btn') {
	//
  } else {
  	flr += "name=\""+this.id+"\" ";
  	// id=\""+this.id+"\" ";
	}
	flr += " src=\""+this.movie+"\" type=\"application/x-shockwave-flash\" bgcolor=\"#FFFFFF\" width=\""+this.width+"\" height=\""+this.height+"\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" FlashVars=\""+this.params+"\" Menu=\"False\" Quality=\"High\" WMode=\"transparent\" Scale=\"exactfit\" />"+
		"</object>";
    document.write(flr);
	}

function getMovieObject(movieName) {
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
  }
  else
  // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
			return document.getElementById(movieName);
  }
}

var d_timer_id=null;
var d_tmr=200;

function initAFlash(objName,a1_id,a2_id,a3_id,a4_id) {
	if (d_timer_id != null) clearTimeout(d_timer_id);
	d_timer_id=setTimeout('initAFlash2(\"'+objName+'\",\"'+a1_id+'\",\"'+a2_id+'\",\"'+a3_id+'\",\"'+a4_id+'\")', d_tmr);
	d_timer_id=null;
	d_tmr += 100;
}
//+','+a2_id
function initAFlash2(objName,a1_id,a2_id,a3_id,a4_id) {
	var swfSc = getMovieObject(objName);
//	var swfSc = getMovieObject("actObject");
	swfSc.SetVariable('a1_id',a1_id);
	swfSc.SetVariable('a2_id',a2_id);
	swfSc.SetVariable('a3_id',a3_id);
	swfSc.SetVariable('a4_id',a4_id);
	swfSc.GotoFrame(1);
	swfSc.Play();
}

