var Config = {
	'index.shtml': 100,
	'/index.shtml': 100,
	'bsjj.shtml': 200,
	'/bsjj.shtml': 200,
	'dzqk.shtml': 300,
	'/dzqk.shtml': 300,
	'ggkl.shtml': 400,
	'/ggkl.shtml': 400,
	'lxwm.shtml': 500,
	'/lxwm.shtml': 500
	
	}

function apply(o, c, defaults) {
	if(defaults){
		apply(o, defaults);
	}
	if(o && c && typeof c == 'object'){
		for(var p in c){
			o[p] = c[p];
		}
	}
	return o;
}

function getIndex() {
	var str = window.location.pathname;
	str = str.substring(str.lastIndexOf('/') + 1);
	return Config[str] || 100;
}

function nav() {
	var index = getIndex();
	document.write('<object id="nav" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="660" height="195">');
	document.write('<param name="movie" value="/nav.swf?MenuNum=' + index + '" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="quality" value="high" />');
	document.write('<embed src="/nav.swf?MenuNum=' + index + '" name="nav" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="660" height="195"></embed>');
	document.write('</object>');
}

function each(list, fun){
    for (var p in list) { fun(list[p], p); }
};

var _minDate = '2011-01-01'; //这个最好设下，表示起始发布数据的时间，不设也可以（删掉这行），避免以往年份中周一不可点击。
var getURL = function(dp) {
	var _date = dp.cal.date, 
		y = _date.y,
		M = _date.M
		d = _date.d;
	var s = '/dzqk/' + y + '_' + M + '_' + d + '.shtml';
	return s;
}

$(document).ready(function() {
	$.fn.jqzoom && $('.jqzoom').jqzoom({
		zoomType: 'reverse',
		zoomWidth: 473,
		zoomHeight: 710,
		xOffset: 0,
		preloadText: '加载中..',
		title: false
	});
	var args = {
		minDate: _minDate,
		maxDate:'%y-%M-%d',
		disabledDays: [1, 2, 3, 4, 5, 6]
	}
	var a = apply({
		eCont: 'calendar',
		onpicked: function(dp){
			var s = getURL(dp);
			window.open(s); // 新窗口打开
		}
	}, args);
	WdatePicker(a);
	$('.x-query input[type=text]').click(function() {
		var b = apply({
			onpicked: function(dp){
				var s = getURL(dp);
				window.location.href = s; //本窗口跳转
			}
		}, args);
		WdatePicker(b);
	});
});

(function() {
	each(Config, function(item, i) {
		window['SubUrl' + item] = function() {
			location.href = i;
		}
	});
})();
