﻿<!--

document.domain = 'lib.szu.edu.cn';					// 跨域访问

var tmphtml = ''
var baseurl = ''
var tplname = 'default'
var topmark = 'top'									// 用于从页面中返回页首
var objitem = new myitem(0,0,0,'','','',0,0)
var tt_chan = new Array()							// 频道名称
var w_lists = new Array()							// 频道列表区的宽度
var colstr_mh = new Array('','red','gray')			// 设定链接文字的颜色（首项值为空，即为默认颜色）
var tgtstr_mh = new Array('',' target="_blank"')	// 设定是否在新窗口中打开链接（默认为否）

// 各频道栏目列表
// (row,col,text,href,title,target,color)

tt_chan[0] = '检索'
w_lists[0] = new Array(99,109)						// 前者用于首页，后者用于其它页面。下同。
var chan_a = new channel(0)
chan_a.additem(0,0,'本校馆藏资料','http://opac.lib.szu.edu.cn/opac/','',1,1)
chan_a.additem(1,0,'全国高校馆藏','http://www.yidu.edu.cn/','',1,0)
chan_a.additem(2,0,'深圳地区馆藏','http://www.szdnet.org.cn/','',1,0)
chan_a.additem(3,0,'学术资源门户','http://metalib.lib.szu.edu.cn:8331/V?func=find-db-1-lcl','',1,0)

tt_chan[1] = '资源'
w_lists[1] = new Array(132,142)
var chan_b = new channel(1)
chan_b.additem(0,0,'数||据||库','/resource/database/','',0,0)
chan_b.additem(0,1,'电子图书','/resource/ebooks/','',0,0)
chan_b.additem(1,0,'多||媒||体','/resource/vadata/','',0,0)
chan_b.additem(1,1,'学位论文','/resource/theses/','',0,0)
chan_b.additem(2,0,'特区资料','/resource/sezres/','',1,0)
chan_b.additem(2,1,'书　　评','/?action-review','',0,0)
chan_b.additem(3,0,'学科导航','/resource/subjects.php','',0,0)
chan_b.additem(3,1,'校外访问','http://www.szu.edu.cn/nc/view.asp?id=21','',1,1)

tt_chan[2] = '服务'
w_lists[2] = new Array(189,199)
var chan_c = new channel(2)
chan_c.additem(0,0,'开放时间','/service/hours.php','',0,0)
chan_c.additem(0,1,'读者指南','/?action-category-catid-82','',0,0)
chan_c.additem(0,2,'新　　生','/service/newcome.php','',0,0)
chan_c.additem(1,0,'设　　施','/?action-category-catid-83','',0,0)
chan_c.additem(1,1,'论文提交','/?action-category-catid-84','研究生学位论文提交',0,1)
chan_c.additem(1,2,'专家推荐','http://opac.lib.szu.edu.cn/opac/pro_rank.aspx','',1,0)
chan_c.additem(2,0,'推荐购书','http://opac.lib.szu.edu.cn/opac/readerrecommend.aspx','',1,1)
chan_c.additem(2,1,'查　　新','/?action-category-catid-85','',0,0)
chan_c.additem(2,2,'馆际互借','/service/mutual/','',0,0)
chan_c.additem(3,0,'课题检索','/service/retrieval/','',0,0)
chan_c.additem(3,1,'查收查引','/service/embodied/','',0,0)
chan_c.additem(3,2,'信息素养','/service/courses.php','',0,0)

tt_chan[3] = '概况'
w_lists[3] = new Array(71,91)
var chan_d = new channel(3)
chan_d.additem(0,0,'本馆概况','/?action-category-catid-89','',0,0)
chan_d.additem(1,0,'平面布局','/about/plan/','',0,0)
chan_d.additem(2,0,'馆编资料','/?action-category-catid-90','',0,0)
chan_d.additem(3,0,'深圳大学','http://www.szu.edu.cn/','',1,0)

function ishomepage() {
	var id = document.getElementsByTagName("BODY")[0].id
	if (id == "homepage") {
		return true
	} else {
		return false
	}
}

