

var TypeNav = ((navigator.appName == "Microsoft Internet Explorer") ? 1 : 0);
var speed = 10;
var timer = 1000;


function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}
function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function ClickFullSrc(obj)
{
	var Value = document.getElementById("full_value").value 
	if (Value==1) {
		document.getElementById("full_value").value = 0;
		obj.src = '/i/full_s2.gif';
	}
	else {
		document.getElementById("full_value").value = 1;
		obj.src = '/i/full_s.gif';
	}
}






function KonstMove()
{
	//alert("ddddd");
	top.document.getElementById("div_konst").style.display='block';
}

function KonstOut()
{
	top.document.getElementById("div_konst").style.display='none';
}



function OnloadBody()
{
	// внутренние размеры браузера
	//var wwidth=(window.innerWidth)?window.innerWidth:((document.all)?document.body.offsetWidth:null);
	var wheight=getClientHeight()
	top.document.getElementById("rs").height=wheight;
//	alert(wheight);
}





if (navigator.appName == "Microsoft Internet Explorer")
	httpRequest =  new ActiveXObject("Microsoft.XMLHTTP");
else
	httpRequest =  new XMLHttpRequest();



function LKMove() {
	top.document.getElementById("div_lk2").style.display='none';
	top.document.getElementById("div_lk1").style.display='block';
}
function LKOut() {
	top.document.getElementById("div_lk2").style.display='block';
	top.document.getElementById("div_lk1").style.display='none';
}



function sendRequest(file, getRequestProc) {
	httpRequest.open('get', file,true)
	httpRequest.onreadystatechange = getRequestProc;
	httpRequest.send(null);
}

function sendRequestFalse(file, getRequestProc) {
	httpRequest.open('get', file,false)
	httpRequest.onreadystatechange = getRequestProc;
	httpRequest.send(null);
}



function OverOpp(number){

	document.getElementById("opp" + number).style.display='block';







}



function Coordinate(elem) {
    var top=0, left=0
    while(elem) {
        top = top + parseInt(elem.offsetTop)
        left = left + parseInt(elem.offsetLeft)
        elem = elem.offsetParent       
    }
		//alert(top);
		//alert(left);	
		return {top: top, left: left}
}






function MenuOver(obj) 
{
	var id = obj.id;
	id = id.substring(id.length-1,id.length);
	var div = top.document.getElementById("div_menu" + id);

	var DivTop = 29;
	var DivLeft = 0;
	
	id = parseInt(id);
	
	
	
//	DivLeft = ((id=="1") ? 93 : 0);
//	DivLeft = ((id=="2") ? 82 : 0);
	
//	if (id == 1) {DivLeft = 2} ; 
	
	if (id == 1) {DivLeft = 91} ; 
	
	
	
	
	
	div.style.top = DivTop + 'px';
	div.style.left = DivLeft + 'px';

	
	
	

	heightDiv = 0;
	opaDiv = 0;
	
	SlideDiv("div_menu" + id);
	OpacityDiv("div_menu" + id);
	div.style.display = 'block';
}









function MenuOut(obj)
{
	var id = obj.id;
	id = id.substring(id.length-1,id.length);
	var div = top.document.getElementById("div_menu" + id);
	div.style.display = 'none';
} 
function DivMenuOver(obj)
{
	var id = obj.id;
	id = id.substring(id.length-1,id.length);
	
//	alert(id);
	
	var elem = top.document.getElementById("m" + id)
	var elemM = top.document.getElementById("m" + id + "_m")
	
	
	elem.style.display='none';
	elemM.style.display='inline';
	
	
	obj.style.display = 'block';
	
	
	
}
function DivMenuOut(obj)
{
	var id = obj.id;
	id = id.substring(id.length-1,id.length);
	var elem = top.document.getElementById("m" + id)
	var elemM = top.document.getElementById("m" + id + "_m")
	
	elem.style.display='inline';
	elemM.style.display='none';
	obj.style.display = 'none';
}

var heightDiv = 0;
var opaDiv = 0;

//var dd = "";
//dd = dd.substring(0,dd.length-2)
//dd = parseInt(dd) + 10;
//alert(dd);


