
/*| 设置默认时间
-----------------------------------------------------------------------------------*/
function setDefaultTime(dateEle){
	var nowDate = new Date();
	var nowYear = nowDate.getFullYear();
	var nowMonth = nowDate.getMonth()+1;
	if (nowMonth < 10){
		nowMonth = "0"+nowMonth;
	}	
	var nowday = nowDate.getDate();
	if (nowday < 10){
		nowday = "0"+nowday;
	}	
	var strDate=nowYear+"-"+nowMonth+"-"+nowday;
	document.getElementById(dateEle).value = strDate;
}

function setDefaultTimeBack(dateEle){
	var nowDate;
	nowDate = stringToDateNew(document.getElementById("date1").value);
	if(nowDate==null||nowDate==""){
		nowDate = new Date();
	}
	nowDate.setDate(nowDate.getDate() + 1);
	var nowYear = nowDate.getFullYear();
	var nowMonth = nowDate.getMonth()+1;
	if (nowMonth < 10){
		nowMonth = "0"+nowMonth;
	}	
	var nowday = nowDate.getDate();
	if (nowday < 10){
		nowday = "0"+nowday;
	}	
	var strDate=nowYear+"-"+nowMonth+"-"+nowday;
	document.getElementById(dateEle).value = strDate;
}

function stringToDateNew(sDate)
{	var year, month, day;
	var iaDate = new Array(3);
	
	if (isDateStringNew(sDate))
	{  iaDate = sDate.toString().split("-")
		year = parseFloat(iaDate[0])
		month = parseFloat(iaDate[1]) - 1
		day=parseFloat(iaDate[2])
		return (new Date(year,month,day));
	}
	else
	{
		alert("传入字符串格式错误");
		return (new Date(1900,1,1))
	}
}


/*| themes xml
-----------------------------------------------------------------------------------*/
function readThemesXML(){
		var hostName = "http://www.csair.com"
		var themeJson = {
			themes:[
					{themeName:"默认",cssHref:hostName+"/google/googlemap/themes/default/style.css",dafault:"yes"},
					{themeName:"个性",cssHref:hostName+"/google/googlemap/themes/bookpage/style.css",dafault:""}
					/*{themeName:"青苹果",cssHref:hostName+"/google/googlemap/themes/default/style.css",dafault:""},
					{themeName:"玫瑰红",cssHref:hostName+"/google/googlemap/themes/apple/style.css",dafault:""},
					{themeName:"宝石蓝",cssHref:hostName+"/google/googlemap/themes/default/style.css",dafault:""}*/
				   ]
		};
		$.each(themeJson.themes, function(i,item){
			var themeName = item.themeName;
			var cssHref = item.cssHref;
			var dafault = item.dafault;
			if(dafault){
				$('#themestyle').attr("href",cssHref);
			}
			$('<span></span>').html('<input type="hidden" value="'+cssHref+'" />'+themeName).appendTo('#themes');
		});
		$("#themes").find("span").click(function(){
			$("#themestyle").attr("href",$(this).find("input").val());
			$("#mapLeft").height($("#mapMiddle").height());
			$("#mapRight").height($("#mapMiddle").height());
		});
	}
