var ml=0;
var mr=0;
function ppp()
{
$('#blockI').html('<img src="photo/1.jpg" width="1" height="1" alt="" /><img src="photo/2.jpg" width="1" height="1" alt="" /><img src="photo/3.jpg" width="1" height="1" alt="" /><img src="photo/4.jpg" width="1" height="1" alt="" /><img src="photo/5.jpg" width="1" height="1" alt="" /><img src="photo/6.jpg" width="1" height="1" alt="" />');
}

function newsout(i)
{

i2=i-1;
//if (i2==-1) { i2=1; }

if (i2>=0)
{
if (i2<evamax)
{
document.getElementById('newsj').innerHTML = evatext[i2];
}
}



if (i2<=0)
{
	document.getElementById('r').style.visibility = 'hidden';

}
else
{
	document.getElementById('r').style.visibility = 'visible';

}


if (i2>=evamax-1)
{
	document.getElementById('l').style.visibility = 'hidden';

}
else
{
	document.getElementById('l').style.visibility = 'visible';

}


}
function newsout2(i)
{
if (i==1) { tek=tek-1; }
if (i==2) { tek=tek+1; }
newsout(tek);
}

function getW()
{
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getH()
{
	return window.innerHeight;
}

gPhoto = 3;

function photo()
{
	document.getElementById('photo').innerHTML = '<img src="photo/' + gPhoto + '.jpg" height="' + getH() + 'px;"/>';
	document.getElementById('arrTable').style.height = getH() + 'px';
	document.getElementById('arrTable').style.width = getW() + 'px';
	
	infPosition();
}

function resizeAll()
{
	photo();
	infPosition();
}

function infPosition()
{
	if ( gPhoto == 1 )
	{
		$("#info").animate({top: getH() / 2.6 + 'px', left: getW() / 2.8 + 'px'}, 200,
function() {
    // Animation complete.

$("#info").css('visibility','visible');
$("#iImg").css('visibility','visible');
  }
);
		$("#infTable").animate({top: getH() / 7.5 + 'px', left: getW() / 5.7 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf1;
	}
	if ( gPhoto == 2 )
	{
		$("#info").animate({top: getH() / 2.4 + 'px', left: getW() / 2.5 + 'px'}, 200);
		$("#infTable").animate({top: getH() / 7.5 + 'px', left: getW() / 5.2 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf2;
	}
	if ( gPhoto == 3 )
	{
		$("#info").animate({top: getH() / 2.5 + 'px', left: getW() / 1.8 + 'px'}, 200,


function() {
    // Animation complete.

$("#info").css('visibility','visible');
$("#iImg").css('visibility','visible');
  }

);
		$("#infTable").animate({top: getH() / 5.5 + 'px', left: getW() / 1.6 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf3;
	}
	if ( gPhoto == 4 )
	{
		$("#info").animate({top: getH() / 2.2 + 'px', left: getW() / 2.6 + 'px'}, 200);
		$("#infTable").animate({top: getH() / 5.5 + 'px', left: getW() / 4.9 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf4;
	}
	if ( gPhoto == 5 )
	{
		$("#info").animate({top: getH() / 2.1 + 'px', left: getW() / 1.83 + 'px'}, 200);
		$("#infTable").animate({top: getH() / 1.8 + 'px', left: getW() / 1.7 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf5;
	}
	if ( gPhoto == 6 )
	{
		$("#info").animate({top: getH() / 2.5 + 'px', left: getW() / 2.1 + 'px'}, 200);
		$("#infTable").animate({top: getH() / 5.8 + 'px', left: getW() / 1.8 + 'px'}, 200);
		document.getElementById('infTxtDiv').innerHTML = bagInf6;
	}

if ( gPhoto == 7 )
     {
          $("#info").animate({top: getH() / 2.5 + 'px', left: getW() / 2.4 + 'px'}, 200);
          $("#infTable").animate({top: getH() / 4.5 + 'px', left: getW() / 4.6 + 'px'}, 200);
          document.getElementById('infTxtDiv').innerHTML = bagInf7;
     }


}

function showInfo()
{
	document.getElementById('infTable').style.visibility = 'visible';
	document.getElementById('infTable').style.display = 'block';
	
	if ( gPhoto == 1 )
	{
		document.getElementById('infTable').style.top = getH() / 7.5 + 'px';
		document.getElementById('infTable').style.left = getW() / 5.7 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf1;
	}
	if ( gPhoto == 2 )
	{
		document.getElementById('infTable').style.top = getH() / 7.5 + 'px';
		document.getElementById('infTable').style.left = getW() / 5.2 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf2;
	}
	if ( gPhoto == 3 )
	{
		document.getElementById('infTable').style.top = getH() / 5.5 + 'px';
		document.getElementById('infTable').style.left = getW() / 1.6 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf3;
	}
	if ( gPhoto == 4 )
	{
		document.getElementById('infTable').style.top = getH() / 5.5 + 'px';
		document.getElementById('infTable').style.left = getW() / 4.9 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf4;
	}
	if ( gPhoto == 5 )
	{
		document.getElementById('infTable').style.top = getH() / 1.8 + 'px';
		document.getElementById('infTable').style.left = getW() / 1.7 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf5;
	}
	if ( gPhoto == 6 )
	{		
		document.getElementById('infTable').style.top = getH() / 5.8 + 'px';
		document.getElementById('infTable').style.left = getW() / 1.8 + 'px';
		
		document.getElementById('infTxtDiv').innerHTML = bagInf6;
	}
}

function closeInfo()
{
	document.getElementById('infTable').style.visibility = 'hidden';
	document.getElementById('infTable').style.display = 'none';
}

function leftx()
{
	
	if ( gPhoto == 1 )
	{
		gPhoto = 7;
	}
	else
	{
		gPhoto = gPhoto - 1;
	}
	document.getElementById('photo').innerHTML = '<img src="photo/' + gPhoto + '.jpg" height="' + getH() + 'px;"/>';
	infPosition();
}

function rightx()
{
	
	if ( gPhoto == 7 )
	{
		gPhoto = 1;
	}
	else
	{
		gPhoto = gPhoto + 1;
	}
	
	document.getElementById('photo').innerHTML = '<img src="photo/' + gPhoto + '.jpg" height="' + getH() + 'px;"/>';
	infPosition();
}





function leftColx()
{
if (mr==0)
{
	if ( bagPos != 0 ){
mr=2;
 $("#imgStream").animate({marginLeft: "+=120"}, 700
,function(){ mr=0; }); bagPos = bagPos - 1; 
maxer=maxer+120;
document.getElementById('rightCol').style.visibility = 'visible';

}


	if ( bagPos == 0 ) { document.getElementById('leftCol').style.visibility = 'hidden'; } else { document.getElementById('leftCol').style.visibility = 'visible'; }
}
}

function rightColx()
{

if (ml==0)
{
	if ( bagPos != bagMax ){ 
ml=2;
$("#imgStream").animate({marginLeft: "-=120"}, 700, function(){ ml=0; }); bagPos = bagPos + 1; 
maxer=maxer-120;
}
}


if (maxer <= 810)
{ 
document.getElementById('rightCol').style.visibility = 'hidden'; } else { document.getElementById('rightCol').style.visibility = 'visible'; }
	if ( bagPos == 0 ) { document.getElementById('leftCol').style.visibility = 'hidden'; } else { document.getElementById('leftCol').style.visibility = 'visible'; }

}

function showBag(id)
{

	document.getElementById('mainBag').src = pht[id];

	document.getElementById('bagTxtInfo').innerHTML = inf[id];
	$('#'+id).animate({opacity: 0.5}, 0 ); $('#'+id+'txt').animate({color: '#000'}, 0 );
	if ( gId != id ) { $('#'+gId).animate({opacity: 1}, 0 ); $('#'+gId+'txt').animate({color: '#999'}, 0 ); } 
	gId = id;	
}

function showBagZakaz(id)
{

	document.getElementById('zImg').src = 'load.gif';

		document.getElementById('pp').innerHTML = "";
	$('#pp').css('visibility','hidden');
	$('#pp').css('display','none');
	document.getElementById('rSide').style.visibility = 'visible';


	document.getElementById('zImg').src = pht[id];

	document.getElementById('zakazInfo').innerHTML = '<span class="mName">' + bName[id] + '</span><br /><br /><span class="mInfo">' + bInf[id] + '</span><br /><br /><br /><span class="mInfo">Стоимость: ' + bPrice[id] + '</span><br /><br /><br /><br /><br /><span class="mInfo"><strong>Оформить заказ можете по телефону</strong></span><br/><br/><br/><br/><br/><br/>';
	}


function zoom(id)
{


	document.getElementById('bImg').src = 'load.gif';

     document.getElementById('whiteX').style.width = getW() + 'px';
     document.getElementById('whiteX').style.height = getW()+'px';
     document.getElementById('whiteX').style.visibility = 'visible';
     document.getElementById('whiteX').style.display = 'block';
     
     document.body.style.overflow = 'hidden';
     
     document.getElementById('zText').innerHTML = inf[id];


	document.getElementById('bImg').src = pht[id];
}

function closeINF()
{
     document.getElementById('whiteX').style.visibility = 'hidden';
     document.getElementById('whiteX').style.display = 'none';
     
     document.body.style.overflow = 'auto';
}


