function next_i()
{
	
for (i = 0; i < 3; i++)
	{ 
		if (document.getElementById('p0').src==document.getElementById('p'+i).src)
		{
			r = document.getElementById('p0').src;
			for (j = 0; j < 3; j++)
			{
				if (document.getElementById('p'+eval(j+1)))
				{
					document.getElementById('p'+j).src = document.getElementById('p'+eval(j+1)).src;
				}
				else
					document.getElementById('p'+j).src = r;
			}
			return true;
		}
	}
}

function back_i()
{
	for (i = 0; i < 3; i++)
	{ 
		if (document.getElementById('p0').src==document.getElementById('p'+i).src)
		{
			r = document.getElementById('p2').src;
			for (j = 2; j >= 0; j--)
			{
				if (document.getElementById('p'+eval(j-1)))
				{
					document.getElementById('p'+j).src = document.getElementById('p'+eval(j-1)).src;			
				}
				else
					document.getElementById('p0').src = r;
			}
			return true;
		}
	}
}


function show_auth(){
	if (document.getElementById('auth').style.display=='none')
		document.getElementById('auth').style.display='block';
	else
		document.getElementById('auth').style.display='none';
}


function send (a, b)
{
eml = a +  "@" + b;
return eml;
}

function send2 (a, b)
{
document.write (send(a, b));
}

function send3 (a, b, c)
{
eml = "mailto:" + send(a, b);
if (c != "") eml += "?subject=" + c;
window.location.href = eml;
}
////////////////////

//var n=0;
//var step=3;//шаг прокрутки
var busy=false;//чтобы 2 раза не жали одновременно
//function show_n(v){//step - шаг прокрутки, w-ширина шага
//	var _step=3;
//	var _w=300;
//	if (busy && v==0)
//	{
//		return false;
//	}
//	busy=true;
//	n = v + _step;
//	if (document.getElementById('scr').scrollLeft>0)
//		document.getElementById('prew1').style.visibility="visible";
//	if (n<=_w)
//	{
//		document.getElementById('scr').scrollLeft+=_step;
//		setTimeout("show_n(n)", 5);
//	}
//	else
//	{
//		busy=false;
//		if (document.getElementById('scr').scrollLeft>=document.getElementById('scr').scrollWidth-999)
//			document.getElementById('next1').style.visibility="hidden";
//	}
//}

//function show_p(v){//step - шаг прокрутки, w-ширина шага
//	var _step=3;
//	var _w=300;
//	if (busy && v==0)
//	{
//		return false;
//	}
//	busy=true;
//	n = v + _step;
//
//	if (document.getElementById('scr').scrollLeft<document.getElementById('scr').scrollWidth-999)
//		document.getElementById('next1').style.visibility="visible";
//	if (n<=_w)
//	{
//		document.getElementById('scr').scrollLeft-=_step;
//		setTimeout("show_p(n)", 5);
//	}
//	else
//	{
//		busy=false;
//		n=0;
//		if (document.getElementById('scr').scrollLeft<=0)
//			document.getElementById('prew1').style.visibility="hidden";
//	}
//}

var direction=0;
var step_index=-1;

function show_n(v){
	if (step*3>scrollWidth-curposition)
	{
		curstep=step*(items%3);
		document.getElementById('next1').style.visibility="hidden";
		direction=1;
	}
	if (step*3==scrollWidth-curposition)
	{
		curstep=step*3;
		document.getElementById('next1').style.visibility="hidden";
		direction=1;
	}
	if (step*3<scrollWidth-curposition)
	{
		curstep=step*3;
	}
 
	$("#scr").animate({"left": "+=75px"}, "normal");
	$("#scr").animate({"left": "-="+(curstep+150)+"px"}, "normal");
	$("#scr").animate({"left": "+=75px"}, "normal");

	curposition=curposition+curstep;
	step_index++;

	if (curposition>=step)
	{
		document.getElementById('prew1').style.visibility="visible";
	}
 
}

function show_p(v){
	if (step_index==0)
	{
		if (direction==1){direction=0;}
		else {curstep=step*3;}
		document.getElementById('prew1').style.visibility="hidden";
	} else {
		if (direction==1){direction=0;}
		else {curstep=step*3;}
	}
	if (curposition<step*3)
	{
		curstep=curposition;
	} else {
		curstep=step*3;
	}
	$("#scr").animate({"left": "-=75px"}, "normal");
	$("#scr").animate({"left": "+="+(curstep+150)+"px"}, "normal");
	$("#scr").animate({"left": "-=75px"}, "normal");

	curposition=curposition-curstep;
	step_index--;

	if (scrollWidth-curposition>=step)
	{
		document.getElementById('next1').style.visibility="visible";
	}
}

function show_elem(id) {
	elem = document.getElementById(id);
	if (elem)
		elem.style.display = 'block';
}

function openCenteredWindow(id) {
	elem = document.getElementById(id);
	if (elem)
	if (elem.style.display=='block')
	{
		var pageCoords = getPageCoords();
		elem.style.top = parseInt(pageCoords[2] + (pageCoords[0] - 55) / 2 - 150) + 'px';
	}
}



function getPageCoords() {
	var coords = [0, 0, 0]; // height of window, document, scroll pos
	// all except IE
	if (window.innerHeight) {
		coords[0] = window.innerHeight;
		coords[2] = window.pageYOffset;
	}
	// IE 6 Strict
	else if (document.documentElement && document.documentElement.clientHeight != 0) {
		coords[0] = document.documentElement.clientHeight;
		coords[2] = document.documentElement.scrollTop;
	}
	else if (document.body) {
		coords[0] = document.body.clientHeight;
		coords[2] = document.body.scrollTop;
	}

	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) {
		coords[1] = document.body.scrollHeight;
	} else {
		coords[1] = document.body.offsetHeight;
	}
	if (coords[1] < coords[0]) coords[1] = coords[0];

	return coords;
}


function close_div(id){
	elem = document.getElementById(id);
	if (elem)
		elem.style.display = 'none';
}	