<!--
// функции для сайта "Мегафон" компании "Уральский GSM"
// использование кода на других сайтах запрещено, кроме функций с приставкой "MM_" и "scroll"

// загружаем всякие полезности

// браузер

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	if (place) return true;
	else return false;
}


var ie=document.all;
var ns6=document.getElementById&&!document.all;
var opera=checkIt('opera');
var crossobj=false;

// функции

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// HTML Block Scroller & Marquee JavaScript - v1.3 - Coded by GreyWyvern
// - Copyright 2003 - Licenced for free distribution under the GPL
// - W3C DOM compliant!
// Send comments/suggestions to: wyvern@greywyvern.com

function scrollObject(objName, main, width, height, bkgcol, direct, deccel, begin, speed, pause, classname) {
  this.objName = objName;
  this.main = main;
  this.one = main + "Block1";
  this.two = main + "Block2";
  this.block = new Array();
  this.blockup = 1;
  this.divup = 1;
  this.height = height;
  this.width = width;
  this.bkgcol = bkgcol;
  this.direct = direct;
  this.deccel = Math.max(deccel, 1);
  this.begin = Math.max(Math.min(begin, (direct == "up" || direct == "down") ? height : width), 1);
  this.speed = speed;
  this.pause = pause;
  this.slide = ((direct == "up" || direct == "down") ? height : width) / this.begin;
  this.table = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"" + classname + "\" style=\"width:" + width + "px;height:" + height + "px;\">";
  this.scroll = scroll;
  this.scrollLoop = scrollLoop;
}

function scroll() {if (!document.getElementById) return false;
  document.getElementById(this.main).innerHTML = "<div id=\"" + this.one + "\"></div><div id=\"" + this.two + "\"></div>";
  var divList = [document.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
  for (var i = 0; i <= 2; i++) {
    if (i > 0) {
      divList[i].style.position = "absolute";
      if (this.direct == "up" || this.direct == "down") {
        divList[i].style.left = "0px";
        divList[i].style.top = (i == 1) ? "0px" : ((this.direct == "up") ? "" : "-") + this.height + "px";
      } else {
        divList[i].style.left = (i == 1) ? "0px" : ((this.direct == "left") ? "" : "-") + this.width; // + "px";
        divList[i].style.top = "0px";
      } divList[i].innerHTML = this.table + this.block[i - 1] + "</td></tr></table>";
    } else {
      divList[i].style.position = "relative";
      divList[i].style.background = this.bkgcol;
    }
    divList[i].style.width = this.width; // + "px";
    divList[i].style.height = this.height + "px";
    divList[i].style.overflow = "hidden";
  } setTimeout(this.objName + ".scrollLoop();", this.pause);
}

function scrollLoop() {
  var divList = [document.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
  this.slide = Math.max(this.slide / this.deccel, 1);
  var slideInc = (this.direct == "up" || this.direct == "left") ? -parseInt(this.slide) : parseInt(this.slide);
  if ((this.direct == "up" && Math.max(parseInt(divList[1].style.top) + slideInc, parseInt(divList[2].style.top) + slideInc) <= 0) ||
      (this.direct == "down" && Math.min(parseInt(divList[1].style.top) + slideInc, parseInt(divList[2].style.top) + slideInc) >= 0) ||
      (this.direct == "left" && Math.max(parseInt(divList[1].style.left) + slideInc, parseInt(divList[2].style.left) + slideInc) <= 0) ||
      (this.direct == "right" && Math.min(parseInt(divList[1].style.left) + slideInc, parseInt(divList[2].style.left) + slideInc) >= 0)) {
    this.slide = ((this.direct == "up" || this.direct == "down") ? this.height : this.width) / this.begin;
    if (++this.blockup >= this.block.length) this.blockup = 0;
    this.divup = (this.divup == 1) ? 2 : 1;
    if (this.direct == "up" || this.direct == "down") {
      divList[3 - this.divup].style.top = ((this.direct == "down") ? "-" : "") + this.height + "px";
      divList[this.divup].style.top = "0px";
    } else {
      divList[3 - this.divup].style.left = ((this.direct == "right") ? "-" : "") + this.width + "px";
      divList[this.divup].style.left = "0px";
    } divList[3 - this.divup].innerHTML = this.table + this.block[this.blockup] + "</td></tr></table>";
    setTimeout(this.objName + ".scrollLoop();", this.pause);
  } else {
    for (var j = 1; j <= 2; j++) {
      if (this.direct == "up" || this.direct == "down") {
        divList[j].style.top = (parseInt(divList[j].style.top) + slideInc) + "px";
      } else divList[j].style.left = (parseInt(divList[j].style.left) + slideInc) + "px";
    } setTimeout(this.objName + ".scrollLoop();", this.speed);
  }
}

// document.body.onmousemove = function() { omm(); } ;

if (ns6)
{
	function emulateEventHandlers(eventNames)
	{
		for (var i = 0; i < eventNames.length; i++)
		{
			document.addEventListener(eventNames[i], function (e) { window.event = e; }, true); // using capture
		}
	}

	emulateEventHandlers(["click", "mousemove"]);
}


function ietruebody()
{
	return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth)
{
	imgwidth = imgwidth ? imgwidth : getFloatinWidth();
	imgheight = 0;

	which = wordz[which];
    
	var crossobj = document.getElementById ? document.getElementById("showimage") : document.all.showimage

	var pos_X = 0;
	var pos_Y = 0;

	if ( !e ) e = window.event;
	if ( e )
	{
		if ( typeof(e.pageX) == 'number' )
		{
			pos_X = e.pageX;
			pos_Y = e.pageY;
		}
		else if ( typeof(e.clientX) == 'number' )
		{
		 	pos_X = e.clientX;
			pos_Y = e.clientY;
			if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
			{
				pos_X += document.body.scrollLeft;
				pos_Y += document.body.scrollTop;
			}
			else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
			{
				pos_X += document.documentElement.scrollLeft;
				pos_Y += document.documentElement.scrollTop;
	        	}
		}
	}

		var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
		var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY

		var scroll_X = 0;
		var scroll_Y = 0;

		if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.debug || navigator.vendor == 'KDE' ) )
		{
			scroll_X = document.body.scrollLeft;
			scroll_Y = document.body.scrollTop;
		}
		else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.debug || navigator.vendor == 'KDE' ) )
		{
			scroll_X = document.documentElement.scrollLeft;
			scroll_Y = document.documentElement.scrollTop;
		}

