function show_map(index)
{

displayCurtain(true);
obj = document.getElementById('maps'+index);
obj.style.width="1px";
obj.style.height="1px";

obj.className='mapd click';


objx2 = document.getElementById('x21');
posx2=objx2.offsetLeft;


widthx=parseInt(posx2);

objFrame = document.getElementById('mainFrame'+index);
objFrame.style.width=widthx+'px';
if(index==1)
objFrame.style.top='360px';
else
objFrame.style.top='560px';

obj = document.getElementById('mapbig'+index);
obj.style.display="";
oTween = new Tween(obj, 'left',Math.easeOutElastic,widthx,widthx-671,10);
oTween2 = new Tween(obj, 'height',Math.easeOutElastic, 220 ,466,10);

document.location.href="#map1";
}
function hide_map(index)
{
displayCurtain(false);
obj = document.getElementById('maps'+index);

obj.style.width="180px";
obj.style.height="146px";
obj.className='map'+index+' click';


objFrame = document.getElementById('mainFrame'+index);
objFrame.style.width='1px';




objx2 = document.getElementById('x21');
posx2=objx2.offsetLeft;


widthx=parseInt(posx2);




obj = document.getElementById('mapbig'+index);
obj.style.display="none";

oTween = new Tween(obj, 'left',Math.easeOutExpo, widthx-671,widthx-0,10);
oTween2 = new Tween(obj, 'height',Math.easeOutExpo, 466,220,10);
}

function check_map(index)
{

objx2 = document.getElementById('x21');
posx2=objx2.offsetLeft;


widthx=parseInt(posx2);

objFrame = document.getElementById('mainFrame'+index);
objFrame.style.width=widthx+'px';

obj = document.getElementById('maps'+index);

if(obj.className=='mapd click'){

maPbig = document.getElementById('mapbig'+index);
maPbig.style.left= parseInt(widthx-671)+'px';
curtain2 = document.getElementById('curtain');
wrapper2 =document.getElementById('Container')
curtain2.style.width=parseInt(wrapper2.offsetWidth)-1;
//alert(mapbig);
//mapbig.style.left= '100px';
}


}
function check_click(id)
{
curval=document.getElementById('cur').value;
if(parseInt(BlocksOnPage)+parseInt(curval)==id) move_left();
if(id==BlocksOnPage) move_right();
}

function set_positions()
{
	tmp=BlocksOnPage;
	x1s=document.getElementById('x1');
	x2s=document.getElementById('x2');
	document.getElementById('widthx').value=parseInt(x2s.offsetLeft);
	screenW=parseInt(x2s.offsetLeft);
	
	start_=1;
	end_=20;
	curval = parseInt(document.getElementById('cur').value);
	for(i=start_;i<end_;i++)
	{
	HistoryWidth=parseInt(screenW/i);
	if(HistoryWidth>minHistoryWidth && HistoryWidth<maxHistoryWidth){ BlocksOnPage=i; break;}
	}
	for(i=1;i<=HistoryBloks;i++)
	{
		document.getElementById('block'+i).style.width=HistoryWidth+1+'px';
		document.getElementById('tblock'+i).style.width=HistoryWidth+1+'px';
	
	}
	//alert(HistoryWidth);
	HistoryWidth=HistoryWidth;
	
	document.getElementById('cur').value=parseInt(0-(HistoryBloks-BlocksOnPage));
	
	//document.getElementById('area').style.left=parseInt(HistoryWidth*parseInt(document.getElementById('cur').value))-BlocksOnPage+'px';
	document.getElementById('area').style.left=parseInt(HistoryWidth*curval)+'px';
	///alert(-(HistoryBloks-tmp));
	if(curval==-(HistoryBloks-tmp)) {document.getElementById('cur').value=parseInt(0-(HistoryBloks-BlocksOnPage));	document.getElementById('area').style.left=parseInt(HistoryWidth*parseInt(document.getElementById('cur').value))+'px';}
		
		check_left();
		check_right();
		check();
}
function to_end()
{
	document.getElementById('cur').value=parseInt(0-(HistoryBloks-BlocksOnPage));
	document.getElementById('area').style.left=parseInt(HistoryWidth*parseInt(document.getElementById('cur').value))+'px';
	check_left();
	check_right();
	check();
}
function to_begin()
{
	document.getElementById('cur').value=parseInt(0);
	document.getElementById('area').style.left=parseInt(HistoryWidth*parseInt(document.getElementById('cur').value))+'px';
	check_left();
	check_right();
	check();
	document.getElementById('HistoryMain').style.visibility="visible";
	move_right();move_right();
	move_left();move_left();
}
function showdiv(id,total)
{
	for(i=1;i<=total;i++)
	{

	obj = document.getElementById('description'+i);
	obj2 = document.getElementById('title'+i);
	obj3 = document.getElementById('title_underline'+i);
	obj4 = document.getElementById('years'+i);
	obj5 = document.getElementById('comment_underline'+i);
		if(obj && obj2 && obj3)
		if(i==id)	{
			obj.style.display='';
			obj2.className='green n-click';
			obj3.className='bgr-darkgreen';
			obj3.style.height='3px';
			obj4.style.display='';
			obj5.className='green';
		}
		else 
		{
			obj.style.display='none';
			obj2.className='beige click';
			obj3.className='bgr-gray-common';
			obj3.style.height='1px';
			obj4.style.display='none';
			obj5.className='textcolor';
		}
	
	}
}

