function f()
{
qwest=window.confirm('Вы дествительно хотите\nизмененить цвет баграунда')
if(qwest){document.bgColor='lightblue'}
}

//определяем браузер
var IE,FF,Opera = 0;
if (navigator.userAgent.indexOf("MSIE") > 0) {
	IE = 1;
}
if (navigator.product == "Gecko") {
	FF = 1;
}
if (navigator.userAgent.indexOf("Opera") == 0) {
	Opera = 1;
}


function getWidth() {
	var windowWidth = 1024;
	if (self.innerWidth) { // all except Explorer
		windowWidth = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
	} else
		windowWidth = screen.width;

	return windowWidth;
}

function getHeight() {
	var windowHeight = 700;
	if (self.innerHeight) { // all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	} else
		windowHeight = screen.height;

	return windowHeight;
}

function jsmlm(s) {
  var a="@";
  var m=s+a+"mochalygin.ru";
  document.write("<a href='mailto:"+m+"'><nobr>"+m+"</nobr></a>");
};

function jsml(s) {
  var a="@";
  var m=s+a+"mgushka.ru";
  document.write("<a href='mailto:"+m+"'><nobr>"+m+"</nobr></a>");
};


function mousePageXY(e)
{
  var x = 0, y = 0;

  if (!e) e = window.event;

  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }

  return {"x":x, "y":y};
}

function PopUpiFrame(x, y, i, j, str, zagolovok) {

	if (y < 0) {
		var mo = mousePageXY(event);
		y = mo.y + y;
	}
	if (x < 0) {
		var mo = mousePageXY(event);
		x = mo.x + x;
	}
	c=document.getElementById("chertik");
	c.innerHTML = '';

	if(c!=null) {
		var aF="<div id='forma' style='padding: 13px; background-color: #155F86; margin: 0px; position:absolute; left:"+x+"px; top: "+y+"px; border: 10px solid #93D2F3; border-right: 7px solid #92D2F5'>"
			+"<img src='http://mgushka.ru/1/pic/zhdi.gif' name='zhdi' style='position: absolute; left: "+(i*0.49)+"; top: "+(j*0.46)+";'>"
			+"<div class='okno'><font color=white size=5px>&nbsp;&nbsp;" + zagolovok + "</font></div>"
			+"<iframe frameborder=0 id='Frame' src='"+str+"' width=\""+i+"\" height=\""+j+"\""
				+" OnLoad=\"javascript:document.images['zhdi'].style.display = 'none';\"></iframe>"		

			+"<a id='svernut' " 
				+" OnMouseDown=\"javascript:document.images['oO'].src='pic/svernut.gif'; return false;\""
				+" OnMouseUp=\"javascript:document.images['oO'].src='pic/svernut.gif'; return false;\""
				+" OnClick=\"javascript:"
					+"getElementById('forma').style.width = "+(i+2)+"; "
					+"getElementById('Frame').style.width = "+i+"; "
					+"getElementById('forma').style.left = "+x+"; "
					+"getElementById('forma').style.top = "+y+"; "

					+"getElementById('forma').style.height = "+j+"; "
					+"getElementById('Frame').style.height = "+j+" - 37; "

					+"getElementById('svernut').style.display = 'none'; "
					+"getElementById('razvernut').style.display = 'block'; "
					+"getElementById('zakryt').style.left = "+i+" - 17; "

					+"return false;\" "
			+"href='#' style='display: none; position: absolute; left: "+(i-47)+"px; top: 21px;'>"
			+"<img name='oO' title='свернуть' src='pic/svernut.gif' alt='оО' width=25 height=25 border=0 style='color: #444; font-weight: bold;'>"
			+"</a>"


			+"<a id='razvernut' " 
				+" OnMouseDown=\"javascript:document.images['o'].src='pic/razv.gif'; return false;\""
				+" OnMouseUp=\"javascript:document.images['o'].src='pic/razv.gif'; return false;\""
				+" OnClick=\"javascript:"
					+"document.getElementById('forma').style.width = getWidth() - 67; "
					+"document.getElementById('Frame').style.width = getWidth() - 69; "


					+"getElementById('forma').style.height = getHeight() - (IE?15:18); "
					+"getElementById('Frame').style.height = getHeight() - (IE?51:54); "


					+"getElementById('forma').style.left = 5; "
					+"getElementById('forma').style.top = 5; "
					+"getElementById('svernut').style.left = getWidth() - 117; "
					+"getElementById('svernut').style.display = 'block'; "
					+"getElementById('razvernut').style.display = 'none'; "
					+"getElementById('zakryt').style.left = getWidth() - 87; "
					+"return false;\" "
			+"href='#' style='position: absolute; left: "+(i-47)+"px; top: 21px;'>"
			+"<img name='o' title='развернуть' src='pic/razv.gif' alt=' о' width=25 height=25 border=0 style='color: #444; font-weight: bold;'>"
			+"</a>"

			+"<a id='zakryt'" 
				+" OnMouseDown=\"javascript:document.images['x'].src='pic/x_.jpg'; return false;\""
				+" OnMouseUp=\"javascript:document.images['x'].src='pic/x.jpg'; return false;\""
				+" OnClick=\"javascript:document.getElementById('forma').style.display = 'none'; "
				+"document.getElementById('forma').style.display = 'none'; return false;\" "

			+"href='#' style='position: absolute; left: "+(i-17)+"px; top: 21px; text-decoration:none;'>"
			+"<img name='x' title='закрыть' src='pic/x.jpg' alt=' х' width=25 height=25 border=0 style='font-weight: bold;'>"
			+"</a></div>";
		c.innerHTML=aF;
		return false;
			
	}
}

