var ajaxV = function(){};
var divId = "";
ajaxV.view = function(cityName, vid){
	divId = vid;
	var url = "/citsonlineWeb/switchdo.do?prefix=/domestic&page=/domesticIndexBodyMain.do?divId=" + divId +"&cityName="+cityName;
	url = encodeURI(url);
	LoadingStart();
	ajaxV.sendDemoList(url);
}

var demoListObj = null;
ajaxV.sendDemoList = function(url){
	if(demoListObj == null)
	demoListObj = new ActiveXObject("Microsoft.XMLHTTP");
	demoListObj.open("GET", url, true);
	demoListObj.onreadystatechange = ajaxV.getDemoListResult;
	demoListObj.send(null);
}

ajaxV.getDemoListResult = function (){
	if(demoListObj.readyState == 4){
		if(demoListObj.status == 200){
			var result = demoListObj.responseText;
			document.getElementById(divId).innerHTML = result;
			
			LoadingStop();
		}else{
			alert("\u4e0e\u670d\u52a1\u5668\u4ea4\u4e92\u5931\u8d25");
		}
	}
}

ajaxV.formsubmit = function(cityName,vid) {
	ajaxV.view(cityName,vid);
}

function setClass(obj,type) {
	//获得上次选中的id
	var selCityId = document.getElementById(type+"OldSelCity").value;
	//保存当前选中的id
	document.getElementById(type+"OldSelCity").value = obj.id;
	
	if(type=='europe'){
		//恢复原来未选中的样式
		document.getElementById(selCityId).className = "gerrn_b";
		//设置选中样式
		obj.className="black_b";
	}else if(type=='asia'){
		document.getElementById(selCityId).className = "brown_001";
		obj.className="black_b";
	}else if(type=='oceania'){
		document.getElementById(selCityId).className = "blue_b";
		obj.className="black_b";
	}else if(type=='america'){
		document.getElementById(selCityId).className = "red_b";
		obj.className="black_b";
	}else if(type=='africa'){
		document.getElementById(selCityId).className = "purple_b";
		obj.className="black_b";
	}else if(type=='gat'){
		document.getElementById(selCityId).className = "gerrn_b";
		obj.className="black_b";
	}
}
	
function showAllStartCity(obj) {
	var allStartCityDiv = document.getElementById("allStartCity");
	allStartCityDiv.style.display = "block";
	var yPostion = obj.offsetTop;
	var xPostion = obj.offsetLeft;
	while (obj = obj.offsetParent) {
		if (navigator.userAgent.indexOf("MSIE") > 0) {
		  yPostion += obj.offsetTop;
		  xPostion += obj.offsetLeft;
		}
		if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
		  yPostion += obj.offsetTop;
		  xPostion += obj.offsetLeft;
		}
	}
	allStartCityDiv.style.left = xPostion;
	allStartCityDiv.style.top = yPostion + 15;
	allStartCityDiv.style.height = "auto";
	allStartCityDiv.style.width = 150;
}
	
function hideAllStartCity(){
	document.getElementById("allStartCity").style.display = "none";
}
