var ticked = 0;											
var move = true;										
var forwardBackward = 1;									
var currentItem = 0;
var theNewContainer = 1;
var theOldContainer = 2;

function toggleContainers()
{
  theNewContainer = (theNewContainer == 1) ? 2 : 1;
  theOldContainer = (theOldContainer == 1) ? 2 : 1;
}

function containerSwitch(theNewItem)
{
  toggleContainers();
  document.getElementById("contentContainer_"+theNewContainer).innerHTML = theNewItem.content;
}

function rightOrLeft()										
{
  if (ticked == 1020)											
  {
    window.clearInterval(startTheMove);							
	ticked = 0;											
	forwardBackward = 1;										
	currentItem = newItem;								
    move = true;				
  }
  else
  {
    move = false;				
	thisAngle = (Math.PI/2)*(ticked/1000);						
	document.getElementById("mainContainer_"+theNewContainer).style.left = " "+(850-Math.sin(thisAngle)*700)+"px"; 
	document.getElementById("mainContainer_"+theNewContainer).style.top = " "+(65-(forwardBackward*Math.cos(thisAngle)*45))+"px"; 
	document.getElementById("mainContainer_"+theOldContainer).style.left = " "+(850-Math.sin(thisAngle+Math.PI/2)*700)+"px";
	document.getElementById("mainContainer_"+theOldContainer).style.top = " "+(65-(forwardBackward*Math.cos(thisAngle+Math.PI/2)*45))+"px"; 
	ticked += 20;												
  }
}

function moveItem(thisItem)										
{
  if(move && thisItem != currentItem)						
  {
    containerSwitch(a[thisItem]);
	newItem = thisItem;										
	document.getElementById("mainContainer_"+theNewContainer).style.zIndex = 50+10*forwardBackward;		
	document.getElementById("mainContainer_"+theOldContainer).style.zIndex = 50+20*forwardBackward;	   
	startTheMove = window.setInterval("rightOrLeft()",20);		
  }
}

function Item(itemName,content)
{
  this.itemName = itemName;
  this.content = content;
} 

function openImg(href, w, h)
{
	var win = window.open(href, '','width=' + (w - 4) + ', height=' + (h - 4));
	win.document.write('<html><head><title>Large picture</title' + '></head><body style="margin: 0px; padding: 0px; border: none;">');
	win.document.write('<img src=' + href + ' onclick=self.close() style=\"cursor: pointer;\" title=\"close window\">');
	win.document.write('</body></html>');
	win.focus();
	return false;
}

function openImg1(href, w, h)
{
	var win = window.open(href, '','scrollbars=1, top=0, left=50, width=' + (w - 4) + ', height=' + (h - 4));
	win.document.write('<html><head><title>Large picture</title' + '></head><body style="margin: 0px; padding: 0px; border: none;">');
	win.document.write('<img src=' + href + ' onclick=self.close() style=\"cursor: pointer;\" title=\"close window\">');
	win.document.write('</body></html>');
	win.focus();
	return false;
}

function movepic(img_name,img_src)
{
document[img_name].src=img_src;
}

function high(which2){
  theobject=which2
  highlighting=setInterval("highlightit(theobject)",20)
  }
function low(which2){
  clearInterval(highlighting)
  which2.filters.alpha.opacity=20
  }
function highlightit(cur2){
  if (cur2.filters.alpha.opacity<100)
  cur2.filters.alpha.opacity+=20
  else if (window.highlighting)
  clearInterval(highlighting)
  }

function email (login, sc)
{
var serv = new Array;
serv[0]= "mail.ru";
eml = login +  "@" + serv[sc];
return eml;
}
function mylo (login, sc)
{
document.write (email(login, sc));
}
function namylo (login, sc, sub)
{
eml = "mailto:" + email(login, sc);
if (sub != "") eml += "?subject=" + sub;
window.location.href = eml;
}