function PopUpPr(x,y,forma){
	i=320;
	j=210;
	x=10;
	y=10;
	str="http://mgushka.ru/1/pr.php?forma="+forma;
	c=document.getElementById("pr");
	if(c!=null) {
		var aF=
			"<div style='padding: 0px; background-color: silver; margin: 0px; position: absolute; border: 0px;'>"
			+"<iframe frameborder=0 id=\"Frame\" src=\""+str+"\" width=\""+i+"\" height=\""+j+"\"></iframe>"

			+"<a" 
				+" OnMouseDown=\"javascript:document.images['xpr'].src='http://mgushka.ru/1/pic/xpr_.bmp'; return false;\""
				+" OnMouseUp=\"javascript:document.images['xpr'].src='http://mgushka.ru/1/pic/xpr.bmp'; return false;\""
				+" OnClick=\"javascript:c.innerHTML = ''; return false;\" "
			+"href='#' style='background-color: grey; position: absolute; left: "+306+"px; top: 3px; text-decoration: none;'>"
			+"<img name='xpr' title='закрыть' src='http://mgushka.ru/1/pic/xpr.bmp' alt=' х' width=13 height=10 style='color: grey; font-weight: bold;'>"
			+"</a></div>"

		c.innerHTML=aF;
		return false;
			
	}
}

function PopUpGr(forma){
	i=330;
	j=300;
	x=10;
	y=10;
	str="http://mgushka.ru/1/gr.php?forma="+forma;
	c=document.getElementById("gr");
	if(c!=null) {
		var aF="<div style='opacity: 0.8; padding: 0px; position: absolute; margin-top: 10px; margin-left: 14px; width: "+i+"px; height: "+(j+6)+"px; background-color: #333;'> </div><div style='padding: 0px; background-color: silver; padding-left: 0px; padding-bottom: 0px; margin: 0px; position:absolute; border: 2px ridge silver;'><iframe frameborder=0 id=\"Frame\" src=\""+str+"\" width=\""+i+"\" height=\""+j+"\"></iframe><a OnClick=\"javascript:document.getElementById('gr').innerHTML=''; return false;\" href='#' style='text-decoration: none; color: #000; background-color: silver; border: 2px outset #666; padding: 0px; padding-left: 3px; padding-right: 3px; font-weight: bold; position: absolute; left: "+(i-18)+"px; top: 0px'>X</a></div>";
		c.innerHTML=aF;
		return false;
			
	}
}

function PopUpPr2(){
	i=320;
	j=400;
	x=10;
	y=10;
	str="http://mgushka.ru/1/pr2.php";
	c=document.getElementById("pr");
	if(c!=null) {
		var aF="<div style='opacity: 0.8; padding: 0px; position: absolute; margin-top: 10px; margin-left: 14px; width: "+i+"px; height: "+(j+6)+"px; background-color: #333;'> </div><div style='padding: 0px; background-color: silver; padding-left: 0px; padding-bottom: 0px; margin: 0px; position:absolute; border: 2px ridge silver;'><iframe frameborder=0 id=\"Frame\" src=\""+str+"\" width=\""+i+"\" height=\""+j+"\"></iframe><a OnClick=\"javascript:document.getElementById('pr').innerHTML=''; return false;\" href='#' style='text-decoration: none; color: #000; background-color: silver; border: 2px outset #666; padding: 0px; padding-left: 3px; padding-right: 3px; font-weight: bold; position: absolute; left: "+(i-18)+"px; top: 0px'>X</a></div>";
		c.innerHTML=aF;
		return false;
			
	}
}
function PopUpDiv(i,j,str){
	c=document.getElementById("chertik");
//	n=document.getElementById("new_platezh")
	if(c!=null) {
		if(c.innerHTML=="") {
			var aF="<div style='position:absolute; left: 5px; border: 1px solid black;'>"+str+"</div>";
			c.innerHTML=aF;
//			n.innerHTML="[&#151;]";
			
		}else{
			c.innerHTML="";
//			n.innerHTML="[+]";
		}
	}
}


function ShowForms(formname, formtext, formlabel) {
	if (document.getElementById(formname).style.display == "none") {
		document.getElementById(formname).style.display = "block";
		document.getElementById(formtext).innerHTML = "[&#151;]";
	} else {
		document.getElementById(formname).style.display = "none";
		document.getElementById(formtext).innerHTML = "[+]" + formlabel;
	}
}

function ShowDiv(divname) {
	if (document.getElementById(divname).style.display == "none")
		document.getElementById(divname).style.display = "block";
}

function getElementPosition(elem)
{
    
    var l = 0;
    var t = 0;
    
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.parentNode;
    }

    return t;
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}
