//Firefox属性兼容
if (window.addEventListener) {
FixPrototypeForGecko();
}
function FixPrototypeForGecko() {
HTMLElement.prototype.__defineGetter__("runtimeStyle", element_prototype_get_runtimeStyle);
window.constructor.prototype.__defineGetter__("event", window_prototype_get_event);
Event.prototype.__defineGetter__("srcElement", event_prototype_get_srcElement);
HTMLElement.prototype.__defineGetter__("innerText", element_get_innerText);
HTMLElement.prototype.__defineSetter__("innerText", element_set_innerText);
}
function element_prototype_get_runtimeStyle() {
//return style instead...
return this.style;
}
function window_prototype_get_event() {
return SearchEvent();
}
function event_prototype_get_srcElement() {
return this.target;
}
function SearchEvent() {
//IE
if (document.all)
return window.event;
func = SearchEvent.caller;
while (func != null) {
var arg0 = func.arguments[0];
if (arg0) {
if (arg0.constructor == MouseEvent)
return arg0;
}
func = func.caller;
}
return null;
}
function element_get_innerText() {
var anyString = "";
var childS = this.childNodes;
for (var i = 0; i < childS.length; i++) {
if (childS[i].nodeType == 1)
anyString += childS[i].innerText;
else if (childS[i].nodeType == 3)
anyString += childS[i].nodeValue;
}
return anyString;
}
function element_set_innerText(sText) {
this.textContent = sText;
}
//Firefox属性兼容--end
//获取元素
function getElement(eleName) {
return document.getElementById(eleName);
}
var maxYear;
var minYear;
var maxMonth;
var minMonth;
var maxWeek;
var minWeek;
var indexType;
var brandType;
var sortDateType;
var cityDateType;
var topDateType;
var levelDateType;
//时间选择控件
var ddlTimeObj = null;
var spanTimeObj = null;
var spanYearObj = null;
var btnTime = null;
var curObjName = null;
var dateNum = null; //存储当前日期类型下的数字,即第几月,第几季度。选择周时也存月份
//城市选择
var cityObj = null;
//打开月选择框
function openDdlMonth(objName) {
curObjName = objName;
ddlTimeObj = getElement("ddlMonth_" + objName);
spanTimeObj = getElement("spanTime_" + objName);
spanYearObj = getElement("spanYear_" + objName);
btnTime = getElement("btnTime_" + objName);
if (curObjName == "meiti")
refreshQuarterHtml(true);
else
refreshQuarterHtml(false);
if (ddlTimeObj)
ddlTimeObj.style.display = "block";
}
//获取当前的年份
function getCurrentYear() {
var curYear = 0;
if (spanYearObj)
curYear = parseInt(spanYearObj.innerText);
return curYear;
}
function refreshYear()
{
var curYear = getCurrentYear();
if(curYear < minYear || curYear > maxYear)
{
spanYearObj.innerText = maxYear;
curYear = maxYear;
}
var btnPreYear = getElement("btnPreYear_" + curObjName);
var btnNextYear = getElement("btnNextYear_" + curObjName);
if (curYear >= maxYear)
btnNextYear.className = "hui_h";
else
btnNextYear.className = "last";
if (curYear <= minYear)
btnPreYear.className = "hui_q";
else
btnPreYear.className = "";
}
//刷新月份列表
function refreshMonthHtml()
{
refreshYear();
var curYear = getCurrentYear();
var monthList = getElement("monthList_" + curObjName);
if (monthList && curYear) {
monthList.className = "month";
var htmlCode = new Array();
var startMonth = 1;
var endMonth = 12;
if (curYear == minYear)
startMonth = minMonth;
if (curYear == maxYear)
endMonth = maxMonth;
for (var month = 1; month <= 12; month++) {
if (month >= startMonth && month <= endMonth) {
htmlCode.push("
" + month + "月");
}
else
htmlCode.push("" + month + "月");
}
monthList.innerHTML = htmlCode.join("");
}
}
function setCookie(name, value) {
var Days = 1;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";domain=" + window.location.host+";path=/";
}
function setMonth(year, month) {
dateNum = month;
var timeStr = year + "年" + month + "月";
if (spanTimeObj)
spanTimeObj.innerHTML = timeStr + '';
setCookie('tempDateObj', year + ',' + 'm' + ',' + month);
switch(curObjName)
{
case "sort":
SetIndexSort("m", year, month);
break;
case "sortList":
SetIndexCitySortList("m", year, month);
break;
case "top":
SetListMoreTop10("m", year, month);
break;
case "topforbaidu":
SetListMoreTop10ForBaidu("m", year, month);
break;
case "topc":
SetListMoreTop10("m", year, month);
break;
case "level":
SetListMoreForLevel("m", year, month);
break;
case "levelforbaidu":
SetListMoreForLevelForBaidu("m", year, month);
break;
case "compare":
setSingleDate("m", year, month);
break;
}
if (ddlTimeObj)
ddlTimeObj.style.display = "none";
}
function setSeason(year, season) {
var seasonText = year + "年第" + season + "季度";
dateNum = season;
if (spanTimeObj) {
spanTimeObj.innerHTML = seasonText+'';
}
setCookie('tempDateObj', year + ',' + 's' + ',' + season);
switch (curObjName) {
case "sort":
SetIndexSort("s", year, season);
break
case "sortList":
SetIndexCitySortList("s", year, season);
break;
// case "person":
// // 人物
// SetMediaIndex("s", year, season, "MediaPersonUL", "MediaPerson");
// break;
// case "event":
// // 事件
// SetMediaIndex("s", year, season, "MediaEventUL", "MediaEvent");
// break;
case "meiti":
// 列表
SetMediaIndex2("s", year, season);
break;
case "top":
// 前10列表
SetListMoreTop10("s", year, season);
break;
case "topc":
SetListMoreTop10("s", year, season);
break;
case "level":
// 级别更多
SetListMoreForLevel("s", year, season);
break;
case "compare":
setSingleDate("s", year, season);
break;
}
if (ddlTimeObj)
ddlTimeObj.style.display = "none";
}
function setSeason2(year, season) {
var seasonText = year + "年第" + season + "季度";
dateNum = season;
if (spanTimeObj) {
spanTimeObj.innerHTML = seasonText + '';
}
setCookie('tempDateObj', year + ',' + 's' + ',' + season);
switch (curObjName) {
case "sort":
SetIndexSort("s", year, season);
break
case "sortList":
SetIndexCitySortList("s", year, season);
break;
case "meiti":
// 列表
SetMediaIndex2("s", year, season);
break;
case "top":
// 前10列表
SetListMoreTop10("s", year, season);
break;
case "topforbaidu":
SetListMoreTop10ForBaidu("s", year, season);
break;
case "topc":
SetListMoreTop10("s", year, season);
break;
case "level":
// 级别更多
SetListMoreForLevel("s", year, season);
break;
case "levelforbaidu":
SetListMoreForLevelForBaidu("s", year, season);
break;
case "compare":
setSingleDate("s", year, season);
break;
}
if (ddlTimeObj)
ddlTimeObj.style.display = "none";
}
function setNear30d()
{
if (spanTimeObj)
spanTimeObj.innerHTML = "近30天";
SetNear30CompareIndexFlash();
}
function setNear3m()
{
if (spanTimeObj)
spanTimeObj.innerHTML = "近三个月";
SetNearMonth(3);
}
function setNear6m()
{
if (spanTimeObj)
spanTimeObj.innerHTML = "近六个月";
SetNearMonth(6);
}
function setWeek(year, week, month) {
dateNum = month;
var weekText = year + "年第" + week + "周";
if (spanTimeObj)
spanTimeObj.innerText = weekText;
if (curObjName == "sort") {
SetIndexSort("w", year, week);
}
else if (curObjName == "top") {
SetListMoreTop10("w", year, week);
}
else if (curObjName == "level") {
SetListMoreForLevel("w", year, week);
}
else { }
}
function preYear_Click() {
setYear(-1);
}
function nextYear_Click() {
setYear(1);
}
function setYear(yearVar) {
if (spanYearObj) {
var year = parseInt(spanYearObj.innerText);
year += yearVar;
if (year >= minYear && year <= maxYear) {
spanYearObj.innerText = year;
curYear = year;
if (curObjName == "meiti")
refreshQuarterHtml(true);
else
refreshQuarterHtml(false);
}
}
}
function refreshQuarterHtml(onlySeason)
{
refreshYear();
var curYear = getCurrentYear();
var monthList = getElement("monthList_" + curObjName);
if (monthList && curYear)
{
if(onlySeason)
monthList.className = "jidu h_1";
var htmlCode = new Array();
var startMonth = 1;
var endMonth = 12;
if (curYear == minYear)
startMonth = minMonth;
if (curYear == maxYear)
endMonth = maxMonth;
if(!onlySeason)
htmlCode.push("");
for (var tmpQ = 1; tmpQ <= 4; tmpQ++) {
var tmpQText = getSeasonText(tmpQ);
//本季度是否有数据
var qStartMonth = (tmpQ - 1) * 3 + 1;
var qEndMonth = tmpQ * 3;
var hasQuarter = true;
for (var month = qStartMonth; month <= qEndMonth; month++)
{
if (month < startMonth || month > endMonth)
{
hasQuarter = false;
break;
}
}
var quarterText = curYear + "年第" + tmpQText;
if (onlySeason)
htmlCode.push("");
if (hasQuarter)
htmlCode.push("" + tmpQText + "");
else
htmlCode.push("" + tmpQText + "");
if (onlySeason)
htmlCode.push("");
}
if (!onlySeason)
htmlCode.push("");
if (!onlySeason)
{
var monthCode = "";
for (var tmpNum = 1; tmpNum <= 3; tmpNum++)
{
monthCode = "";
for(var tmpNum2=1;tmpNum2 <= 4;tmpNum2++)
{
var tmpMonth = (tmpNum2 - 1) * 3 + tmpNum;
if (tmpMonth >= startMonth && tmpMonth <= endMonth)
monthCode += "" + tmpMonth + "月";
else
monthCode += "" + tmpMonth + "月";
}
monthCode += "";
htmlCode.push(monthCode);
}
}
monthList.innerHTML = htmlCode.join("");
}
}
function refreshWeekHtml() {
var curYear = getCurrentYear();
var monthList = getElement("monthList_" + curObjName);
if (monthList && curYear) {
monthList.className = "month";
ddlTimeObj.className = "open_month open_week";
var htmlCode = new Array();
var startWeek = 1;
var endWeek = 54;
if (curYear == minYear)
startWeek = minWeek;
if (curYear == maxYear)
endWeek = maxWeek;
var htmlCode = new Array();
var tmpWeek = 1;
var tmpDate = new Date(curYear, 0, 1);
var weekDay = tmpDate.getDay();
var firstWeekEnd = 6 - weekDay;
var tmpEndDate = new Date(curYear, 0, firstWeekEnd);
tmpEndDate.setDate(tmpDate.getDate() + firstWeekEnd);
while (true) {
if (tmpDate.getFullYear() > curYear)
break;
if (tmpEndDate.getFullYear() > curYear)
tmpEndDate = new Date(curYear, 11, 31);
var startDate = tmpDate.getDate();
var endDate = tmpEndDate.getDate();
if (tmpWeek >= startWeek && tmpWeek <= endWeek)
htmlCode.push("");
else
htmlCode.push("");
htmlCode.push("第" + tmpWeek + "周");
if (tmpWeek % 3 == 0)
htmlCode.push("");
else
htmlCode.push("");
htmlCode.push((tmpDate.getMonth() + 1) + "月" + startDate + "日-");
htmlCode.push((tmpEndDate.getMonth() + 1) + "月" + endDate + "日");
tmpWeek++;
tmpDate = new Date(tmpEndDate.getFullYear(), tmpEndDate.getMonth(), tmpEndDate.getDate());
tmpDate.setDate(endDate + 1);
tmpEndDate.setDate(endDate + 7);
}
monthList.innerHTML = htmlCode.join("");
}
}
function getSeasonText(season) {
var seasonText = "";
switch (season) {
case 1:
seasonText = "一";
break;
case 2:
seasonText = "二";
break;
case 3:
seasonText = "三";
break;
case 4:
seasonText = "四";
break;
}
return seasonText + "季度";
}
//打开城市框
function openDdlCity() {
cityObj = getElement("ddlCity");
if (cityObj)
cityObj.style.display = "block";
}
// 80城市扩充
function open80DdlCity() {
var city36 = [{ "id": 101, "spell": "hefei", "name": "合肥" }, { "id": 201, "spell": "beijing", "name": "北京" }, { "id": 301, "spell": "fuzhou", "name": "福州" }, { "id": 401, "spell": "lanzhou", "name": "兰州" }, { "id": 501, "spell": "guangzhou", "name": "广州" }, { "id": 502, "spell": "shenzhen", "name": "深圳" }, { "id": 601, "spell": "nanning", "name": "南宁" }, { "id": 701, "spell": "guiyang", "name": "贵阳" }, { "id": 801, "spell": "haikou", "name": "海口" }, { "id": 901, "spell": "shijiazhuang", "name": "石家庄" }, { "id": 1001, "spell": "zhengzhou", "name": "郑州" }, { "id": 1101, "spell": "haerbin", "name": "哈尔滨" }, { "id": 1201, "spell": "wuhan", "name": "武汉" }, { "id": 1301, "spell": "changsha", "name": "长沙" }, { "id": 1401, "spell": "changchun", "name": "长春" }, { "id": 1501, "spell": "nanjing", "name": "南京" }, { "id": 1502, "spell": "suzhou", "name": "苏州" }, { "id": 1601, "spell": "nanchang", "name": "南昌" }, { "id": 1701, "spell": "shenyang", "name": "沈阳" }, { "id": 1708, "spell": "dalian", "name": "大连" }, { "id": 1801, "spell": "huhehaote", "name": "呼和浩特" }, { "id": 1901, "spell": "yinchuan", "name": "银川" }, { "id": 2001, "spell": "xining", "name": "西宁" }, { "id": 2101, "spell": "jinan", "name": "济南" }, { "id": 2102, "spell": "qingdao", "name": "青岛" }, { "id": 2201, "spell": "taiyuan", "name": "太原" }, { "id": 2301, "spell": "xian", "name": "西安" }, { "id": 2401, "spell": "shanghai", "name": "上海" }, { "id": 2501, "spell": "chengdu", "name": "成都" }, { "id": 2601, "spell": "tianjin", "name": "天津" }, { "id": 2701, "spell": "lasa", "name": "拉萨" }, { "id": 2801, "spell": "wulumuqi", "name": "乌鲁木齐" }, { "id": 2901, "spell": "kunming", "name": "昆明" }, { "id": 3001, "spell": "hangzhou", "name": "杭州" }, { "id": 3002, "spell": "ningbo", "name": "宁波" }, { "id": 3101, "spell": "chongqing", "name": "重庆"}];
var city80 = [{ "id": 101, "spell": "hefei", "name": "合肥" }, { "id": 106, "spell": "fy", "name": "阜阳" }, { "id": 109, "spell": "luan", "name": "六安" }, { "id": 201, "spell": "beijing", "name": "北京" }, { "id": 301, "spell": "fuzhou", "name": "福州" }, { "id": 302, "spell": "xiamen", "name": "厦门" }, { "id": 307, "spell": "quanzhou", "name": "泉州" }, { "id": 401, "spell": "lanzhou", "name": "兰州" }, { "id": 501, "spell": "guangzhou", "name": "广州" }, { "id": 502, "spell": "shenzhen", "name": "深圳" }, { "id": 503, "spell": "zhuhai", "name": "珠海" }, { "id": 504, "spell": "dongguan", "name": "东莞" }, { "id": 505, "spell": "zhongshan", "name": "中山" }, { "id": 507, "spell": "shantou", "name": "汕头" }, { "id": 518, "spell": "foshan", "name": "佛山" }, { "id": 520, "spell": "huizhou", "name": "惠州" }, { "id": 521, "spell": "jiangmen", "name": "江门" }, { "id": 601, "spell": "nanning", "name": "南宁" }, { "id": 603, "spell": "guilin", "name": "桂林" }, { "id": 701, "spell": "guiyang", "name": "贵阳" }, { "id": 801, "spell": "haikou", "name": "海口" }, { "id": 901, "spell": "shijiazhuang", "name": "石家庄" }, { "id": 902, "spell": "tangshan", "name": "唐山" }, { "id": 903, "spell": "xingtai", "name": "邢台" }, { "id": 906, "spell": "langfang", "name": "廊坊" }, { "id": 907, "spell": "handan", "name": "邯郸" }, { "id": 909, "spell": "cangzhou", "name": "沧州" }, { "id": 910, "spell": "baoding", "name": "保定" }, { "id": 1001, "spell": "zhengzhou", "name": "郑州" }, { "id": 1002, "spell": "luoyang", "name": "洛阳" }, { "id": 1005, "spell": "xinxiang", "name": "新乡" }, { "id": 1023, "spell": "xuchang", "name": "许昌" }, { "id": 1101, "spell": "haerbin", "name": "哈尔滨" }, { "id": 1102, "spell": "daqing", "name": "大庆" }, { "id": 1201, "spell": "wuhan", "name": "武汉" }, { "id": 1207, "spell": "yichang", "name": "宜昌" }, { "id": 1301, "spell": "changsha", "name": "长沙" }, { "id": 1401, "spell": "changchun", "name": "长春" }, { "id": 1402, "spell": "jilin", "name": "吉林" }, { "id": 1501, "spell": "nanjing", "name": "南京" }, { "id": 1502, "spell": "suzhou", "name": "苏州" }, { "id": 1503, "spell": "wuxi", "name": "无锡" }, { "id": 1505, "spell": "changzhou", "name": "常州" }, { "id": 1511, "spell": "nantong", "name": "南通" }, { "id": 1518, "spell": "xuzhou", "name": "徐州" }, { "id": 1601, "spell": "nanchang", "name": "南昌" }, { "id": 1607, "spell": "ganzhou", "name": "赣州" }, { "id": 1701, "spell": "shenyang", "name": "沈阳" }, { "id": 1708, "spell": "dalian", "name": "大连" }, { "id": 1710, "spell": "anshan", "name": "鞍山" }, { "id": 1801, "spell": "huhehaote", "name": "呼和浩特" }, { "id": 1901, "spell": "yinchuan", "name": "银川" }, { "id": 2001, "spell": "xining", "name": "西宁" }, { "id": 2101, "spell": "jinan", "name": "济南" }, { "id": 2102, "spell": "qingdao", "name": "青岛" }, { "id": 2103, "spell": "yantai", "name": "烟台" }, { "id": 2104, "spell": "weihai", "name": "威海" }, { "id": 2105, "spell": "weifang", "name": "潍坊" }, { "id": 2106, "spell": "taian", "name": "泰安" }, { "id": 2109, "spell": "zibo", "name": "淄博" }, { "id": 2117, "spell": "linyi", "name": "临沂" }, { "id": 2118, "spell": "jining", "name": "济宁" }, { "id": 2201, "spell": "taiyuan", "name": "太原" }, { "id": 2207, "spell": "yuncheng", "name": "运城" }, { "id": 2301, "spell": "xian", "name": "西安" }, { "id": 2401, "spell": "shanghai", "name": "上海" }, { "id": 2501, "spell": "chengdu", "name": "成都" }, { "id": 2502, "spell": "mianyang", "name": "绵阳" }, { "id": 2601, "spell": "tianjin", "name": "天津" }, { "id": 2701, "spell": "lasa", "name": "拉萨" }, { "id": 2801, "spell": "wulumuqi", "name": "乌鲁木齐" }, { "id": 2901, "spell": "kunming", "name": "昆明" }, { "id": 3001, "spell": "hangzhou", "name": "杭州" }, { "id": 3002, "spell": "ningbo", "name": "宁波" }, { "id": 3003, "spell": "wenzhou", "name": "温州" }, { "id": 3005, "spell": "jiaxing", "name": "嘉兴" }, { "id": 3006, "spell": "jinhua", "name": "金华" }, { "id": 3015, "spell": "tz", "name": "台州" }, { "id": 3016, "spell": "shaoxing", "name": "绍兴" }, { "id": 3101, "spell": "chongqing", "name": "重庆"}];
var curDateObj = getElement("spanTime_compare").innerText;
var mpat = /(\d{4})年(\d{1,2})月/;
var spat = /(\d{4})年第(\d{1})季度/;
var result;
cityObj = getElement("ddlCity");
if (mpat.exec(curDateObj)) {
result = mpat.exec(curDateObj);
if (parseInt(result[1]) < 2015 || (parseInt(result[1]) == 2015 && parseInt(result[2]) < 7)) {
cityObj.innerHTML = makeCity(city36);
City.initCity();
cityObj.style.display = "block";
return;
} else {
cityObj.innerHTML = makeCity(city80);
City.initCity();
cityObj.style.display = "block";
return;
}
} else if (spat.exec(curDateObj)) {
result = spat.exec(curDateObj);
if (parseInt(result[1]) < 2015 || (parseInt(result[1]) == 2015 && parseInt(result[2]) < 3)) {
cityObj.innerHTML = makeCity(city36);
City.initCity();
cityObj.style.display = "block";
return;
} else {
cityObj.innerHTML = makeCity(city80);
City.initCity();
cityObj.style.display = "block";
return;
}
}
}
function makeCity(cities) {
var cityHtml = '';
cityHtml += '- 全国
';
for (var i = 0; i < cities.length; i++) {
cityHtml += '- ' + cities[i].name + '
';
}
cityHtml += '
';
return cityHtml;
}
function openDdlCityuv() {
cityObj = getElement("ddlCityuv");
if (cityObj)
cityObj.style.display = "block";
}
function openDdlCitydealer() {
cityObj = getElement("ddlCitydealer");
if (cityObj)
cityObj.style.display = "block";
}
function openDdlCitysale() {
cityObj = getElement("ddlCitysale");
if (cityObj)
cityObj.style.display = "block";
}
function setCity(tmpCityId, cityName) {
var spanCity = getElement("spanCity");
if (spanCity)
spanCity.innerHTML = cityName+'';
if (cityDateType == "month")
SetMultiLineFlash("m", tmpCityId);
else if (cityDateType == "season")
SetMultiLineFlash("s", tmpCityId);
else
SetMultiLineFlash("w", tmpCityId);
CookieForSelectDate.setCookie("indexCityId", tmpCityId.toString());
//SetIndexNavUrl(tmpCityId);
CloseCityObj();
}
function setCityuv(tmpCityId, cityName) {
var spanCity = getElement("spanCityuv");
if (spanCity)
spanCity.innerText = cityName;
if (cityDateType == "month")
SetMultiLineFlashUV("m", tmpCityId);
else if (cityDateType == "season")
SetMultiLineFlashUV("s", tmpCityId);
else
SetMultiLineFlashUV("w", tmpCityId);
CookieForSelectDate.setCookie("indexCityId", tmpCityId.toString());
SetIndexNavUrl(tmpCityId);
}
function setCitydealer(tmpCityId, cityName) {
var spanCity = getElement("spanCitydealer");
if (spanCity)
spanCity.innerText = cityName;
if (cityDateType == "month")
SetMultiLineFlashdealer("m", tmpCityId);
else if (cityDateType == "season")
SetMultiLineFlashdealer("s", tmpCityId);
else
SetMultiLineFlashdealer("w", tmpCityId);
CookieForSelectDate.setCookie("indexCityId", tmpCityId.toString());
SetIndexNavUrl(tmpCityId);
}
function setCitysale(tmpCityId, cityName) {
var spanCity = getElement("spanCitysale");
if (spanCity)
spanCity.innerText = cityName;
if (cityDateType == "month")
SetMultiLineFlashsale("m", tmpCityId);
else if (cityDateType == "season")
SetMultiLineFlashsale("s", tmpCityId);
else
SetMultiLineFlashsale("m", tmpCityId);
CookieForSelectDate.setCookie("indexCityId", tmpCityId.toString());
SetIndexNavUrl(tmpCityId);
}
var isIE11 = (window.navigator.userAgent.toLowerCase().indexOf("trident") > -1 && window.navigator.userAgent.indexOf("rv") > -1);
function document_Click(events) {
var fEvent = window.event;
if (!fEvent)
fEvent = Event;
with (fEvent) {
if (isIE11) {
if (events.target.getAttribute("tag") == null && events.target != spanTimeObj && events.target != btnTime)
CloseDateObj();
if (events.target.getAttribute("tag") == null)
CloseCityObj();
} else {
if (srcElement.getAttribute("tag") == null && srcElement != spanTimeObj && srcElement != btnTime)
CloseDateObj();
if (srcElement.getAttribute("tag") == null)
CloseCityObj();
}
}
}
function CloseDateObj() {
if (ddlTimeObj && ddlTimeObj.style.display=='block')
ddlTimeObj.style.display = "none";
}
function CloseCityObj() {
if (cityObj && cityObj.style.display == 'block')
cityObj.style.display = "none";
}
function setDateTypeUV(objName, dt) {
curObjName = objName;
if (objName == "city")
cityDateType = dt;
else
sortDateType = dt;
var dateType = dt;
var liSeason = getElement("liSeasonUV_" + objName);
var liMonth = getElement("liMonthUV_" + objName);
var liWeek = getElement("liWeekUV_" + objName);
var aSeason = getElement("aSeasonUV_" + objName);
var aMonth = getElement("aMonthUV_" + objName);
var aWeek = getElement("aWeekUV_" + objName);
if (liSeason)
liSeason.className = "";
if (liMonth)
liMonth.className = "";
if (liWeek)
liWeek.className = "";
if (aSeason)
aSeason.href = "javascript:setDateTypeUV('" + objName + "','season');";
if (aMonth)
aMonth.href = "javascript:setDateTypeUV('" + objName + "','month');";
if (aWeek)
aWeek.href = "javascript:setDateTypeUV('" + objName + "','week');";
if (dateType == "season") {
if (liSeason)
liSeason.className = "current";
if (aSeason)
aSeason.href = "javascript:void(0);";
}
else if (dateType == "month") {
if (liMonth)
liMonth.className = "current";
if (aMonth)
aMonth.href = "javascript:void(0);";
}
else {
if (liWeek)
liWeek.className = "current";
if (aWeek)
aWeek.href = "javascript:void(0);";
}
if (objName == "city") {
var cityId = IndexAjaxObject.CityID;
if (cityDateType == "month")
SetMultiLineFlashUV("m", cityId);
else if (cityDateType == "season")
SetMultiLineFlashUV("s", cityId);
else
SetMultiLineFlashUV("w", cityId);
}
// else if (objName == "sort") {
else {
var curYear = getCurrentYear();
if (sortDateType == "month") {
var tmpMonth = GetMonth();
setMonth(curYear, tmpMonth);
}
else if (sortDateType == "season") {
var tmpSeason = GetSeason();
curYear = getCurrentYear();
setSeason(curYear, tmpSeason);
}
else {
tmpWeek = GetWeek();
var month = Math.floor(tmpWeek / 4);
if (month <= 0)
month = 1;
if (month > 12)
month = 12;
setWeek(curYear, tmpWeek, month);
}
}
}
function setDateTypedealer(objName, dt) {
curObjName = objName;
if (objName == "city")
cityDateType = dt;
else
sortDateType = dt;
var dateType = dt;
var liSeason = getElement("liSeasondealer_" + objName);
var liMonth = getElement("liMonthdealer_" + objName);
var liWeek = getElement("liWeekdealer_" + objName);
var aSeason = getElement("aSeasondealer_" + objName);
var aMonth = getElement("aMonthdealer_" + objName);
var aWeek = getElement("aWeekdealer_" + objName);
if (liSeason)
liSeason.className = "";
if (liMonth)
liMonth.className = "";
if (liWeek)
liWeek.className = "";
if (aSeason)
aSeason.href = "javascript:setDateTypedealer('" + objName + "','season');";
if (aMonth)
aMonth.href = "javascript:setDateTypedealer('" + objName + "','month');";
if (aWeek)
aWeek.href = "javascript:setDateTypedealer('" + objName + "','week');";
if (dateType == "season") {
if (liSeason)
liSeason.className = "current";
if (aSeason)
aSeason.href = "javascript:void(0);";
}
else if (dateType == "month") {
if (liMonth)
liMonth.className = "current";
if (aMonth)
aMonth.href = "javascript:void(0);";
}
else {
if (liWeek)
liWeek.className = "current";
if (aWeek)
aWeek.href = "javascript:void(0);";
}
if (objName == "city") {
var cityId = IndexAjaxObject.CityID;
if (cityDateType == "month")
SetMultiLineFlashdealer("m", cityId);
else if (cityDateType == "season")
SetMultiLineFlashdealer("s", cityId);
else
SetMultiLineFlashdealer("w", cityId);
}
// else if (objName == "sort") {
else {
var curYear = getCurrentYear();
if (sortDateType == "month") {
var tmpMonth = GetMonth();
setMonth(curYear, tmpMonth);
}
else if (sortDateType == "season") {
var tmpSeason = GetSeason();
curYear = getCurrentYear();
setSeason(curYear, tmpSeason);
}
else {
tmpWeek = GetWeek();
var month = Math.floor(tmpWeek / 4);
if (month <= 0)
month = 1;
if (month > 12)
month = 12;
setWeek(curYear, tmpWeek, month);
}
}
}
function setDateTypesale(objName, dt) {
curObjName = objName;
if (objName == "city")
cityDateType = dt;
else
sortDateType = dt;
var dateType = dt;
var liSeason = getElement("liSeasonsale_" + objName);
var liMonth = getElement("liMonthsale_" + objName);
var liWeek = getElement("liWeeksale_" + objName);
var aSeason = getElement("aSeasonsale_" + objName);
var aMonth = getElement("aMonthsale_" + objName);
var aWeek = getElement("aWeeksale_" + objName);
if (liSeason)
liSeason.className = "";
if (liMonth)
liMonth.className = "";
if (liWeek)
liWeek.className = "";
if (aSeason)
aSeason.href = "javascript:setDateTypesale('" + objName + "','season');";
if (aMonth)
aMonth.href = "javascript:setDateTypesale('" + objName + "','month');";
if (aWeek)
aWeek.href = "javascript:setDateTypesale('" + objName + "','week');";
if (dateType == "season") {
if (liSeason)
liSeason.className = "current";
if (aSeason)
aSeason.href = "javascript:void(0);";
}
else if (dateType == "month") {
if (liMonth)
liMonth.className = "current";
if (aMonth)
aMonth.href = "javascript:void(0);";
}
else {
if (liWeek)
liWeek.className = "current";
if (aWeek)
aWeek.href = "javascript:void(0);";
}
if (objName == "city") {
var cityId = IndexAjaxObject.CityID;
if (cityDateType == "month")
SetMultiLineFlashsale("m", cityId);
else if (cityDateType == "season")
SetMultiLineFlashsale("s", cityId);
else
SetMultiLineFlashsale("w", cityId);
}
// else if (objName == "sort") {
else {
var curYear = getCurrentYear();
if (sortDateType == "month") {
var tmpMonth = GetMonth();
setMonth(curYear, tmpMonth);
}
else if (sortDateType == "season") {
var tmpSeason = GetSeason();
curYear = getCurrentYear();
setSeason(curYear, tmpSeason);
}
else {
tmpWeek = GetWeek();
var month = Math.floor(tmpWeek / 4);
if (month <= 0)
month = 1;
if (month > 12)
month = 12;
setWeek(curYear, tmpWeek, month);
}
}
}
function setDateType(objName, dt)
{
curObjName = objName;
if (objName == "city")
cityDateType = dt;
else
sortDateType = dt;
var dateType = dt;
var liSeason = getElement("liSeason_" + objName);
var liMonth = getElement("liMonth_" + objName);
var liWeek = getElement("liWeek_" + objName);
var aSeason = getElement("aSeason_" + objName);
var aMonth = getElement("aMonth_" + objName);
var aWeek = getElement("aWeek_" + objName);
if (liSeason)
liSeason.className = "";
if(liMonth)
liMonth.className = "";
if(liWeek)
liWeek.className = "";
if(aSeason)
aSeason.href = "javascript:setDateType('" + objName + "','season');";
if(aMonth)
aMonth.href = "javascript:setDateType('" + objName + "','month');";
if(aWeek)
aWeek.href = "javascript:setDateType('" + objName + "','week');";
if (dateType == "season")
{
if(liSeason)
liSeason.className = "current";
if(aSeason)
aSeason.href = "javascript:void(0);";
}
else if (dateType == "month")
{
if(liMonth)
liMonth.className = "current";
if(aMonth)
aMonth.href = "javascript:void(0);";
}
else
{
if(liWeek)
liWeek.className = "current";
if(aWeek)
aWeek.href = "javascript:void(0);";
}
if (objName == "city")
{
var cityId = IndexAjaxObject.CityID;
if (cityDateType == "month")
SetMultiLineFlash("m", cityId);
else if (cityDateType == "season")
SetMultiLineFlash("s", cityId);
else
SetMultiLineFlash("w", cityId);
}
// else if (objName == "sort") {
else {
var curYear = getCurrentYear();
if (sortDateType == "month") {
var tmpMonth = GetMonth();
setMonth(curYear, tmpMonth);
}
else if (sortDateType == "season") {
var tmpSeason = GetSeason();
curYear = getCurrentYear();
setSeason(curYear, tmpSeason);
}
else {
tmpWeek = GetWeek();
var month = Math.floor(tmpWeek / 4);
if (month <= 0)
month = 1;
if (month > 12)
month = 12;
setWeek(curYear, tmpWeek, month);
}
}
}
function GetMonth() {
var tmpMonth = 1;
if (sortDateType == "season")
tmpMonth = (dateNum - 1) * 3 + 1;
else
tmpMonth = dateNum;
var curYear = getCurrentYear();
if (curYear == minYear && tmpMonth < minMonth)
tmpMonth = minMonth;
if (curYear == maxYear && tmpMonth > maxMonth)
tmpMonth = maxMonth;
return tmpMonth;
}
function GetSeason() {
var tmpSeason = dateNum / 3 + (dateNum % 3 > 0 ? 1 : 0);
tmpSeason = Math.floor(tmpSeason);
var curYear = getCurrentYear();
if (curYear == maxYear)
{
var endMonth = tmpSeason * 3;
if(endMonth > maxMonth)
{
tmpSeason -= 1;
if (tmpSeason == 0)
{
tmpSeason = 4;
curYear -= 1;
spanYearObj.innerText = curYear;
}
}
}
return tmpSeason;
}
function GetWeek() {
var tmpWeek = 1;
if (sortDateType == "season")
tmpWeek = dateNum * 12 + 1;
else if (sortDateType == "month")
tmpWeek = dateNum * 4 + 1;
var curYear = getCurrentYear();
if (curYear == minYear && tmpWeek < minWeek)
tmpWeek = minWeek;
if (curYear == maxYear && tmpWeek > maxWeek)
tmpWeek = maxWeek;
return tmpWeek;
}
//初始化部分
function commonload(tmpObjName) {
document.onclick = document_Click;
ddlTimeObj = getElement("ddlMonth_" + tmpObjName);
spanTimeObj = getElement("spanTime_" + tmpObjName);
spanYearObj = getElement("spanYear_" + tmpObjName);
btnTime = getElement("btnTime_" + tmpObjName);
}
function IndexItem_onload() {
commonload("sort");
}
// top10 列表
function IndexTopListItem_onload() {
commonload("top");
}
// 级别更多列表
function IndexLevelMoreListItem_onload()
{
commonload("level");
}
function MediaIndex_load()
{
commonload("media");
}