//		var pos_X = horzpos + 15;
//		var pos_Y = vertpos + 15;
		var win_size_X = 0;
		var win_size_Y = 0;

		var win_size_X = 0;
		var win_size_Y = 0;

		if (window.innerWidth && window.innerHeight)
		{
			win_size_X = window.innerWidth;
			win_size_Y = window.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight)
		{
			win_size_X = document.documentElement.clientWidth;
			win_size_Y = document.documentElement.clientHeight;
		}
		else if (document.body && document.body.clientWidth && document.body.clientHeight)
		{
			win_size_X = document.body.clientWidth;
			win_size_Y = document.body.clientHeight;
		}

		if (!imgheight) imgheight=0;
		if (!imgwidth ) imgwidth=0;

		pos_X += 15;
		pos_Y += 15;

		if (crossobj.offsetWidth && crossobj.offsetHeight)
		{
			if (pos_X - scroll_X + crossobj.offsetWidth + 5 > win_size_X) pos_X -= (crossobj.offsetWidth + 15);
			if (pos_Y - scroll_Y + crossobj.offsetHeight + 5 > win_size_Y) pos_Y -= (crossobj.offsetHeight + 15);
		}

//		window.status = 'x:'+horzpos+' y:'+vertpos+' pos_x:'+pos_X+' pos_y:'+pos_Y+' height:'+crossobj.offsetHeight+' width:'+crossobj.offsetWidth+' offset_x:'+scroll_X+' offset_y:'+scroll_Y;

		crossobj.style.left = pos_X + "px";
		crossobj.style.top = pos_Y + "px";
//		crossobj.style.width=imgwidth+"px";

		crossobj.innerHTML='<div class=floatin>'+which+'</div>';
		crossobj.style.visibility="visible";
		return false;
}

function closepreview()
{
	if (!crossobj) crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage;
	crossobj.style.visibility="hidden";
}

function omm(e)
{
	if (!crossobj) return;

	var pos_X = 0;
	var pos_Y = 0;

	if ( !e ) e = window.event;
	if ( e )
	{
		if ( typeof(e.pageX) == 'number' )
		{
			pos_X = e.pageX;
			pos_Y = e.pageY;
		}
		else if ( typeof(e.clientX) == 'number' )
		{
		 	pos_X = e.clientX;
			pos_Y = e.clientY;
			if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
			{
				pos_X += document.body.scrollLeft;
				pos_Y += document.body.scrollTop;
			}
			else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
			{
				pos_X += document.documentElement.scrollLeft;
				pos_Y += document.documentElement.scrollTop;
        	}
		}
	}
}

function getFloatinWidth()
{
	// find width from css

	if (opera) return 300;
	ww = false;

	for (ss=0; ss<document.styleSheets.length; ss++)
	{
		a = document.styleSheets[ss];

		if (ie) css = a.rules;
		else css = a.cssRules;

		for (k=0; k<css.length; k++)
		{
			if (css[k].selectorText==".floatin") ww = css[k].style.width.replace(/px/, "");
		}
	}

	if (ww) return ww;
	else return 300;
}

function prop(obj)
{ // вывод всех свойств объекта
	var str = '';
	for (p in obj)
	{
		str += ('<div><font size=\"-1\"><b>' + p + '</b> '+ obj[p] + '</font></div>\n');
	}
	return str;
}

//-->