// 菜单的HTML代码
var strMenu = "<div id=\"menu\" style=\"position:absolute;display:none;\" class=\"clsMenu\" onMouseover=\"highlight()\" onMouseout=\"lowlight()\">"
strMenu += "<div class=\"menuitems\" ><table><tr><td height=4></td></tr></table></div>"
strMenu += "<div class=\"menuitems\" onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.hmhq.net');\" >设 为 首 页</div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:window.external.AddFavorite('http://www.hmhq.net/', '红马婚庆')\">加 入 收 藏</div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='lyb'\">给 我 留 言</a></div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='mailto:hongma9999@yahoo.com.cn'\">联 系 我 们</a></div>"
strMenu += "<hr>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='jhbd.asp'\">结 婚 宝 典</a></div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='jcxc.asp'\">精 彩 现 场</a></div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='hqfw.asp'\">婚 庆 服 务</a></div>"
strMenu += "<div class=\"menuitems\" onClick=\"javascript:location.href='zxdd.asp'\">在 线 订 单</a></div>"
strMenu += "<div class=\"menuitems\" ><table><tr><td height=4></td></tr></table></div>"
strMenu += "</div>"

// 判断客户端浏览器
function ie() {
	if (navigator.appName=="Microsoft Internet Explorer") {
		return true;
	} else {
		return false;
}}

// 显示菜单
function showmenu(){
	if (ie()){
	// 找出鼠标在窗口中的位置
	var rightedge=document.body.clientWidth-event.clientX
	var bottomedge=document.body.clientHeight-event.clientY

	// 如果横向的距离小于菜单的宽度
	if (rightedge<menu.offsetWidth)
		// 将菜单向左移动到适当的位置
		menu.style.left=document.body.scrollLeft+event.clientX-menu.offsetWidth
	else
		// 否则，就在该位置显示菜单
		menu.style.left=document.body.scrollLeft+event.clientX

	// 与上面道理相同，判断纵向的位置
	if (bottomedge<menu.offsetHeight)
		menu.style.top=document.body.scrollTop+event.clientY-menu.offsetHeight
	else
		menu.style.top=document.body.scrollTop+event.clientY

		menu.style.display=""
	}
	return false
}


// 隐藏菜单
function hidemenu(){
	if (ie()) menu.style.display="none"
}

// 菜单项获得焦点时加亮显示
function highlight(){
	if (event.srcElement.className=="menuitems"){
		event.srcElement.style.backgroundColor="highlight"
		event.srcElement.style.color="highlighttext"
}}

// 菜单项失去焦点
function lowlight(){
	if (event.srcElement.className=="menuitems"){
	event.srcElement.style.backgroundColor=""
	event.srcElement.style.color="menutext"
}}

if (ie()) document.write (strMenu);
document.oncontextmenu= showmenu
document.body.onclick= hidemenu