// JavaScript Document

window.onload=init;
var flag=true, it=0;
var flag2=false;
var timer;
function init(){
	document.onclick=function(){
		if( flag2 != true )
		{
			document.getElementById('lists').style.display='none';	
			flag=true;	
		}
		flag2=false;
	}
	mapInit();
	document.getElementById('blackPanel').onclick=function(){
		flag2=true;
		if (flag){
			document.getElementById('lists').style.display='block';	
			it=0;
			document.getElementById('listsBg').style.opacity=0;
			document.getElementById('listsBg').style.filter='alpha(opacity=0)';
			timer=setInterval('shadowing()',10);
			flag=false;
		}else{
			document.getElementById('lists').style.display='none';	
			flag=true;
		}
	}
	
}

function shadowing(){
	if (it<40){
		it++;
		document.getElementById('listsBg').style.opacity=it/100;
		document.getElementById('listsBg').style.filter='alpha(opacity='+it+')';
	} else clearInterval(timer);
}
var timer2;
var it2=1;
var obj;
var objs=new Array;
function mapInit(){
	var cities=document.getElementById('cities').childNodes;
	for(var i=0; i<cities.length; i++){
		objs[i]=cities[i].firstChild;
		objs[i].style.width=cities[i].offsetWidth+'px';
	}
	obj=objs[0];
	for(var i=0; i<objs.length; i++){
		objs[i].onmouseover=function(){
			clearInterval(timer2);
			it2=0;
			k=1;
			obj.nextSibling.style.width='4px';
			obj.nextSibling.style.height='4px';
			obj.parentNode.lastChild.style.fontSize='9px';
			obj=this;
			obj.parentNode.lastChild.style.color="#fff";
			timer2=setInterval('crease()',10);
		}
		objs[i].onmouseout=function(){
			clearInterval(timer2);
			k=-1;
			it2=8;
			obj.parentNode.lastChild.style.color="#fff";
			timer2=setInterval('crease()',10);
		}
		objs[i].onclick=function(){
			document.location.href=obj.parentNode.lastChild.href;	
		}
	}
}

function crease(){
	if (it2<10 && it2>-1){
		obj.nextSibling.style.top=(-1-Math.round(it2/3))+'px';
		obj.nextSibling.style.width=(5+k+it2)+'px';
		obj.nextSibling.style.height=(5+k+it2)+'px';
		obj.parentNode.lastChild.style.fontSize=(9+it2)+'px';
		it2=it2+k;
	}else
		clearInterval(timer2);
}