function iskeepcookie() {
	if (document.getElementById("setrefresh")) {
		return true
	} else {
		return false
	}
}

function myitem(channel,row,col,text,href,title,target,color) {
	this.channel = channel
	this.row = row
	this.col = col
	this.text = text
	this.href = href
	this.title = title
	this.target = target
	this.color = color
}

function channel(n) {
	this.n = n
	this.itemnum = 0
	this.items = new Array()
	this.additem = additem
}

function additem(row,col,text,href,title,target,color) {
	this.items[this.itemnum++] = new myitem(this,row,col,text,href,title,target,color)
}

function showmasthead() {
	var chans = new Array(chan_a,chan_b,chan_c,chan_d)
	tmphtml = '<div id="headrow_1"><a name="' + topmark + '"></a><div id="logo">' + (ishomepage() ? '' : ('<a href="' + baseurl + '/">'))
	tmphtml += '<img alt="Logo" src="' + baseurl + '/templates/' + tplname + '/images/logo.gif" title="深圳大学图书馆" />'
	tmphtml += (ishomepage() ? '' : '</a>') + '</div>' + (ishomepage() ? '<script type="text/javascript">showtoday()</script>' : '')
	tmphtml += '<div id="channel"><div class="clear"><ul>'
	for (var i = 0; i < tt_chan.length; i++) {
		var x = chans[i].itemnum					// 当前频道栏目总数
		var r = chans[i].items[x-1].row + 1			// 当前频道栏目列表的行数，从最后一个项目读取
		tmphtml += '<li class="float_l chantitle">'
		tmphtml += '<div>' + tt_chan[i].toString().split("")[0] + '&#160;</div>'
		tmphtml += '<div>' + tt_chan[i].toString().split("")[1] + '&#160;</div>'
		tmphtml += '</li><li class="float_l chanlist" style="width: ' + (ishomepage() ? w_lists[i][0] : w_lists[i][1]) + 'px">'
		for (var j = 0; j < r; j++) {
			var c = 0
			for (var k = 0; k < x; k++) {
				if (chans[i].items[k].row == j) {
					c += 1							// 当前行的栏目数
				}
			}
			tmphtml += '<div>&#160;'
			for (var l = 0; l < c; l++) {
				for (var m = 0; m < x; m++) {
					var item_z = chans[i].items[m]
					if (item_z.row == j && item_z.col == l) {
						if (item_z.href) {
							tmphtml += '<a href="' + ((item_z.href.charAt(0) == '/') ? baseurl : '') + item_z.href + '"'
							tmphtml += ((item_z.color > 0) ? (' style="color: ' + colstr_mh[item_z.color] + '"') : '') + tgtstr_mh[item_z.target]
							tmphtml += ((item_z.title) ? (' title="' + item_z.title + '"') : '') + '>' + item_z.text.toString().replace(/\|/g,'&#160;') + '</a>'
						} else {
							tmphtml += '<span' + ((item_z.color > 0) ? (' style="color: ' + colstr_mh[item_z.color] + '"') : '')
							tmphtml += ' title="' + item_z.title + '">' + item_z.text.toString().replace(/\|/g,'&#160;') + '</span>'
						}
						tmphtml += ((l == (c - 1)) ? '' : showbetlinks(1))
					}
				}
			}
			tmphtml += '</div>'
		}
		tmphtml += '</li>'
	}
	tmphtml += '</ul><div class="tofix"></div></div></div></div>'
	tmphtml += '<script charset="utf-8" src="' + baseurl + '/batch.panel.php?hp=' + (ishomepage() ? '1' : '') + '&rf=' + (iskeepcookie() ? '1' : '')
	tmphtml += '&ph=' + encodeURIComponent(window.location.href) + '&rand=' + parseInt(Math.random()*(1-999999)+999999) + '" type="text/javascript"></script>'
	document.write(tmphtml)
}

showmasthead()

// -------- 通用函数 begin -------- //

