
var citySpeed=5000;//停顿
var cityFlashSpeed=50;//图片放大缩小
var curCity=0;//默认第一张图片放大
var oldCity;
var cityZoom=new Array(4);//TimeID
var cityType=new Array(4);//缩放类型
Marquee(curCity);//默认第一幅图开始放大

function Marquee(city){
    if(city==null || city==0){
        city=curCity+1;
        if(city>5)city=1;
    }
    else //中断
    {
		if(city==curCity) return;
//		else if(city==oldCity)
//		{
//			clearZoom(cityZoom[curCity]);
//			cityType[curCity]=null;
//			document.getElementById("homeCity"+curCity).parentNode.className="";
//			clearZoom(cityZoom[oldCity]);
//			cityType[oldCity]=null;
//			document.getElementById("homeCity"+city).parentNode.className="";
//		}
//		else
//		{
//		    if(cityType[city]=="1"){clearZoom(cityZoom[city]);}   
//			for(i=1;i<4;i++)
//			{
//				if(i!=city && cityType[i]!=null && cityType[i]=="1")
//				{
//					clearZoom(cityZoom[i]);
//					document.getElementById("homeCity"+i).width="110";
//					document.getElementById("homeCity"+i).height="79"
//			        document.getElementById("homeCity"+i).parentNode.className=""; 
//			        
////					cityType[i]="2";
////			        cityZoom[i]=setTimeout("CityPicZoom('" +i + "',2)",cityFlashSpeed);
//				}
//			}
//		}
    }
    if(document.getElementById("homeCity"+curCity)!=null)
    {
		clearZoom(cityZoom[curCity]);
		document.getElementById("homeCity"+curCity).width="102";
		document.getElementById("homeCity"+curCity).height="73"
//		cityType[curCity]="2";
//		cityZoom[curCity]=setTimeout("CityPicZoom('" +curCity + "',2)",cityFlashSpeed);		
        document.getElementById("homeCity"+curCity).parentNode.className="";        
        
    }
    if(document.getElementById("homeCity"+city)!=null){
		clearZoom(cityZoom[city]);
		cityZoom[city]=setTimeout("CityPicZoom('" +city + "',1)",cityFlashSpeed);
		cityType[city]="1";
        document.getElementById("homeCity"+city).parentNode.className="transform";
    }
    oldCity=curCity;
    curCity=city;
}
function CityPicZoom(city,type)
{
    var obj=document.getElementById("homeCity"+city);
//    var obj1=document.getElementById("homeCity" + city + "_1");
    if(obj==null)return;
    switch(type)
    {
        case 1://width="172" height="123"  
            if(obj.width<172){
                obj.width+=7;
                obj.height+=5;
//                obj1.width=obj.width;
//                obj1.height=obj.height+20;
				cityZoom[city]=setTimeout("CityPicZoom('" +city + "',1)",cityFlashSpeed); 
				cityType[city]="1";
            }			
			else
			{
				clearZoom(cityZoom[city]);
				cityType[city]=null;
			}
            break;
        case 2://width="110" height="79"
            if(obj.width>102){
                obj.width-=7;
                obj.height-=5;
//                obj1.width=obj.width;
//                obj1.height=obj.height+20;
				cityZoom[city]=setTimeout("CityPicZoom('" +city + "',2)",cityFlashSpeed); 
				cityType[city]="2";
            } 
			else
			{
				clearZoom(cityZoom[city]);
				cityType[city]=null;
			}
            break;
    }
}
function clearZoom(zoomName)
{
	clearTimeout(zoomName);
}
var MyMar=setInterval(Marquee,citySpeed);
function clearMarquee(city)
{   
    clearInterval(MyMar);  
    Marquee(city);
}
function startMarquee(city){    
    MyMar=setInterval(Marquee,citySpeed);
}

