// JavaScript Document
function CheckActiveElement(Id,Text)
{
if(document.ActiveElement!=document.getElementById(Id))
{
document.getElementById(Id).value=Text;
}
else
{
document.getElementById(Id).value="";



}

}


var focus1=0;

function OnPasswordFocus()
{
document.getElementById('Password').style.backgroundImage="url(html/images/empty.jpg)";

}

function OnPasswordBlur()
{
/*document.getElementById('Password').style.backgroundImage="url(html/images/password.jpg)";
document.getElementById('Password').value="";*/
	
}

function Focus(ID)
{


focus1=1;

	
}

function ShowAction()
{

document.getElementById('Action').style.height='200px';
document.getElementById('Action').style.visibility='visible'

	
	
}

function CheckLogin()
{
if((document.getElementById('Login').value=="Логин")||(document.getElementById('Password').value==""))	
{
alert("Введите имя и пароль.");	
return false;
}
else
return true;
	
	
}


function CheckDomain(ID,form)
{
	
var filter=/^([a-zA-Z0-9-])+$/;
var n=0;
var Dom=0;

if(form==1)
{
while(n<parseInt(document.getElementById('ucount').value))
{
n++;
if(document.getElementById('u'+n).checked)
{
Dom=1;	
break;	
}
}

n=0;

if(Dom==0)
{
while(n<parseInt(document.getElementById('icount').value))
{
n++;
if(document.getElementById('i'+n).checked)
{
Dom=1;	
break;	
}
}
}
}

if(form==2)
{
while(n<parseInt(document.getElementById('pcount').value))
{
n++;
if(document.getElementById('p'+n).checked)
{
Dom=1;	
break;	
}
}	
	
	
	
	
}


if((filter.test(document.getElementById(ID).value)==false)||(Dom==0))
{
alert("Введите правильное имя и выберите зону.");	
return false;
}
else
return true;
	
}


function KP(ID)
{
document.getElementById(Id).value='';
	
	
}


function printit(Id){
x_win = open(document.getElementById(Id).name, "x_win", "");
}

function openContent(Id)
{
x_win = open("", "x_win", "");	
x_win.document.write(document.getElementById(Id).name);
	
}


function Hide(Id,Hide)
{
//document.getElementById(Id).blur();
document.getElementById(Id).style.visibility=Hide;
//document.getElementById(Id).fireEvent("onfocus","Password");
document.getElementById("Password").focus();

}



function Check_All(Id,prefix,pprefix)
{
n=0;
state="0";


if(pprefix=='0')
{
if(document.getElementById(prefix+'selAll').value=="1")
{
state="";
document.getElementById(prefix+'selAll').value='0';
}
else
{
state="checked";
document.getElementById(prefix+'selAll').value='1';
}

	
	
	
}


while(n<parseInt(document.getElementById(prefix+'count').value))
{
n++;
document.getElementById(prefix+n).checked=state;
//alert(prefix+n);
}
}

function Click(Id,Text)
{

document.getElementById(Id).value=Text;
};

var ActiveElement="0";
var LastActive="0";
var pMouseOnPopup="";


function HidePopup()
{
if(ActiveElement=="0")
{
//alert(ActiveElement);	
document.getElementById(LastActive).style.visibility="hidden";		
//document.getElementById('expander').style.height="0px";	
}
/*else
{*/
ActiveElement="0";
//}

//alert(ActiveElement);

}

function PopupMenuClick()
{
ActiveElement=document.getElementById(LastActive).id;
//alert(ActiveElement);	
	
}

function MouseNotOnPopup()
{

	
}

function MouseOnPopup(Id)
{
	//alert(document.getElementById(Id).id);
	pMouseOnPopup=document.getElementById(Id).id;
	
	
	
}


function ShowPopup(Id)
{
	
    var i=0;
	var count=document.getElementById('m').value;
	
    
	for(i=1;i<=parseInt(count);i++)
	{
	document.getElementById('popup-menu'+i).style.visibility="hidden";	
	//document.getElementById('expander').style.height='0';

	}
	

	pMouseOnPopup=document.getElementById(Id).id;
document.getElementById(Id).style.visibility="visible";	
//document.getElementById('expander').style.height=document.getElementById(Id).style.height;
/*if(LastActive!=document.getElementById(Id).id)
{
alert(LastActive);
document.getElementById(LastActive).style.visibility="hidden";		
document.getElementById('expander').style.height="0px";

}*/
LastActive=document.getElementById(Id).id;
//ActiveElement=document.getElementById(Id).id;
	
};


function Scaling(Id,showNews)
{
	

///document.getElementById('account').style.visibility='hidden';

//document.getElementById('account').style.visibility=document.getElementById('hide_account').value;

if(showNews=='hidden')
{
document.getElementById('News').style.visibility="hidden";
document.getElementById('tb2').style.height="0px";
}



	//if(document.getElementById('tbl').pixelHeight<window.screen.availHeight)
	//document.getElementById('tbl').height=window.screen.availHeight;



/*for(n=1;n<document.getElementById('MT').value+1;n++)
{

//document.getElementById('begin'+n).width=(834-(200*document.getElementById('MT').value))/(document.getElementById('MT').value*2);
//document.getElementById('end'+n).width=(834-(200*document.getElementById('MT').value))/(document.getElementById('MT').value*2);
//document.getElementById('tt'+n).width='100px';
}*/


//alert(document.getElementById(Id).width);
}

function NewWindow(Content)
{
x_win = open();	
x_win.document.write(document.getElementById(Content).name);	
	
	
}

function NewWindow1(Content)
{
x_win = open();	
x_win.document.write(document.getElementById(Content).innerText);	
	
	
}

function NextPage(id)
{

window.location.href = document.getElementById(id).value;

}

var underline=false;

function Underline(N,prefix)
{
    var i=0;
	var count=document.getElementById(prefix).value;
	
    
	for(i=1;i<=parseInt(count);i++)
	{
	document.getElementById(prefix+parseInt(i)).style.backgroundColor="";
	if(prefix=='t')
    document.getElementById(prefix+parseInt(i)+parseInt(i)).style.textDecoration ='none';
	}

	document.getElementById(prefix+N).style.backgroundColor=document.getElementById(prefix).name;
	if(prefix=='t')
	document.getElementById(prefix+N+N).style.textDecoration ='underline';
    
}
	
	
function MenuClick(N,prefix)
{
			//document.getElementById(prefix+N+N).style.textDecoration=document.getElementById(prefix).alt;
	
}


function TestCOM()
{
	

   var word=new ActiveXObject("Word.Application");

   word.Documents.Open("D:\\example.doc");
   //word.Selection.TypeText("Helo, word!");
   word.ActiveDocument.SaveAs("D:\\Test2.doc",4);
   word.Quit();

}