function SlideDiv(id)
{
	var func = setTimeout("SlideDiv('" + id + "')",10);
	var obj = top.document.getElementById(id);

	obj.style.height= heightDiv + "px";
	
	heightDiv = heightDiv + 10;
	
	
	if (heightDiv>270)
	{
		window.clearInterval(func);
	//	alert(heightDiv);
	}
	
}

function OpacityDiv(id)
{
	var func1 = setTimeout("OpacityDiv('" + id + "')",50);
	var obj = top.document.getElementById(id);

	opaDiv = opaDiv + 0.7;
	obj.style.opacity = opaDiv/10;
	obj.style.filter = 'alpha(opacity=' + opaDiv*10 + ')';

	if (opaDiv > 10.0) 
   {
		window.clearInterval(func1);
		
  }

}




















function processClick(div) {
  var catlength = array.length;
  for(i = 0; i < catlength; i++) {
    var section = array[i];
    var head = document.getElementById(section + '-header');
    var cont = section + '-content';
    var contdiv = document.getElementById(cont);
    clearInterval(contdiv.timer);
    if(head == div && contdiv.style.display == 'none') {
      contdiv.style.height = '0px';
      contdiv.style.display = 'block';
      initSlide(cont,1);
    } else if(contdiv.style.display == 'block') {
      initSlide(cont,-1);
    }
  }
}


// Setup the variables and call the slide function //
function initSlide(id,dir) {
   
   var cont = document.getElementById(id);
   var maxh = 255;
   
   cont.direction = dir;
   cont.timer = setInterval("slide('" + id + "')", timer);
}

// Collapse or expand the div by incrementally changing the divs height and opacity //
function slide(id) {
  var cont = document.getElementById(id);
  var maxh = cont.maxh;	
  var currheight = cont.offsetHeight;
  var dist;
  if(cont.direction == 1) {
    dist = (Math.round((maxh - currheight) / speed));
  } else {
    dist = (Math.round(currheight / speed));
  }
  if(dist <= 1) {
    dist = 1;
  }
  
  
 // cont.style.height = currheight + (dist * cont.direction) + 'px';
  cont.style.opacity = currheight / cont.maxh;
  cont.style.filter = 'alpha(opacity=' + (currheight * 100 / cont.maxh) + ')';
  if(currheight < 2 && cont.direction != 1) {
    cont.style.display = 'none';
    clearInterval(cont.timer);
  } else if(currheight > (maxh - 2) && cont.direction == 1) {
    clearInterval(cont.timer);
  }
}











function SubmitLogon()
{
	var Login = document.webkab.ladm.value;
	var Password = document.webkab.padm.value;
	top.document.getElementById('splc').innerHTML = "<img src='/i/load1.gif' width=16 height=11 border=0><img src='/i/s.gif' width=16 height=1 border=0>";
	sendRequest('/request.asp?act=checklogon&login=' +  Login + '&pass=' + Password, getRequestCheckLogon);	   
}







function getRequestCheckLogon() {
	
	if (httpRequest.readyState==4 && httpRequest.responseText!='') {
		
		
		if (httpRequest.responseText == 'false')	
		{
			top.document.getElementById('splc').innerHTML = "<font color=red>Неверный логин или пароль!</font>"
		}
		else 
		{
			
			var Value = document.getElementById('full_value').value
			
			
			
			
			
			if (Value==1){ 	
				
			
				

				
			document.webkab.target = "full_window";
			window.open('','full_window','location=0, toolbar=0, menubar=0, status=1, directories=0, resizable=1, Scrollbars=0,width=' + screen.width + ',height=' + screen.height);
	//	   	window.open('','full_window','toolbar=0, location=0, menubar=0, status=1, directories=0, resizable=1, Scrollbars=1');
	//		 window.open('',s,"toolbar=0; location=0; menubar=0; status=1; directories=0; resizable=1; Scrollbars=1;");		
	//	   	 window.open("www.ss.ss",'full_window','toolbar=0,menubar=0,Scrollbars=0');
	//   	 window.open('','full_window','location=0,scrollbars=yes,width=' + screen.width + ',height=' + screen.height ;
	//       window.open('','full_window','location=0,scrollbars=yes');		
			document.webkab.submit();
			top.document.getElementById('splc').innerHTML = "Вход осуществлен в новом окне";		
			}
			else
			{
				document.webkab.submit();
			}
			
		}
		
	
	}
}


function ClickPubl()
{
	alert('fffff');






}