function showdiv2(id,total)
{
///alert(1);
set_positions();
//alert(2);
	for(i=1;i<=total;i++)
	{

	obj = document.getElementById('border'+i);
	obj2 = document.getElementById('div'+i);
	obj3 = document.getElementById('img'+i);
	obj4 = document.getElementById('descr'+i);
	obj5 = document.getElementById('bimg'+i);
	//alert(obj4);
		if(obj && obj2 && obj4)
		if(i==id)	{
			obj.className='bgr-green';
			obj2.className='n-click green';
			obj3.className='n-click border-gray';
			obj4.style.display='';
			obj5.style.display='';
		}
		else 
		{
			obj.className='d';
			obj2.className='n-click gray';
			obj3.className='click border-gray';
			obj4.style.display='none';
			obj5.style.display='none';
		}
	
	}
}

function showdiv3(id,total)
{

	for(i=1;i<=total;i++)
	{

	obj = document.getElementById('title'+i);
	obj2 = document.getElementById('bg'+i);
	obj4 = document.getElementById('content'+i);
	//alert(obj4);
		if(obj && obj2 && obj4)
		if(i==id)	{
			obj.className='bold orange n-click n-dotted';
			obj2.className='bgr-x-lightgeen';
			obj4.style.display='';
		}
		else 
		{
			obj.className='bold orange click dotted';
			obj2.className='';
			obj4.style.display='none';
		}
	
	}
}


function move_left()
{


obj = document.getElementById('area');
curval = parseInt(document.getElementById('cur').value);
tmp=MoveBlocks;
//alert(parseInt(curval+MoveBlocks)+'<'+MoveBlocks);
if(parseInt(curval+MoveBlocks)<MoveBlocks && parseInt(curval+MoveBlocks)>0) {  MoveBlocks=parseInt(MoveBlocks-(curval+MoveBlocks));document.getElementById('left').value=0; }
if(curval!=0){
	
oTween = new Tween(obj, 'left',func, HistoryWidth*curval,HistoryWidth*curval+ HistoryWidth*MoveBlocks,duration);
document.getElementById('cur').value=parseInt(curval+MoveBlocks);
}
MoveBlocks=tmp;
	
	check_left();
	check_right();
	check();
}
function check_left()
{

	curval = parseInt(document.getElementById('cur').value);
	//alert(parseInt(curval+MoveBlocks)+"<"+MoveBlocks);
	
	if(parseInt(curval+MoveBlocks)<MoveBlocks) { document.getElementById('left').value=1; }else{ document.getElementById('left').value=0;}
	
}

function check_right()
{

	curval = parseInt(document.getElementById('cur').value);
	//alert(curval-MoveBlocks-BlocksOnPage);
	//alert(0-HistoryBloks-MoveBlocks);
	if(parseInt(curval-MoveBlocks-BlocksOnPage)<=parseInt(0-HistoryBloks-MoveBlocks)) {document.getElementById('right').value=0;}else{document.getElementById('right').value=1;}

}

function move_right()
{

obj = document.getElementById('area');

curval = parseInt(document.getElementById('cur').value);

tmp=MoveBlocks;

if(parseInt(curval-MoveBlocks-BlocksOnPage)<parseInt(0-HistoryBloks)) { MoveBlocks=(HistoryBloks+curval-BlocksOnPage)}

oTween = new Tween(obj, 'left',func, HistoryWidth*curval, HistoryWidth*curval-HistoryWidth*MoveBlocks,duration);

document.getElementById('cur').value=parseInt(curval-MoveBlocks);


MoveBlocks=tmp;

check_left();

	check_right();
	
	check();
	
//if(parseInt(curval+MoveBlocks)>0) { document.getElementById('left').value=0; }else{ document.getElementById('left').value=1;}

}
function check()
{

val_left=parseInt(document.getElementById('left').value);
val_right=parseInt(document.getElementById('right').value);

obj1=document.getElementById('arrow_left');
obj2=document.getElementById('arrow_right');
//alert("!");
	if(val_left==1)
		{
			
			obj1.className="b-before click beige-i";
			obj1.style.display="";
		
		}else
		{
			
			obj1.className="b-before  white-i";
			//obj1.style.display="none";
			
		}
		
	if(val_right==1)
		{
			obj2.className="beige-i click";
			obj2.style.display="";
			
		}else
		{
			
			obj2.className="d n-click";
			obj2.style.display="none";
			
		}
		
}


