// JavaScript Document
<!--

// Helpful Functions //////////////////////////////////////

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//('e1','contact','alfa-group.biz');
function SetEMail(Id,prefix,postfix) {
	if ((Obj = findObj(Id)) != null) Obj.innerHTML = '<a href = "'+'mailto:'+prefix+'@'+postfix+'">'+prefix+'@'+postfix+'</a>';
}

function SetBG(Id, Src) {
	if ((Obj = findObj(Id)) != null) {Obj.style.backgroundImage = "url("+Src+")"; Obj.style.backgroundRepeat = "repeat-x"}
}

function Hide() {
	for (i=0; i<arguments.length; i++) {
		if ((Obj = findObj(arguments[i])) != null) {Obj.style.display='none'}
	}
}

function Show() {
	for (i=0; i<arguments.length; i++) {
		if ((Obj = findObj(arguments[i])) != null) {Obj.style.display=''}
	}
}

function ActivateForm(El, DefValue) {
	if ((Obj = findObj(El)) != null) {
		Obj.style.color='#000000';
		if(Obj.value == DefValue) Obj.value = '';
	}
}

function BlurForm(El, DefValue) {
	if ((Obj = findObj(El)) != null) {
		if(Obj.value == '') {
			Obj.style.color='#666666';
			Obj.value = DefValue;
		}
	}
}

function GoTo(URL) {
	document.location = URL;
}

function getElementPosition(elemId)
{
    var elem = findObj(elemId);//document.getElementById(elemId);
	
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return {"left":l, "top":t, "width": w, "height":h};
}

function popUpWindow(URLStr, left, top, width, height) {
	var prevwin=window.open(URLStr,'popUpWin','toolbars=no,scrollbars=no,width=700,height=500'); 
}

// Menu Processing //////////////////////////////////////

var Menu = new Array('BtnMain','BtnSites', 'BtnSoftware', 'BtnIT', 'BtnDemo', 'BtnOrder', 'BtnSites', 'BtnSites', 'BtnSites', 'BtnSoftware' /*10*/, 'BtnMain', 'BtnMain', 'BtnMain');
var SubMenus = new Array('SubMain','SubSites', 'SubSoftware', '', 'SubDemo', '', 'SubSites', 'SubSites', 'SubSites', 'SubSoftware' /*10*/, 'SubMain', 'SubMain', 'SubMain');
var LastSelected = 0;
var UseSmallBGs = 0;

function EnLight(Id) {
	if (UseSmallBGs == 0) SetBG(Id, "./img/bg_menu_big_selected.jpg")
	else SetBG(Id, "./img/bg_menu_selected.jpg");
}

function DeLight(Id) {
	if (UseSmallBGs == 0) SetBG(Id, "./img/bg_menu_big.jpg")
	else SetBG(Id, "./img/bg_menu.jpg");
}

function SetSubMenuPosition(N) {
	pos = getElementPosition(Menu[N]);
	if ((Obj2 = findObj(SubMenus[N])) != null) {
		Obj2.style.top = pos.top + pos.height;
		Obj2.style.left = pos.left + 10;
	}
}

function SelectMenu(N) {
	DeLight(Menu[LastSelected]);
	if (SubMenus[LastSelected] != '') Hide(SubMenus[LastSelected]);
	EnLight(Menu[N]);
	LastSelected = N;
	if (SubMenus[N] != '') {
		SetSubMenuPosition(N);
		Show(SubMenus[N]);
	}
}
/*

function procHours(Hours)
{
	if (Hours > 23) {Hours = Hours - 24}
	return Hours;
}

function geClock() {
	var now = new Date();
	var moTime = procHours( now.getUTCHours()+3 )+':'+now.getUTCMinutes();
	var vlTime = procHours( now.getUTCHours()+10 )+':'+now.getUTCMinutes();
	var noTime = procHours( now.getUTCHours()+7 )+':'+now.getUTCMinutes();
	if ((Obj = MM_findObj('vlTime')) != null)
	{
		Obj.innerHTML = vlTime;
	}
	if ((Obj = MM_findObj('noTime')) != null)
	{
		Obj.innerHTML = noTime;
	}
	if ((Obj = MM_findObj('moTime')) != null)
	{
		Obj.innerHTML = moTime;
	}
	setTimeout("geClock()",1000*10); // каждые 10 секунд перерисовываем время
}
*/

/*
function popUpWindow2(URLStr, left, top, width, height)
{
var popUpWin=0;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = window.open(URLStr, 'popUpWin', 'toolbar=no,resizable,scrollbars,width='.width.',height='.height);
  popupWin.focus();
}
*/

/*
function popUpWindow(URLStr, left, top, width, height)
{
	var prevwin=window.open(URLStr,'popUpWin','toolbars=no,scrollbars=no,width=700,height=500'); 
}
*/

//-->
