var agt=navigator.userAgent.toLowerCase();
function printArticle() {
	var prn = new Image();

	if (window.print) {
		setTimeout('window.print();',200);
	}
	else if (agt.indexOf("mac") != -1) {
		alert("Press 'Cmd+p' on your keyboard to print article.");
	}
	else {
		alert("Press 'Ctrl+p' on your keyboard to print article.")
	}
}

function mOvr(src,clrOver){if (!src.contains(event.fromElement)){src.style.cursor = "hand";src.bgColor = clrOver;}} function mOut(src,clrIn){if (!src.contains(event.toElement)){src.style.cursor = "default";src.bgColor = clrIn;}}

function mClk(src){if(event.srcElement.tagName=="TD"){src.children.tags("A")[0].click();}}

  opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
  ie = (document.all && !opera)? true : false;
  dom = (document.getElementById)? true : false;


function getRelLeft(which) {
	var elem = document.all[which];
	var pos = elem.offsetLeft;
	while (elem.offsetParent != null) {
		elem = elem.offsetParent;
		pos += elem.offsetLeft;
		if (elem.tagName == 'BODY') break;
	}
	return pos;
}


function getRelTop(which) {
	var elem = document.all[which];
	var pos = elem.offsetTop;
	while (elem.offsetParent != null) {
		elem = elem.offsetParent;
		pos += elem.offsetTop;
		if (elem.tagName == 'BODY') break;
	}
	return pos;
}

function doOnMouseOver(what) {

         if(what == "1") {
              CloseBox("2");
//              CloseBox("3");
         }
         if(what == "2") {
              CloseBox("1");
//              CloseBox("3");
         }
/*
         if(what == "3") {
              CloseBox("1");
              CloseBox("2");
         }
*/
//				 eval("gm" + what).style.background = "url(/i/all" + (what-1) + "_off.gif)";
         eval("links" + what).style.left = getRelLeft("gm" + what)+3; // сдвиг по горизонтали
         eval("links" + what).style.top = getRelTop("gm" +what)+39;    // Отступ по вертикали
         eval("links" + what).is_open = true;
         eval("links" + what).style.display = "block";
  }

function doOnMouseOut(what,flag) {
           eval("links" + what).is_open = false;
           setTimeout('CloseBox(' + what + ', "' + flag + '")',400);
  }

function CloseBox(what,flag) {
//					 if (flag == 'on') eval("gm" + what).style.background = "url(/i/all" + (what-1) + "_on.gif)";
           if(!eval("links" + what).is_open) {
                eval("links" + what).style.display = "none";
           }
  }


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 nomove() { //nothing

}



function showdd(shide, ddnum, its){
	if(its){
		coordsL = getElementPosition(its)['left'];
		coordsT = getElementPosition(its)['top'];
	}
	/*alert(coordsL);
	alert(coordsT);*/
	if(shide=='show'){
		var menuToShow = document.getElementById('links'+ddnum);
		menuToShow.style.display = 'block';
		if(its){
			menuToShow.style.left = coordsL+'px';
			menuToShow.style.top = coordsT+59+'px';
		}
	}	else if (shide=='hide') {
		var menuToHide = document.getElementById('links'+ddnum);
		menuToHide.style.display = 'none';

	}



}




function getElementPosition(elem)
{
    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 ReloadSCode(p)
{

	var rnd =	Math.floor(Math.random( ) * (9999 - 1 + 1)) + 1;
	$("#ajfl").attr("src","/flood"+p+"/index.php?"+rnd);

 	var ua = navigator.userAgent.toLowerCase();
  	if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
		if (ua.indexOf("msie 6.") != -1) setTimeout("Perestroika()",13);
	}

} */

/* function ReloadSCode11(id)
{

	var rnd =	Math.floor(Math.random( ) * (9999 - 1 + 1)) + 1;
	if (id == 0)
	{
		$("#ajfl11").attr("src","/flood/index.php?"+rnd);
	}
	else {
		$("#ajfl11"+id).attr("src","/flood/index.php?"+rnd);
	}

 	var ua = navigator.userAgent.toLowerCase();
  	if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
		if (ua.indexOf("msie 6.") != -1) setTimeout("Perestroika()",13);
	}

} */

function Perestroika()
{
	var z = document.getElementById('scodeie').innerHTML;
	document.getElementById('scodeie').innerHTML = '' 	;
	document.getElementById('scodeie').innerHTML = 		z;
}

function ge(id)
{
	if (typeof(document.getElementById(id)) != 'undefined')
	{
		if (document.getElementById(id) != null)
		{
			return document.getElementById(id);
		}
	}
return false;
}

function displaySendSuccessStory(id,id2)
{

	if (ge(id).style.display == 'none')
	{
		ge(id).style.display = 'block';
		if (id2) ge(id2).style.display = 'none'
	}
	else {
		ge(id).style.display = 'none';
		if (id2) ge(id2).style.display = 'block'
	}

}//function displaySendSuccessStory()


function ShowMachineText(id,lng)
{

	$('#load_text').html('<img src="/i/loading.gif" alt="Please wait, loading">').load('/?ajax=3&id='+id+'&lng='+lng);

}//function ShowMachineText()