function showemail(user,server,string) {
	tmphtml = '<a' + ((!string) ? ' class="tosem"' : '') + ' href="ma'
	if (!server) {
		server = 'szu.edu.cn'
	}
	tmphtml += 'ilto:' + user + '@' + server + '"' + ((string) ? (' title="' + user + '@' + server + '"') : '')
	if (!string) {
		string = user + '@' + server
	}
	tmphtml += '>' + string + '</a>'
	document.write(tmphtml)
}

// 输出链接间的分隔线
function showbetlinks(n) {
	tmphtml = ''
	if (n > 0) {
		var spacing = ''
		for (var i = 1; i <= n; i++) {
			spacing += '&#160;'
		}
		tmphtml = spacing + '|' + spacing
	}
	return tmphtml
}

// 返回页首
function showgotop(style) {
	tmphtml = '<div style="' + ((style) ? style : 'padding-right: 9px; text-align: right')
	tmphtml += '"><a href="#' + topmark + '"><img alt="返回页首" src="' + baseurl + '/templates/' + tplname + '/images/gotop.gif" /></a></div>'
	document.write(tmphtml)
}

// 无需确认，直接关闭窗口
function closenodialog() {
	top.window.opener = top
	top.window.open("","_self","")
	top.window.close()
}

// 判断数字日期是否为指定格式（yyyy-mm-dd）
function isvalidate(ymd) {
	var r = /^((19)|(20))\d{2}-((0[1-9])|(1[0-2]))-((0[1-9])|([12]\d)|(3[01]))$/
	if (r.test(ymd)) {
		var l = "01,03,05,07,08,10,12"
		var y = parseInt(ymd.split("-")[0])
		var m = ymd.split("-")[1]
		var d = parseInt(ymd.split("-")[2])
		var x = ((y%4 == 0 && y%100 != 0) || y%400 == 0) ? 1 : 0
		if (m == "02" && ((x == 1 && d > 29) || (x == 0 && d > 28))) {
			return false
		} else if ((l.indexOf(m) < 0 && d > 30) || (l.indexOf(m) > -1 && d > 31)) {
			return false
		} else {
			return true
		}
	} else {
		return false
	}
}

// 将数字日期转换成中文日期
function trans2chsdate(ymd) {
	var str = ""
	var cstr = "〇一二三四五六七八九十"
	if (isvalidate(ymd)) {
		var x = parseInt(ymd.charAt(8))
		var y = ""
		for (var i = 0; i < 4; i++) {
			y = y + cstr.charAt(parseInt(ymd.charAt(i)))
		}
		var m = ((parseInt(ymd.charAt(5)) > 0) ? "十" : "") + cstr.charAt(parseInt(ymd.charAt(6)))
		var d = ((x > 0) ? (cstr.charAt(x) + "十") : "").replace("一","") + cstr.charAt(parseInt(ymd.charAt(9)))
		str = y + "年" + (m + "月" + d + "日").replace(/〇/g,"")
	} else {
		str = "×年×月×日"
	}
	document.write(str)
}

function g(id) {
	return document.getElementById(id)
}

// -------- 通用函数 end -------- //

// -------- For WebKit begin -------- //

// 判断浏览器是否使用 WebKit 引擎
function iswebkit() {
	if (navigator.userAgent.indexOf("WebKit") > -1) {
		return true
	} else {
		return false
	}
}

// 用于在新窗口中打开结果页的表单
// 插入隐藏的文本框，用以验证是否提交了与上一次完全相同的内容
function setmapping(id) {
	tmphtml = ''
	tmphtml += (iswebkit()) ? ('<input id="' + id + '_mapping" type="hidden" />') : ''
	return tmphtml
}

// 使用 WebKit 引擎的浏览器不允许提交与上一次完全相同的内容，故需重置
function setforwebkit(id) {
	if (iswebkit()) {
		var m = g(id + "_mapping")
		if (m) {
			if (g(id).value == m.value) {
				m.value = ""
				g(id).value = ""
				g(id).focus()
				return false
			} else {
				m.value = g(id).value
			}
		}
	}
}

// -------- For WebKit end -------- //

// -->
