function ChangeImage(num,num2) {
	document.getElementById('id_slot1').style.backgroundImage = 'url(_files/image'+num+'.jpg)'; 
	document.getElementById('id_slot2').style.filter = 'alpha(opacity=0)';
	document.getElementById('id_slot2').style.opacity = '0.0';
	document.getElementById('id_slot2').style.backgroundImage = 'url(_files/image'+num2+'.jpg)'; 
	var sec = 0; 
    for (var i = 0; i <= 100; i=i+5) {
		setTimeout("document.getElementById('id_slot2').style.filter = 'alpha(opacity="+i+")'; document.getElementById('id_slot2').style.opacity = '"+(i/100)+"';", sec);
		sec = sec + 25;	
	}
}
function Wait1() {	setTimeout("Transform1();", 2000); }
function Wait2() {	setTimeout("Transform2();", 2000); }
function Wait3() {	setTimeout("Transform3();", 2000); }
function Wait4() {	setTimeout("Transform4();", 2000); }
function Wait5() {	setTimeout("Transform5();", 2000); }
function Wait6() {	setTimeout("Transform6();", 2000); }
function Transform1() {	ChangeImage(1,2);	setTimeout("Wait2();", 1200); }
function Transform2() {	ChangeImage(2,3);	setTimeout("Wait3();", 1200); }
function Transform3() {	ChangeImage(3,4);	setTimeout("Wait4();", 1200); }
function Transform4() {	ChangeImage(4,5);	setTimeout("Wait5();", 1200); }
function Transform5() {	ChangeImage(5,6);	setTimeout("Wait6();", 1200); }
function Transform6() {	ChangeImage(6,1);	setTimeout("Wait1();", 1200); }


function ChangeActionImage(num,num2) {
	document.getElementById('id_screen1').style.backgroundImage = 'url(_files/action'+num+'.jpg)'; 
	document.getElementById('id_screen2').style.filter = 'alpha(opacity=0)';
	document.getElementById('id_screen2').style.opacity = '0.0';
	document.getElementById('id_screen2').style.backgroundImage = 'url(_files/action'+num2+'.jpg)'; 
	var sec = 0; 
    for (var i = 0; i <= 100; i=i+5) {
		setTimeout("document.getElementById('id_screen2').style.filter = 'alpha(opacity="+i+")'; document.getElementById('id_screen2').style.opacity = '"+(i/100)+"';", sec);
		sec = sec + 15;	
	}
}
function WaitAction1() {	setTimeout("TransformAction1();", 700); }
function WaitAction2() {	setTimeout("TransformAction2();", 700); }
function WaitAction3() {	setTimeout("TransformAction3();", 700); }
function TransformAction1() {	ChangeActionImage(1,2);	setTimeout("WaitAction2();", 1000); }
function TransformAction2() {	ChangeActionImage(2,3);	setTimeout("WaitAction3();", 1000); }
function TransformAction3() {	ChangeActionImage(3,1);	setTimeout("WaitAction1();", 1000); }



function PagePrint() {
  document.getElementById('id_mainform').style.display = "none"; 
  document.getElementById('id_body').style.backgroundcolor = "#ffffff"; 
  document.getElementById('id_printform').style.display = "inline"; 
  window.print();
  document.getElementById('id_printform').style.display = "none"; 
  document.getElementById('id_body').style.backgroundcolor = "#000000"; 
  document.getElementById('id_mainform').style.display = "inline"; 
}

// http://xpoint.ru/know-how/JavaScript/PoleznyieFunktsii?31
// Определение координат элемента на странице
function getBounds(element)
{
  var left = element.offsetLeft;
  var top = element.offsetTop;
  for (var parent = element.offsetParent; parent; parent = parent.offsetParent)
  {
    left += parent.offsetLeft - parent.scrollLeft;
    top += parent.offsetTop - parent.scrollTop
  }
  return {left: left, top: top, width: element.offsetWidth, height: element.offsetHeight};
}
// Эта функция возвращает объект со свойствами left, top, width и height, определяющими координаты элемента относительно верхнего угла страницы и его размер. Пример использования:



function ShowElement(id) {
var top,left,width,height;

var element = document.getElementById('id_60');
var bounds = getBounds(element);
/*
alert('Координаты элемента: ' +
      '(' + bounds.left + ',' + bounds.top + ') x ' +
      '(' + bounds.width + ',' + bounds.height + ')');
*/
top = bounds.top-130-10; 
left = bounds.left;
width =  130; //bounds.width;
height = 130; //bounds.height;


  document.getElementById(id).style.top = top;
  document.getElementById(id).style.left = left;
  document.getElementById(id).style.width = width;
  document.getElementById(id).style.height = height;
  if (document.getElementById(id).style.display == "inline") {
    document.getElementById(id).style.display = "none";   
  } else {
    document.getElementById(id).style.display = "inline";  
  }

}


function isNumber(data) {
  var numStr="0123456789";
  var thisChar;
  var counter=0;
  for (var i=0; i<data.length; i++) {
    thisChar = data.substring(i, i+1);
    if (numStr.indexOf(thisChar) != -1)
      counter++;
  }
  if (counter == data.length)
    return 1;
  else
    return 0;
}
