function getLinks(parentId){
    links=Ext.get("linksdiv");
    links.load({
	url: encodeURI("getLinks.php?parentId="+parentId),																							  
	text: "loading.....",
	timeout: 30,
	scripts: true
	},
	function(){
																							    
		}
	);	
}

function getContinent(worldId,flag){
    getLinks(worldId);
    changeMap(worldId);
    workspace=Ext.get("infodiv");
    workspace.load({
	url: encodeURI("getInfo.php?parentId="+worldId+"&flag="+flag),																						  
	text: "loading.....",
	timeout: 30,
	scripts: true
	},
	function(){
																							    
		}
	);	
}


function getCitys(countryId,spanId,flag){
	
    getLinks(countryId);
    if(countryId==31){
        citys=Ext.get("infodiv");
        changeMap(countryId);
    }else{
        citys=Ext.get(spanId); 
    }
	if(citys==null){
	    window.location.href="destMain.php?linkId="+countryId;
	}else{
      citys.load({
	  url: encodeURI("getInfo.php?parentId="+countryId+"&flag="+flag),																							  
	  text: "loading.....",
	  timeout: 30,
	  scripts: true
	  },
	  function(){																    
		}
	);	
	}
	hiddenOrDisplay(spanId);
    
    
}


function getCity(provinceId,spanId,flag){
    getLinks(provinceId);
    city=Ext.get(spanId);
    if(city==null){
    window.location.href="destMain.php?linkId="+provinceId;
    }else{
    city.load({
	url: encodeURI("getInfo.php?parentId="+provinceId+"&flag="+flag),																							  
	text: "loading.....",
	timeout: 30,
	scripts: true
	},
	function(){
																							    
		}
	);	
	hiddenOrDisplay(spanId);
	}
}

function getCountry(continentId,flag,tag){
    getLinks(continentId);
    changeMap(continentId);
    workspace=Ext.get("infodiv");
    workspace.load({
	url: encodeURI("getInfo.php?parentId="+continentId+"&flag="+flag),																						    callback:function(){
		     if(tag==1){
	              getCitys(actionId,actionId+"",2);	 
			 }else{
			 
			 }			
	},
	text: "loading.....",
	timeout: 30,
	scripts: true
	}
	);	
}

function changeMap(id){
    workspace=Ext.get("mapdiv");
    workspace.load({
	url: encodeURI("map2/map_"+id+".html"),																							  
	text: "loading.....",
	timeout: 30,
	scripts: true
	},
	function(){
																							    
		}
	);	
}

function hiddenOrDisplay(spanId){
    var current=Ext.query("ul span");
	var len=current.length;
	 for(var i=0;i<len;i++){
        current[i].style.display="none";   		
		if(current[i].className==spanId){
		   current[i].style.display="block";   
		}
    }
}