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 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;
  }
}

function ShowMyHelp(ths,lbl,dsc) {
  var bTop = 105;
  var bLeft = 15;
  var myHeight = 226;
  var myWidth = 326;
  var nScrollTop = new Number(document.body.scrollTop);

  var l = document.getElementById(ths);
  var nBodyWidth = new Number(document.body.clientWidth);
  var nBodyHeight = new Number(document.body.clientHeight);
  var VMaxWidth = (nBodyHeight + nScrollTop);
  var VMaxHeight = (nBodyHeight);
  l.style.posTop = (l.offsetTop + myHeight + bTop);
  if (l.style.posTop > VMaxHeight) {
		bTop = - 140;
		top_flexi.style.display = "none";
		top_fixed.style.display = "";
		bot_fixed.style.display = "none";
		bot_flexi.style.display = "";
	} else {
		top_flexi.style.display = "";
		top_fixed.style.display = "none";
		bot_fixed.style.display = "";
		bot_flexi.style.display = "none";
	}
  l.style.posLeft = (l.offsetLeft + myWidth + bLeft);
  if (l.style.posLeft > nBodyWidth) {
		bLeft = - myWidth;
	}
 	var oDOM = document.getElementById('nHelp');
  if (oDOM) {
		DvProg_0.innerText=lbl;
		DvProg_1.innerText=dsc;
    oDOM.style.display = "";
    oDOM.style.top = l.offsetTop + bTop;
    oDOM.style.left = l.offsetLeft + bLeft;
		//alert(oDOM.style.left);
  }
}

/********** 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="hand";
      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) {
        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";
    }
  }
  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 = "";
    }
  }
}

function HideMenu(ths) {
  if (ths.timer!=null) clearTimeout(ths.timer);
  ths.timer = setTimeout("ShowMenu("+ths.objname+",-1)", 1000);
}

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) {
  this.width = width;
  this.height = height;
  this.movie = movie;
  this.params = params;
  this.id = id;
	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+"\" name=\""+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\">"
	}	
   
    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=\"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=\""+this.params+"\" Menu=\"False\" Quality=\"High\" WMode=\"transparent\" Scale=\"exactfit\" />"+
		"</object>";
    document.write(flr);
	}
	
function RenderHelpBox() {
	var flr 
	alert("aloo");
	flr = "<div id=\"its_mine\" style=\"position:absolute;display:none;\" onmouseout='HideMe(its_mine);'>"+
		"<table width=\"320\" height=\"226\" cellspacing=0 cellpadding=0 border=0>"+
		"<tr id=\"tr_flexi\" valign=\"bottom\" />"+
		"<td><img src=\"gett.axd?f=e%2fleft_top.gif\"></td>"+
		"</table>"+
		"</div>";
    document.write(flr);
	}

